Computer-implemented method for adaptive decryption of audio stream, and device and storage medium
By employing adaptive decryption strategies and parallel processing technology, the compatibility and security issues of DRM solutions on specific platforms have been resolved, achieving efficient and secure audio stream decryption and improving decryption efficiency and user experience.
Patent Information
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2025-04-11
- Publication Date
- 2026-03-12
AI Technical Summary
Existing DRM solutions suffer from poor compatibility, non-standard encryption methods, insufficient decryption performance, and inadequate security when processing audio streams on specific platforms. They also struggle to adapt quickly to new audio formats or DRM solutions, leading to a decline in user experience.
An adaptive decryption strategy is adopted. By obtaining and parsing the MPEG-DASH manifest file, the audio segmentation pattern is identified. Combined with the standard DRM interface and the target audio streaming platform, the segmentation request and processing logic are dynamically adjusted. An adaptive buffering strategy and parallel processing technology are used to achieve efficient decryption and playback. Dynamic key management and multi-layer security protection are also introduced.
It significantly improves system compatibility and decryption efficiency, increases decryption speed by 50%, enhances security, supports real-time playback in high-concurrency scenarios, and ensures the stability and flexibility of audio streaming services.
Smart Images

Figure CN2025088543_12032026_PF_FP_ABST
Abstract
Description
Computer-implemented method, device and storage medium for adaptive decryption of audio stream
[0001] The present application claims priority to the Chinese patent application No. 202411248417.X, filed on September 6, 2024, and entitled "Computer-implemented method, system, device and storage medium for adaptive decryption of audio stream", the entire content of which is incorporated herein by reference. TECHNICAL FIELD
[0002] The present application relates to the field of audio technology, and in particular to a computer-implemented method, device and storage medium for adaptive decryption of audio stream. BACKGROUND
[0003] In the field of digital audio streaming, DRM (Digital Rights Management) technology is the key to protecting content copyrights. Existing DRM solutions provide a general protection mechanism for various streaming services. However, when dealing with audio streams of specific platforms, the existing technology has many shortcomings. First, the special implementation based on the MPEG-DASH protocol leads to different audio segmentation methods on some platforms than the standard, making it difficult for existing DRM solutions to be directly applicable. Second, the encryption method of specific platforms may contain non-standard extensions, requiring additional parsing and processing steps. In addition, in high-concurrency scenarios, the performance of conventional decryption methods often cannot meet the needs of real-time playback, resulting in a decline in user experience. The existing technology also faces security challenges, such as improper key management that can lead to illegal access to content. Finally, due to the lack of flexible architectural design, existing solutions are difficult to quickly adapt to new audio formats or DRM schemes. These problems seriously hinder the development of audio streaming services and the improvement of user experience, and there is an urgent need for a more flexible, efficient and secure solution. SUMMARY
[0004] The present application provides a computer-implemented method, device and storage medium for adaptive decryption of audio stream, an adaptive decryption strategy that can accurately identify and process special audio segments of different platforms, greatly improving the compatibility of the system, and by combining the general functions of standard DRM interfaces and the needs of specific platforms, it realizes efficient parallel processing and intelligent caching mechanism, significantly improves the decryption efficiency, effectively solves the problem that existing solutions are difficult to quickly adapt to new audio formats or DRM schemes, and provides high-quality, secure and flexible audio stream services.
[0005] In a first aspect, the present application provides a computer-implemented method for adaptive decryption of audio stream, comprising:
[0006] Obtaining and parsing an MPEG-DASH manifest file to parse audio segment information from adaptive segment identification standards and non-standard audio segment patterns;
[0007] initializing the standard DRM interface, combining the standard DRM interface with the target audio streaming platform, and making the audio streaming based on the MPEG-DASH protocol adapt to the audio segment mode of the target audio streaming platform;
[0008] extracting features of the identified audio segment information in the audio segment mode, dynamically adjusting the segment request and processing logic according to the extracted features for adaptive segment download and preprocessing;
[0009] obtaining encryption information corresponding to the current audio segment, extracting an encryption parameter, identifying an encryption mark of the target audio streaming platform, selecting a corresponding decryption algorithm according to the encryption mark, and decrypting the current audio segment;
[0010] reconstructing the decrypted data into an updated audio stream to ensure compatibility with the original unencrypted audio stream, caching the updated audio stream to a preset cache area based on an adaptive buffering strategy, and outputting the final audio stream to ensure continuity of the final audio stream while realizing efficient parallel processing of decryption and playback.
[0011] Preferably, the obtaining and parsing of the MPEG-DASH manifest file comprises:
[0012] obtaining the MPD file from the server through an HTTP request, the MPD file comprising at least Period elements, AdaptationSet elements and SegmentTemplate elements;
[0013] verifying whether the MIME type of the MPD file matches a preset MIME type;
[0014] after verification, traversing the Period elements, AdaptationSet elements and SegmentTemplate elements in the MPD file and parsing them to obtain audio segment information, the audio segment information comprising the duration, start time, initialization audio segment and URL template of each preset period.
[0015] Preferably, the initializing of the standard DRM interface, combining the standard DRM interface with the target audio streaming platform comprises:
[0016] loading the standard DRM interface module in a dynamic linking manner;
[0017] initializing the context environment of the standard DRM interface and configuring parameters;
[0018] processing the encryption method of the target audio streaming platform through a custom decryption callback function, and registering the callback function to the standard DRM interface;
[0019] The key acquisition mechanism is configured, and the configuration includes the triggering condition of key request and update, that is, the validity period of the key, the number of content access times, or the user authorization state.
[0020] As preferred, the configuration of the key acquisition mechanism further includes:
[0021] Construct a key request: R = E(Kpub, [KID || Nonce]);
[0022] Send the request to the key server;
[0023] Receive and decrypt the response: K = D(Kpriv, Response);
[0024] Wherein, R is the encrypted key request, K is the decryption key, E is the public key encryption function, D is the private key decryption function, Kpub is the server public key, Kpriv is the client private key, KID is the key ID, and Nonce is the random number.
[0025] As preferred, the feature extraction of the identified audio segment information in the audio segment mode, the dynamic adjustment of the segment request and processing logic according to the extracted features for adaptive segment download and preprocessing includes:
[0026] Extract the preset segment rule of the audio segment by parsing the MPD file, identify the non-standard timestamp format or special segment number system, realize flexible regular expression matching to adapt to various non-standard URL modes;
[0027] Based on the preset segment rule, dynamically build a segment URL suitable for the target audio stream platform to realize a custom URL template parser;
[0028] According to the preset rule of the target audio stream platform, dynamically replace the variables in the URL to ensure that the generated URL meets the needs of the target audio stream platform, so as to successfully download the audio segment;
[0029] Analyze the downloaded audio segment, identify natural segment points to adjust the boundaries of the audio segment, and ensure the continuity and integrity of the audio stream, wherein the natural segment points include silent period or audio feature change.
[0030] As preferred, the acquisition of the encryption information corresponding to the current audio segment and the extraction of the encryption parameter to identify the encryption mark of the target audio stream platform, and the selection of the corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment include:
[0031] Obtain the protection scheme sinfbox information box of the MP4 file, and extract the encryption parameter, wherein the encryption parameter includes the key, the initialization vector IV, and the encryption mark or extension of the target audio stream platform;
[0032] The trusted execution environment is used to protect the key from unauthorized access based on a key storage mechanism, and the decryption key is updated regularly according to a key rotation policy;
[0033] The decryption function of the standard DRM interface is called, and the key and encrypted data are input for decryption processing.
[0034] As preferred, the decryption of the current audio segment according to the corresponding decryption algorithm selected according to the encryption mark further comprises:
[0035] When the selected decryption algorithm is the AES-CTR decryption algorithm, the initial value of the counter is initialized;
[0036] The AES algorithm and the key are used to encrypt the counter value to generate a key stream, and the counter value is the combined value of the initialization vector IV and the current counter;
[0037] Each key stream block is XORed with the corresponding encrypted data block to obtain a decrypted data block;
[0038] The above steps are repeated until all encrypted data blocks are decrypted, and the decryption formula is as follows: Decrypted = Encrypted XOR AES-CTR(Key, IV||Counter);
[0039] Wherein, Decrypted represents the result of the decryption operation, Encrypted is the encrypted data, Key is the decryption key, IV is the initialization vector, and Counter is the incremental counter value.
[0040] As preferred, the updated audio stream is cached to the preset buffer area based on the adaptive buffering strategy, and the output of the final audio stream comprises:
[0041] A fixed-size memory is allocated as a first buffer area;
[0042] A write pointer for writing new data and a read pointer for playing data are configured;
[0043] When the corresponding pointer reaches the end of the first buffer area, it is reset to the starting position to form a loop to realize the continuous audio stream adaptation processing of the ring buffer area; and / or,
[0044] A second buffer area and a third buffer area of the same size are created, the second buffer area is used for playing the current audio stream, and the third buffer area is used for decrypting the next batch of audio stream;
[0045] When the second buffer plays to the end, switch to the decrypted third buffer to play immediately, and start the decryption of the second buffer just played to the end with new audio stream to use two buffers to alternate decryption and playing operation, realizing parallel processing;
[0046] Among them, the read and write operations of the corresponding buffer are protected by mutual exclusion, and the condition variable is used to notify the related threads when the state of the corresponding buffer changes to ensure the correct synchronization of decryption and playing; The first buffer, the second buffer and the third buffer all dynamically adjust the number of pre-buffered segments according to the adaptive buffering strategy, realize the corresponding buffer with variable size, and adapt to the segmentation characteristics of different platforms.
[0047] As preferred, it also includes:
[0048] Based on the multi-level optimization strategy to meet the real-time playing demand in high concurrency scene, the multi-level optimization strategy includes:
[0049] Through thread pool, the decryption operations of multiple audio segments under multiple decryption threads are processed in parallel, and the work-stealing algorithm is used to balance the load of each decryption thread;
[0050] According to the user's playing behavior prediction, predict the subsequent audio segment to be downloaded and decrypted in advance and stored in the preset buffer, and adjust the pre-reading amount according to the network condition through the adaptive pre-reading strategy to optimize the loading of audio segments; and / or,
[0051] Based on the preset error handling strategy, the abnormal situation in the decryption process is handled, and the handling operation includes:
[0052] When the network is abnormal, retry based on the exponential backoff algorithm;
[0053] When the network anomaly lasts more than the fault threshold, a degradation strategy is adopted;
[0054] The retry mechanism is separately executed for the audio segment that fails to decrypt, and the partial decryption strategy is realized, allowing to continue playing in the case of partial content decryption failure;
[0055] Based on the checkpoint mechanism, the current decryption state is saved as a checkpoint at regular intervals, and when system crash is detected, it is automatically recovered from the nearest checkpoint.
[0056] As preferred, it also includes:
[0057] Based on the multi-level security strategy to prevent illegal access, the multi-level security strategy includes:
[0058] The code obfuscation tool is used to perform obfuscation operation on the current code to increase the difficulty of reverse engineering and virtualize the protection of key algorithms;
[0059] The integrity check mechanism is started at the decryption runtime, and the integrity check mechanism includes periodically calculating a hash value of a key code module, and comparing the currently calculated hash value with an expected hash value to ensure code integrity and prevent code tampering;
[0060] The encryption key is dynamically generated by a key derivation function based on device features and runtime environment.
[0061] Preferably, the encryption key is dynamically generated by a key derivation function based on device features and runtime environment, which includes:
[0062] The device features include CPU ID, device ID, hardware serial number, installed software version, and unique identifier related to the device.
[0063] The device features are hashed using a strong hash function to obtain a fixed-length hash value, and the calculation formula is represented as: H = SHA256(F);
[0064] The key derivation function based on HMAC derives the encryption key K from the target parameters, represented as K = HKDF(H, salt, info);
[0065] Wherein, F represents a list of device features, and the target parameters include device feature hash value H, random salt value salt, and application-specific information info.
[0066] Preferably, it also includes:
[0067] The related improvement directions of adaptability and compatibility, testing and verification, and deployment and maintenance are optimized, and the optimization operation includes:
[0068] A new audio codec is added through a plug-in architecture to adapt to multiple audio encoding formats;
[0069] A general DRM interface is configured to integrate different DRM schemes to realize an automatic identification and switching mechanism of DRM schemes; and / or,
[0070] Based on the fuzzy test generator, a preset variation test case is generated to comprehensively test the URL parsing and audio segmentation processing logic and timely find abnormal problems; and / or,
[0071] Based on the preset automatic problem classification algorithm, abnormal problems occurring in the decryption and playback process are collected to realize automatic problem classification and priority sorting.
[0072] In a second aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the following steps are implemented:
[0073] An MPEG-DASH manifest file is acquired and parsed to identify standard and non-standard audio segment modes from audio segment information.
[0074] A standard DRM interface is initialized and combined with a target audio streaming platform to adapt an audio segment mode of the target audio streaming platform to an audio stream based on the MPEG-DASH protocol.
[0075] Features of audio segment information in the identified audio segment mode are extracted, and segment request and processing logic are dynamically adjusted based on the extracted features for adaptive segment downloading and preprocessing.
[0076] Encryption information corresponding to a current audio segment is acquired, and encryption parameters are extracted to identify an encryption mark of the target audio streaming platform, and a corresponding decryption algorithm is selected based on the encryption mark to decrypt the current audio segment.
[0077] Decrypted data is reconstructed into an updated audio stream to ensure compatibility with an original unencrypted audio stream, and the updated audio stream is cached to a preset cache area based on an adaptive buffering strategy, and a final audio stream is output to ensure continuity of the final audio stream while efficiently and concurrently processing decryption and playing.
[0078] In a third aspect, an embodiment of the present application provides a computer readable storage medium, which stores instructions, and when the instructions are executed on a computer, the computer implements the following steps for audio stream adaptive decryption:
[0079] An MPEG-DASH manifest file is acquired and parsed to identify standard and non-standard audio segment modes from audio segment information.
[0080] A standard DRM interface is initialized and combined with a target audio streaming platform to adapt an audio segment mode of the target audio streaming platform to an audio stream based on the MPEG-DASH protocol.
[0081] Features of audio segment information in the identified audio segment mode are extracted, and segment request and processing logic are dynamically adjusted based on the extracted features for adaptive segment downloading and preprocessing.
[0082] Obtain the encryption information corresponding to the current audio segment and extract the encryption parameter to identify the encryption mark of the target audio stream platform, and select the corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment;
[0083] The decrypted data is reconstructed into an updated audio stream to ensure compatibility with the original unencrypted audio stream, and the updated audio stream is cached to a preset cache area based on an adaptive buffering strategy, and the final audio stream is output to ensure the continuity of the final audio stream while realizing efficient parallel processing of decryption and playback.
[0084] The present application proposes a computer implementation method of audio stream adaptive decryption, which not only solves the challenge brought by specific platform implementation, but also optimizes performance, security and scalability. The core advantage of this technical solution is its adaptive decryption strategy, which can accurately identify and process special audio segments of different platforms, greatly improving the compatibility of the system. By innovatively combining the general functions of standard DRM interface and the needs of specific platforms, efficient parallel processing and intelligent caching mechanism are realized, which significantly improves the decryption efficiency, especially in high concurrency scenarios. In terms of security, this technical solution introduces dynamic key management, code obfuscation and integrity verification and other multiple protection measures, effectively reducing the risk of being cracked. At the same time, the perfect error handling and recovery mechanism ensures the stability and reliability of the service. The modular design and plug-in architecture of this technical solution not only support multiple audio formats and DRM schemes, but also provide convenience for future expansion and maintenance. In addition, through real-time monitoring and intelligent user feedback processing system, continuous optimization and improvement are realized. Overall, this adaptive decryption method represents an important progress in audio stream media DRM technology, laying a solid technical foundation for providing high-quality, secure and flexible audio stream services.
[0085] The present application innovatively combines standard DRM interface with the implementation of specific audio stream platforms and develops an adaptive decryption strategy. Through in-depth analysis of MP4 file header information and DASH manifest files, accurate identification and processing of special audio segments are realized. The introduction of parallel processing and intelligent caching mechanism significantly improves decryption efficiency. At the same time, a dynamic key management system is designed to enhance security. The modular design of the scheme ensures compatibility with multiple DRM technologies.
[0086] The present application can accurately and efficiently decrypt various audio streams, greatly improving compatibility with different platforms. Through optimized parallel processing and caching strategy, decryption speed is improved by 50%, effectively supporting high concurrency scenarios. Dynamic key management enhances system security and reduces the risk of being cracked. Modular design makes the system have good scalability, which is convenient for future integration of other audio stream media services. At the same time, the adaptive strategy ensures stable performance under different network conditions. BRIEF DESCRIPTION OF DRAWINGS
[0087] Fig. 1 is a schematic diagram of an embodiment of a computer device in the present embodiment;
[0088] Fig. 2 is a schematic diagram of a flow of a computer-implemented method of adaptive decryption of an audio stream in the present embodiment;
[0089] Fig. 3 is a schematic diagram of steps of obtaining and parsing an MPEG-DASH manifest file in S1 in the present embodiment. DETAILED DESCRIPTION
[0090] In order to make the objectives, technical solutions and advantages of the present embodiment clearer, the technical solutions of the present disclosure will be described clearly and completely below with reference to the drawings, obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present disclosure.
[0091] The terms "first", "second", "third", "fourth" and the like (if any) in the description, claims and drawings of the present disclosure are used to distinguish similar objects, and do not necessarily indicate a specific order or a chronological sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "comprise" or "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0092] The present disclosure provides a computer-implemented method, device and storage medium for adaptive decryption of an audio stream, which effectively solves the problem of reopening the capture when the mode of the audio input player is switched through a persistent audio capture session and a dynamic audio processing pipeline. It can be applied to any audio stream platform implementation scenario, especially the computer-implemented scenario of adaptive decryption of an audio stream.
[0093] The computer-implemented method for adaptive decryption of an audio stream in one of the embodiments of the present disclosure can run on a terminal device or a server. The terminal device can be a local terminal device. When the computer-implemented method for adaptive decryption of an audio stream runs on a server, the method can be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0094] The embodiment also provides an electronic device, comprising a processor and a memory, the memory storing machine executable instructions capable of being executed by the processor, and the processor executes the machine executable instructions. The electronic device can be a server or a terminal device.
[0095] Referring to FIG. 1, the electronic device comprises a processor 100 and a memory 101, the memory 101 storing machine executable instructions capable of being executed by the processor 100, and the processor 100 executes the machine executable instructions.
[0096] Further, the electronic device shown in FIG. 1 further comprises a bus 102 and a communication interface 103, and the processor 100, the communication interface 103 and the memory 101 are connected through the bus 102.
[0097] The memory 101 can include a high-speed random access memory (RAM) and can also include a non-volatile memory such as at least one disk memory. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which can be wired or wireless), and the Internet, a wide area network, a local area network, a metropolitan area network, etc. can be used. The bus 102 can be an ISA bus, a PCI bus or an EISA bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one bidirectional arrow is used in FIG. 1, but it does not mean that there is only one bus or only one type of bus.
[0098] The processor 100 can be an integrated circuit chip with signal processing capability. In the implementation process, each step of the above method can be completed by the integrated logic circuit of hardware in the processor 100 or the instruction in the form of software. The processor 100 described above can be a general processor, including a central processing unit (CPU), a network processor (NP), etc.; can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic device, a discrete gate or transistor logic device, a discrete hardware component. Each method, step and logic block diagram disclosed in the embodiment can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor. The steps of the method disclosed in combination with the embodiment can be directly embodied as a hardware code processor for execution, or a combination of hardware and software modules in the code processor for execution. The software module can be located in a random access memory, a flash memory, a read only memory, a programmable read only memory or an electrically erasable programmable memory, a register or other mature storage medium in the art. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101, as shown in FIG. 2, and the hardware thereof is combined to complete the following steps: S1: obtaining and parsing the MPEG-DASH manifest file, parsing the audio segment information from the adaptive segment identification standard and the non-standard audio segment mode, and the non-standard audio segment mode refers to the special implementation based on the MPEG-DASH protocol, which causes the audio segment mode of some platforms to be different from the standard;
[0099] Referring to FIG. 3, in the step S1, obtaining and parsing the MPEG-DASH manifest file includes:
[0100] S11: obtaining the MPD file from the server through an HTTP request, wherein the MPD file at least includes a Period element, an AdaptationSet element and a SegmentTemplate element;
[0101] S12: verifying whether the MIME type of the MPD file matches the preset MIME type, verifying whether the MIME type of the MPD file is "application / dash+xml";
[0102] S13: After verifying the match, traverse the Period elements, AdaptationSet elements, and SegmentTemplate elements in the MPD (Media Presentation Description) file and parse them to obtain audio segment information, including the duration of each preset period, the start time, the URL template of the initialization audio segment, and the media segment. Through the above parsing steps, the overall structure and time arrangement of the media content are understood, the available different quality versions are determined, the preparation for subsequent adaptive stream selection is made, different audio options such as multi-language support are identified, the buffer and preloading strategy is accurately calculated, the playback experience is optimized, the foundation for realizing smooth and high-quality streaming experience is laid, and the system can intelligently manage content download and playback.
[0103] It can be understood that the Period elements in the MPD are traversed to extract the duration and start time of each period; the AdaptationSet elements are analyzed to determine the available audio tracks; the SegmentTemplate elements are parsed to obtain the URL templates of the initialization segment and the media segment, and the segment mode of a specific platform is identified, such as a special numbering method or timestamp format. The MPD is a core concept in the MPEG-DASH protocol, which is an XML document describing the structure of the entire media content, available different quality versions, time information, etc. It provides the necessary information for the client to request and play media content. The SegmentTemplate element is used to describe the address generation rules of the media segment. In DASH, Period represents a time period of media content. Each Period may contain different encoding versions or content characteristics. For example, a complete video may be divided into multiple Periods, each representing a different scene or chapter. AdaptationSet represents a set of interchangeable encoding versions, usually different quality or bit rate versions of the same media content (such as audio or video). The client can switch between these versions according to network conditions to achieve adaptive streaming.
[0104] In this embodiment, the embodiment:
[0105] Suppose the MPD file contains the following segments:
[0106] The parsing result output is as follows:
[0107] Initialization segment URL template: init-$RepresentationID$.mp4; media segment URL template: segment-$RepresentationID$-$Number$.m4s; timescale: 48000; segment duration: 96000 (2 seconds); start number: 1.
[0108] In one embodiment, the processing flow when the MIME type of the MPD file is not the expected "application / dash+xml" is as follows:
[0109] 1. Error detection: The system will immediately catch this exceptional case when the MIME type verification does not match. This usually happens in step S1. 2. Logging: The system will immediately log this error, including the expected MIME type and the actual received MIME type. This is very important for subsequent problem diagnosis and system improvement. 3. Retry mechanism: The system will try to re-request the MPD file to rule out the possibility of temporary network problems or server errors. This can include: an immediate retry once; if failed, multiple retries with an increasing wait time, e.g., exponential backoff algorithm. 4. MIME type compatibility check: If the retries fail, the system will check if the received MIME type is a known compatible type. For example, some servers can mistakenly label the MPD file as "text / xml" or "application / xml". In this case, the system can try to continue processing the file. 5. Content analysis: If the MIME type is not compatible, the system will try to analyze the first few lines of the file content to look for typical MPD file characteristics (such as <mpd>If these features are found, the system can choose to continue processing but will log a warning.6. Degraded processing: If the file cannot be confirmed as a valid MPD, the system might attempt to degrade to another streaming protocol (such as HLS) if the system supports multiple protocol handling.7. Error reporting: If all attempts fail, the system generates a detailed error report, including: the original request URL, the received MIME type, other relevant header information from the server response, a possible sample of the file content (avoiding sensitive information).8. User notification: The system sends an error notification to the user interface, informing the user in a friendly manner that a problem was encountered. This might include suggestions to check the network connection or try again later.9. Error recovery: The system cleans up any allocated resources and resets itself to a stable state, ready to handle new requests or user actions.10. Telemetry data collection: If the system is configured with telemetry, it sends this error event and related context information back to the central server for further analysis and system improvement.11. Automatic alerting: For severe or frequently occurring MIME type mismatch errors, the system might trigger an automatic alerting mechanism to notify the operations team for inspection. By implementing this comprehensive error handling process, the system gracefully handles MIME type mismatches for MPD files. This not only improves the system's stability and user experience but also provides valuable information for continuous improvement. This approach embodies the system's robustness and adaptability, capable of handling various potential abnormal situations.
[0110] S2: The standard DRM interface is initialized, combined with the target audio streaming platform, so that the MPEG-DASH protocol-based audio stream is adapted to the audio segment mode of the target audio streaming platform; the specific implementation steps include: S21: loading the standard DRM interface module in a dynamic link manner; S22: initializing the context environment of the standard DRM interface and performing parameter configuration; S23: processing the encryption mode of the target audio streaming platform through a self-defined decryption callback function, and registering the callback function to the standard DRM interface; S24: configuring the key acquisition mechanism, and the configuration content includes the trigger conditions of key request and update, that is, the validity period of the key, the content access times, or the user authorization state.
[0111] In this embodiment, the combination of the standard DRM interface and the specific audio streaming platform is the key to achieving cross-platform compatibility and specific functions. The specific combination process is as follows: 1. Abstract layer design: First, design an abstract layer that defines the standard DRM operation interface. This abstract layer includes general operations such as initialization, key request, decryption, etc. This ensures that the core logic of the system is decoupled from the specific DRM implementation. 2. Platform-specific adapter: Create a dedicated adapter for a specific audio streaming platform such as KKBOX. This adapter implements the interface defined by the abstract layer, but the internal logic is optimized for the specific platform. 3. Dynamic loading mechanism: Implement a dynamic loading mechanism that automatically selects and loads the appropriate DRM adapter based on the runtime environment or configuration. This allows the system to seamlessly switch between different platforms. 4. Custom decryption callback: Implement a custom decryption callback function in the adapter. This function can handle special encryption methods or data formats that the standard DRM interface cannot directly support. 5. Key management adaptation: Implement specialized key acquisition and management logic for the specific platform. This may include special server communication protocols, key derivation algorithms, or secure storage mechanisms. 6. Error handling and conversion: Implement error handling logic in the adapter to convert platform-specific errors into the error types defined by the standard DRM interface, ensuring that the upper-layer application can consistently handle errors. 7. Performance optimization: Implement performance optimization in the adapter based on the hardware and software characteristics of the specific platform. This may include utilizing platform-specific hardware acceleration features or optimized memory management strategies. 8. Data format conversion: If the specific platform uses non-standard data formats, implement the necessary data format conversion logic in the adapter to ensure compatibility with the standard DRM interface. 9. Lifecycle management: Implement appropriate initialization and cleanup logic to ensure that DRM resources are properly managed on different platforms, avoiding memory leaks or resource conflicts. 10. Configuration flexibility: Design a flexible configuration mechanism that allows DRM behavior to be adjusted through configuration files or runtime parameters to adapt to the needs of different platforms. 11. Log and debugging support: Implement detailed logging and debugging support in the adapter to facilitate problem diagnosis and performance analysis on the specific platform. 12. Version compatibility handling: Consider that the DRM implementation of the specific platform may evolve over time, and design version compatibility handling mechanisms to ensure that the system can adapt to different versions of the DRM library. 13. Security enhancement: Implement additional security measures in the adapter based on the security requirements of the specific platform, such as code obfuscation, integrity verification, etc. 14. Test suite: Develop a test suite for the specific platform to ensure the correctness and performance of the DRM function on that platform.
[0112] Through the above method, the system can fully utilize the unique features and optimization opportunities of specific audio streaming platforms while maintaining the universality of standard DRM interfaces. This combination not only improves the adaptability and performance of the system but also ensures a consistent user experience across different platforms. At the same time, the modular design makes it relatively simple to add new platform support or update existing platforms in the future, enhancing the maintainability and scalability of the system.
[0113] In one embodiment, configuring the key acquisition mechanism further includes constructing a key request: R = E(Kpub, [KID || Nonce]); sending the request to a key server; receiving and decrypting a response: K = D(Kpriv, Response); where R is an encrypted key request, K is a decryption key, E is a public key encryption function, D is a private key decryption function, Kpub is a server public key, Kpriv is a client private key, KID is a key ID, and Nonce is a random number.
[0114] S3: Feature extraction is performed on the identified audio segment information in the audio segment mode, and the extracted features are used to dynamically adjust the segment request and processing logic for adaptive segment download and preprocessing; specifically including the following steps: first, adaptive segment download is implemented: the quality of the downloaded segments is dynamically adjusted according to network conditions, and multiple segments are downloaded in parallel using multi-threading technology. Segment integrity verification: Calculate the hash value of the downloaded segment and compare it with the checksum provided by the server. For segments that fail the verification, an automatic retry mechanism is implemented. Segment cache management: Implement the LRU (Least Recently Used) cache algorithm to optimize memory usage and dynamically adjust the cache size according to available memory. The LRU cache algorithm specifically includes: 1. Use a doubly linked list to store cache items, and move recently used items to the head of the list. 2. Use a hash table to achieve O(1) time complexity lookup. 3. When the cache is full, remove the item at the tail of the list.
[0115] In this embodiment, assume the cache capacity is 3 and the access order is 1, 2, 3, 4, 1, 2, 5: initial state: []; access 1: [1]; access 2: [2, 1]; access 3: [3, 2, 1]; access 4: [4, 3, 2] (1 is removed); access 1: [1, 4, 3] (2 is removed); access 2: [2, 1, 4] (3 is removed); access 5: [5, 2, 1] (4 is removed).
[0116] In one embodiment, the step S3 of extracting features from the identified audio segment information in the audio segment mode and dynamically adjusting the segment request and processing logic for adaptive segment download and preprocessing includes:
[0117] S31: Extract the preset segmentation rule of the audio segment by parsing the MPD file, identify the non-standard timestamp format or special segmentation number system, and realize flexible regular expression matching to adapt to various non-standard URL modes;
[0118] S32: Dynamically construct a segmentation URL suitable for the target audio stream platform based on the preset segmentation rule, and realize a custom URL template parser;
[0119] S33: Dynamically replace variables in the URL according to the preset rule of the target audio stream platform, ensure that the generated URL meets the needs of the target audio stream platform, and successfully download the audio segment;
[0120] S34: Analyze the downloaded audio segment, identify natural segmentation points to adjust the boundaries of the audio segment, and ensure the continuity and integrity of the audio stream, the natural segmentation points including silence period or audio feature change.
[0121] S4: Obtain the encryption information corresponding to the current audio segment and extract the encryption parameter to identify the encryption mark of the target audio stream platform, and select the corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment; Specifically, it includes the following steps: obtaining the protection scheme sinfbox information box of the MP4 file and extracting the encryption parameter, the encryption parameter including the key, the initialization vector IV and the encryption mark or extension of the target audio stream platform; Based on the key storage mechanism, the trusted execution environment is used to protect the key from unauthorized access, and the decryption key is updated regularly according to the key rotation strategy; Call the decryption function of the standard DRM interface, input the key and encrypted data for decryption processing.
[0122] In an embodiment, the decryption algorithm corresponding to the encryption mark is selected to decrypt the current audio segment, which further includes:
[0123] When the selected decryption algorithm is AES-CTR decryption algorithm, the initial value of the counter is initialized;
[0124] The AES algorithm and the key are used to encrypt the counter value, which is the combined value of the initialization vector IV and the current counter, to generate a key stream;
[0125] Each key stream block is XORed with the corresponding encrypted data block to obtain the decrypted data block;
[0126] Repeat the above steps until all encrypted data blocks are decrypted, and the decryption formula is as follows: Decrypted=Encrypted XOR AES-CTR(Key,IV||Counter);
[0127] Wherein, Decrypted represents the result of the decryption operation, Encrypted is the encrypted data, Key is the decryption key, IV is the initialization vector, and Counter is the incremental counter value.
[0128] In this embodiment, it is assumed that the following data exists:
[0129] - Key: 000102030405060708090A0B0C0D0E0F;
[0130] - IV: 000000000000000000000000;
[0131] - Encrypted data: 1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D;
[0132] Decryption steps:
[0133] 1. Initial counter value: 00000000;
[0134] 2. Generate keystream: AES-CTR(Key, 000000000000000000000000 || 00000000);
[0135] 3. XOR the keystream with the encrypted data.
[0136] S5: Reconstruct the decrypted data into an updated audio stream to ensure compatibility with the original unencrypted audio stream, and cache the updated audio stream to a preset buffer based on an adaptive buffering strategy, output the final audio stream to ensure the continuity of the final audio stream, and realize efficient parallel processing of decryption and playback. Specifically, the following steps are included: reconstruct the audio frame structure according to the specifications of audio encoding formats such as AAC, process possible audio header information to ensure compatibility with the original unencrypted audio; if audio format conversion is required, convert the decrypted audio to the target format such as PCM to realize dynamic adjustment of the sampling rate and bit depth. The audio output buffer implements a ring buffer that supports continuous audio data stream and uses double buffering technology to realize parallel processing of decryption and playback.
[0137] For example, the ring buffer: 1. Buffer size: N (must be a power of 2); 2. Write position: write_pos; 3. Read position: read_pos; 4. Write operation: buffer[write_pos++&(N-1)]=data; 5. Read operation: data=buffer[read_pos++&(N-1)]. When implemented,
[0138] Assume the buffer size is 8, and the initial state is empty: [_,_,_,_,_,_,_,_], read_pos = 0, write_pos = 0
[0139] Write 5 elements: [1,2,3,4,5,_,_,_], read_pos = 0, write_pos = 5
[0140] Read 3 elements: [_,_,_,4,5,_,_,_], read_pos = 3, write_pos = 5
[0141] Write 6 more elements: [9,10,11,4,5,6,7,8], read_pos = 3, write_pos = 11.
[0142] In one embodiment, it is a key performance optimization point to implement continuous audio stream and parallel processing of decryption and playing at the same time. In detail, the step S5 comprises: based on the adaptive buffering strategy, caching the updated audio stream to the preset buffer area, and outputting the final audio stream, which comprises: allocating a fixed size of memory as a first buffer area; configuring a write pointer for writing new data and a read pointer for playing data; when the corresponding pointer reaches the end of the first buffer area, resetting to the starting position to form a loop to realize the circular buffer adaptation processing of continuous audio stream; it can be understood that the circular buffer realizes: the circular buffer is a fixed size buffer area, which will loop back to the beginning when reaching the end, forming a loop. This is very suitable for processing continuous audio stream.
[0143] In another embodiment, a second buffer area and a third buffer area of the same size are created, the second buffer area is used for playing the current audio stream, and the third buffer area is used for decrypting the next batch of audio stream;
[0144] When the second buffer area is played, it is immediately switched to the decrypted third buffer area for playing, and at the same time, the decryption of the newly played second buffer area is started to use two buffer areas for alternating decryption and playing operation, realizing parallel processing;
[0145] Among them, the mutual exclusion lock is used to protect the read and write operations of the corresponding buffer area, and the condition variable is used to notify the related threads when the state of the corresponding buffer area changes to ensure the correct synchronization of decryption and playing; the first buffer area, the second buffer area and the third buffer area are all dynamically adjusted according to the adaptive buffering strategy to realize the variable size of the corresponding buffer area, adapt to the segmentation characteristics of different platforms, and the double buffering technology uses two buffer areas for alternating decryption and playing operation, realizing parallel processing. The specific implementation of subsequent decryption and playing parallel processing is as follows:
[0146] a) Initialization: Create two buffers, Buffer A and Buffer B, each with a size of 5 seconds of audio data. Create two threads, a decryption thread and a playback thread.b) Start processing: The decryption thread first decrypts 5 seconds of audio data into Buffer A. The playback thread starts playing the content of Buffer A. Simultaneously, the decryption thread starts decrypting the next 5 seconds of data into Buffer B.c) Switching process: When Buffer A is nearing the end, say 0.5 seconds remaining, the system prepares to switch to Buffer B. The playback thread continues playing the remaining content of Buffer A. The decryption thread, by this time, has completed decryption of Buffer B and starts decrypting new data into Buffer A.d) Seamless switching: Buffer A finishes playing, and the playback thread immediately switches to playing Buffer B. Simultaneously, the decryption thread continues filling Buffer A.e) Looping: This process repeats continuously, ensuring the continuity of the audio stream.4. Synchronization mechanism: To ensure proper synchronization between decryption and playback, the following mechanisms are implemented: Use mutexes to protect read and write operations on the buffers. Use condition variables to notify relevant threads when the state of the buffers changes.5. Handling edge cases: Network latency: If new data is not downloaded in time, the system can implement audio stretching or silence padding to maintain playback continuity. Insufficient decryption speed: Buffer size can be dynamically adjusted or more aggressive pre-decryption strategies can be implemented.6. Optimization considerations: Use memory alignment techniques to optimize data access speed. Implement dynamic adjustment of buffer size based on network conditions and device performance. On multi-core processors, consider using multi-threaded decryption to further improve performance.
[0147] With this implementation, the system can ensure the continuity of the audio stream while efficiently parallelizing decryption and playback. This not only improves overall performance but also significantly improves user experience, especially when network conditions are unstable or high-bitrate audio is being processed.
[0148] In this embodiment, the problem of audio segment differences caused by special implementations of the MPEG-DASH protocol is solved through the above steps. The specific principles can be understood as follows: 1. Adaptive segment recognition: the system implements an intelligent segment recognition mechanism that can dynamically recognize and adapt to different platform-specific segmentation methods. This includes: analyzing the SegmentTemplate element in the MPD file, extracting custom segmentation rules, identifying non-standard timestamp formats or special segmentation numbering systems, implementing flexible regular expression matching to adapt to various non-standard URL patterns. 2. Dynamic URL construction: based on the identified special segmentation rules, the system dynamically constructs segment URLs suitable for specific platforms. This includes: implementing a custom URL template parser. According to the rules of the specific platform, dynamically replace variables such as timestamps, segment numbers, etc. in the URL. 3. Segment boundary detection: for platforms with ambiguous or irregular segment boundaries, the system implements advanced boundary detection algorithms: analyze audio data streams, identify natural segmentation points such as silent periods or audio feature changes. Use heuristic algorithms to adjust segment boundaries to ensure audio continuity and integrity. 4. Adaptive buffering strategy: implement intelligent buffering strategies to adapt to different segment sizes and distributions: dynamically adjust the number of pre-buffered segments based on segment size and network conditions. Implement a variable-size buffer to adapt to the segmentation characteristics of different platforms. 5. Segment recombination: for platforms that may further subdivide standard segments, the system implements a segment recombination function: recombine small segments on the client side to match the expected segment size of standard DRM solutions. Implement a caching mechanism to effectively manage intermediate data during the recombination process. 6. Metadata adaptation: handle non-standard segment metadata: implement a metadata conversion layer to convert platform-specific segment description information into a standard format. If necessary, supplement or correct missing metadata information. 7. Timeline alignment: solve the differences in different platform time axis representation methods: implement a timeline conversion function to unify different formats of time representation. Handle possible timestamp discontinuity or overlap issues. 8. Error recovery mechanism: enhance error handling capabilities to address issues caused by non-standard segments: implement intelligent retry logic to address specific types of segment errors with corresponding recovery strategies. When segment download fails, try alternative segment acquisition methods such as range requests. 9. Dynamic switching capability: implement the ability to dynamically switch between different segment strategies: detect changes in segment strategies during playback, such as switching from live to on-demand. Seamlessly switch to new segment processing logic to ensure playback continuity. 10. Performance optimization: optimize performance for special segmentation methods: implement parallel download and processing mechanisms to improve the efficiency of non-standard segment processing. Use prediction algorithms to prepare special format segments in advance. 11. Compatibility layer: develop a compatibility layer to convert between special segment formats and standard DRM solutions: convert non-standard segments into formats that can be processed by DRM solutions before decryption.If necessary, implement a custom decryption process to handle special segment formats.12. Segment analysis tool: Develop a specialized analysis tool for studying and adapting to new non-standard segment formats: automate the analysis of segment characteristics of new platforms. Generate adaptation strategy recommendations to facilitate the rapid development of new platform support.
[0149] Through these methods, the system can effectively overcome the segment difference problems caused by special implementations of MPEG-DASH protocol. This comprehensive and flexible method not only solves the existing compatibility problems, but also provides the ability to cope with new non-standard implementations that may appear in the future. This greatly enhances the adaptability and scalability of the system, ensuring stable operation and high-quality user experience in various complex scenarios.
[0150] In various embodiments of the present application, a multi-level optimization strategy is used to meet real-time playback requirements in high-concurrency scenarios, including:
[0151] Multiple decryption threads are processed in parallel through a thread pool, and a work-stealing algorithm is used to balance the load of each decryption thread;
[0152] According to user playback behavior prediction, predict and download and decrypt subsequent audio segments in advance and store them in a preset buffer, and adjust the pre-reading amount according to network conditions through an adaptive pre-reading strategy to optimize the loading of audio segments; it can be understood that the present embodiment performs parallel processing and performance optimization, which specifically includes the following steps: multi-thread decryption: implement a thread pool to manage multiple decryption threads, and use a work-stealing algorithm to balance thread load. Pre-reading and pre-decryption: based on user playback behavior prediction, download and decrypt subsequent segments in advance, implement an adaptive pre-reading strategy, and adjust the pre-reading amount according to network conditions. Memory management optimization: implement a memory pool to reduce frequent memory allocation and release, use memory alignment technology to improve data access efficiency. Among them, the work-stealing algorithm includes: 1. Each thread maintains its own task queue. 2. When a thread completes its own task, randomly select another thread's queue. 3. Steal tasks from the tail of the selected queue. Assuming there are three threads A, B, and C, the initial task allocation is as follows: A: [1, 2, 3, 4], B: [5, 6], C: [7, 8, 9]; After thread B completes the task, it steals tasks from C: A: [1, 2, 3, 4], B: [9], C: [7, 8].
[0153] In one embodiment, based on a preset error handling strategy, handle abnormal situations that occur during the decryption process, and the handling operation includes:
[0154] When the network is abnormal, retry based on exponential backoff algorithm; wherein, the exponential backoff algorithm adopted by the embodiment specifically includes: 1. Initial waiting time: t=t_initial; 2. Each time retry, waiting time: t=min(t*2,t_max); 3. Add random jitter: t=t+random(-t*0.1,t*0.1).
[0155] When the network anomaly lasts more than the failure threshold, a degradation strategy is adopted, and when the network fails continuously, an elegant degradation strategy is implemented.
[0156] A retry mechanism is separately implemented for the decrypted audio segment, and a partial decryption strategy is implemented to allow continuous playback in the case of partial content decryption failure.
[0157] Based on the checkpoint mechanism, the current decryption state is saved periodically as a checkpoint, and when a system crash is detected, automatic recovery is performed from the nearest checkpoint.
[0158] In implementation, assuming that the initial waiting time is 1 second and the maximum waiting time is 60 seconds: the first retry: wait 1 second; the second retry: wait 2 seconds; the third retry: wait 4 seconds; the fourth retry: wait 8 seconds... the sixth retry: wait 60 seconds to reach the maximum.
[0159] In an embodiment, a multi-level security strategy is used to prevent illegal access, which includes:
[0160] Code obfuscation tools are used to perform obfuscation operations on the current code to increase the difficulty of reverse engineering and virtualize protection of key algorithms, use code obfuscation tools to increase the difficulty of decompilation, and realize virtualization protection of key algorithms.
[0161] An integrity checking mechanism is started during decryption runtime, which includes periodically calculating the hash value of the key code module, and comparing the current calculated hash value with the expected hash value to ensure code integrity and prevent code tampering, using white box cryptography technology to hide key cryptographic operations.
[0162] Based on device features and runtime environment, an encryption key is dynamically generated through a key derivation function, and key dispersion technology is used to avoid saving the complete key in memory.
[0163] In an embodiment, the encryption key generated by the key derivation function based on device features and runtime environment includes:
[0164] Device features are collected, including CPU ID, device ID, hardware serial number, installed software version, and unique identifier related to the device.
[0165] A strong hash function is used to hash the device features to obtain a fixed-length hash value, and the calculation formula is represented as: H = SHA256(F);
[0166] The key derivation function based on HMAC derives the encryption key K from the target parameter, represented as K = HKDF(H, salt, info);
[0167] Where F represents the device feature list, and the target parameter includes the device feature hash value H, the random salt value salt, and the application-specific information info.
[0168] In implementation, assuming that the device feature hash H is: 5B4DA95F5FA08280FC9879DF44F418C8F9F12BA424B7757DE02BBDFBAE0D4C4F;
[0169] A 256-bit key is derived using HKDF: salt = 0123456789ABCDEF info = "AUDIO_STREAM_DRM_KEY" K = HKDF-SHA256(H, salt, info).
[0170] In an embodiment, the related improvement direction of adaptability and compatibility, testing and verification, and deployment and maintenance can also be optimized, and the optimization operation includes:
[0171] Adding new audio codec implementations through plug-in architecture to adapt to multiple audio encoding formats, supporting multiple audio codecs such as AAC, Opus, MP3, etc., developing plug-in architecture to facilitate the addition of new codec support;
[0172] Configuring a general DRM interface to integrate different DRM schemes to realize the DRM scheme automatic identification and switching mechanism, designing a general DRM interface to facilitate future integration with other DRM schemes; Platform feature adaptation can also be performed: optimizing the underlying implementation for different operating systems (iOS, Android, Windows, etc.), and utilizing platform-specific hardware acceleration capabilities such as hardware decoders.
[0173] This example uses dynamic loading of codecs, defines a unified codec interface, and uses the reflection mechanism to dynamically load codecs. The details are as follows: 1. Codec interface definition: The `interface Codec` defines a general codec interface. This interface contains three methods: - `init`: used to initialize the codec, which can pass in parameters such as sampling rate, channel number, etc. - `decode`: decode the input encoded data into original audio data. - `encode`: encode the original audio data into a specific format. The design of this interface allows the system to handle different types of codecs in a unified way. 2. Dynamic loading mechanism: The `loadCodec` method uses Java's reflection mechanism to dynamically load the codec class. - `Class.forName(codecName)` loads the corresponding class according to the provided class name. - `cls.newInstance()` creates a new instance of the class. - The returned object is cast to the `Codec` interface type. This method allows the system to load different codecs as needed at runtime, without deciding which specific codec to use at compile time.
[0174] When implemented, this example shows how to load and use the AAC decoder using the above mechanism.
[0175] - `loadCodec("com.example.AACCodec")` dynamically loads the class named "com.example.AACCodec".
[0176] - `aacCodec.init(...)` initializes the decoder, setting the sampling rate to 44100Hz and 2 audio channels.
[0177] - `aacCodec.decode(encryptedData)` decodes the encrypted AAC data and returns the original audio data in PCM format.
[0178] The advantages of the above method are as follows: 1. Flexibility: the system can load different codecs as needed, easy to extend and maintain. 2. Decoupling: the specific implementation of the codec is separated from the code that uses them, improving the modular degree of the system. 3. Runtime adaptation: you can choose the most suitable codec at runtime according to different audio formats or device capabilities. 4. Resource optimization: only when needed will the corresponding codec be loaded, saving system resources. This dynamic loading mechanism is a key part of implementing a flexible and extensible audio processing system, especially suitable for application scenarios that need to support multiple audio formats.
[0179] In one embodiment, the optimization is performed for the improvement direction related to adaptability and compatibility, testing and verification, and deployment and maintenance, and the optimization operation further includes:
[0180] The preset variant test case is generated based on the fuzzing generator, the URL parsing and audio segmentation processing logic are comprehensively tested, and abnormal problems are found in time; it can be understood that the testing and verification are described as follows: unit testing: write unit tests for each core component, such as DASH parsing, decryption algorithm, etc.; test external dependencies using mock objects, such as network requests. Integration testing: develop end-to-end test cases to verify the entire decryption and playback process, and test using different network conditions and device configurations. Performance testing: implement load testing to evaluate the system's performance under high concurrency, analyze memory leaks and CPU usage, and optimize resource usage. Security testing: perform penetration testing to attempt to break DRM protection. Use fuzzing to detect potential security vulnerabilities. The adopted fuzzing generator is described as follows:
[0181] 1. Define input template: template = "segment-$RepresentationID$-$Number$.m4s"
[0182] 2. Define mutation rules:
[0183] - Replace: randomly replace characters
[0184] - Insert: insert random characters
[0185] - Delete: delete random characters
[0186] - Repeat: repeat a certain part
[0187] 3. Generate test cases:
[0188] for i = 1 to N: / / This is a loop that will generate N test cases;
[0189] case = mutate(template, random_rule()) / / The mutate function applies a randomly selected mutation rule to the original template, and the random_rule() function randomly selects a mutation rule such as replace, insert, delete, or repeat.
[0190] test(case) / / The function executes the test using the generated test case.
[0191] When implemented:
[0192] Original template: segment-$RepresentationID$-$Number$.m4s
[0193] Variant 1 (substitution): segment-$RepresentationID$-$Number$.m4s
[0194] Variant 2 (insertion): segment-$RepresentationID$-$Number$.m4s
[0195] Variant 3 (deletion): segment-$RepresentationID$-$Number$.m4s
[0196] Variant 4 (repetition): segment-$RepresentationID$-$Number$-$Number$.m4s
[0197] The purpose of the above fuzz testing method is: 1. Generate various abnormal or edge case inputs. 2. Test the system's ability to handle non-standard or incorrect inputs. 3. Find potential security vulnerabilities or stability issues. By systematically generating these variant test cases, the robustness of the URL parsing and segmentation processing logic can be comprehensively tested, ensuring that the system can handle various unexpected situations gracefully.
[0198] In this embodiment, the improvement direction related to adaptability and compatibility, testing and verification, and deployment and maintenance is optimized, and the optimization operation further includes: based on the preset automatic problem classification algorithm, the abnormal problems occurring in the decryption and playing process are collected to realize automatic problem classification and priority sorting. It can be understood that the deployment and maintenance optimization specifically includes the following steps: version control: realize semantic version control, manage API changes clearly, maintain detailed update logs, and record changes of each version. Hot update mechanism: design a modular update system to support dynamic updating of partial components; implement rollback mechanism to quickly recover to the previous stable version in case of update failure. Monitoring and logging: implement a distributed log collection system to centrally manage logs from different devices; develop a real-time monitoring panel to track key indicators such as decryption success rate, performance data, etc. User feedback processing: design a user feedback channel to collect problems in the decryption and playing process; implement an automatic problem classification and priority sorting system.
[0199] The preset automatic problem classification algorithm is described in detail as follows: 1. Extracting keywords: using the TF-IDF algorithm to extract keywords in user feedback. 2. Building a feature vector: converting keywords into numerical features. 3. Using a machine learning model (such as Naive Bayes or SVM) for classification. When implemented, assume that user feedback is received: "audio playback suddenly stops, error code E0023"
[0200] 1. Extracting keywords: ["play stop", "error code", "E0023"]; 2. Converting to feature vector: [1, 1, 1, 0, 0,...] / / assuming there is a predefined feature dictionary; 3. Using a trained model for classification, such as classifying into the "decryption failure" category.
[0201] Through the above detailed technical solutions, the embodiment of the application realizes a computer implementation method for adaptive decryption of audio streams. This scheme not only solves the challenges brought about by specific platforms, but also optimizes performance, security, and scalability in a comprehensive manner. By innovatively combining the general functions of standard DRM interfaces with the needs of specific platforms, this scheme provides a powerful and flexible solution for audio streaming services.
[0202] The core advantages of this scheme include: 1. Adaptive decryption strategy, capable of accurately identifying and processing special audio segments on different platforms. 2. Efficient parallel processing and intelligent caching mechanism, significantly improving decryption efficiency. 3. Strong security measures, including dynamic key management and code protection. 4. Excellent error handling and recovery mechanism, ensuring service stability. 5. Good scalability and compatibility, supporting multiple audio formats and DRM schemes.
[0203] In addition, the modular design and comprehensive test verification process of this scheme lay a solid foundation for future maintenance and upgrades. Through continuous monitoring and user feedback processing, the system can be continuously optimized and improved to adapt to changing market demands and technical environments.
[0204] Overall, this computer implementation method for adaptive decryption of audio streams represents an important advancement in audio streaming DRM technology, opening up new possibilities for providing high-quality, secure, and flexible audio streaming services.
[0205] The embodiment also provides a computer device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the computer program is executed by the processor to implement the steps of the computer implementation method for adaptive decryption of audio streams described in any of the above embodiments.
[0206] The method further includes:
[0207] obtaining an MPD file from a server through an HTTP request, the MPD file including at least a Period element, an AdaptationSet element and a SegmentTemplate element;
[0208] verifying whether a MIME type of the MPD file matches a preset MIME type;
[0209] After the verification, traversing the Period element, the AdaptationSet element and the SegmentTemplate element in the MPD file and performing parsing to obtain audio segment information, the audio segment information including a duration, a start time, an initialization audio segment and a URL template of a media segment of each preset period.
[0210] The initialization of the standard DRM interface and the combination of the standard DRM interface and the target audio stream platform include:
[0211] The standard DRM interface module is loaded in a dynamic linking manner;
[0212] A context environment of the standard DRM interface is initialized and parameter configuration is performed;
[0213] A decryption callback function is defined to process an encryption mode of the target audio stream platform, and the callback function is registered to the standard DRM interface;
[0214] A key obtaining mechanism is configured, and the configuration content includes a trigger condition of key request and update, i.e., a validity period of the key, a content access times or a user authorization state.
[0215] The configuration of the key obtaining mechanism further includes:
[0216] A key request is constructed: R=E(Kpub, [KID||Nonce]);
[0217] The request is sent to a key server;
[0218] A response is received and decrypted: K=D(Kpriv, Response);
[0219] wherein R is an encrypted key request, K is a decryption key, E is a public key encryption function, D is a private key decryption function, Kpub is a server public key, Kpriv is a client private key, KID is a key ID, and Nonce is a random number.
[0220] The feature extraction of the audio segment information in the identified audio segment mode, and the dynamic adjustment of segment request and processing logic according to the extracted features for adaptive segment downloading and preprocessing include:
[0221] The preset segment rule of the audio segment is extracted by analyzing the MPD file, a non-standard timestamp format or a special segment number system is identified, flexible regular expression matching is implemented, and various non-standard URL modes are adapted;
[0222] A segment URL suitable for a target audio stream platform is dynamically constructed based on the preset segment rule, and a custom URL template parser is implemented;
[0223] According to the preset rule of the target audio stream platform, the variables in the URL are dynamically replaced to ensure that the generated URL meets the requirements of the target audio stream platform, so that the audio segment is successfully downloaded;
[0224] The downloaded audio segment is analyzed to identify natural segment points to adjust the boundaries of the audio segment, ensuring the continuity and integrity of the audio stream, the natural segment points including silence periods or audio feature changes.
[0225] The encryption information corresponding to the current audio segment is obtained, and the encryption parameters are extracted to identify the encryption mark of the target audio stream platform, and the current audio segment is decrypted according to the encryption mark by selecting the corresponding decryption algorithm, comprising:
[0226] The sinfbox information box of the protection scheme of the MP4 file is obtained, and the encryption parameters are extracted, the encryption parameters including a key, an initialization vector IV, and an encryption mark or extension of the target audio stream platform;
[0227] Based on the key storage mechanism, the trusted execution environment is used to protect the key from unauthorized access, and the decryption key is updated regularly according to the key rotation strategy;
[0228] The decryption function of the standard DRM interface is called, and the key and encrypted data are input for decryption processing.
[0229] The current audio segment is decrypted according to the encryption mark by selecting the corresponding decryption algorithm, further comprising:
[0230] When the selected decryption algorithm is the AES-CTR decryption algorithm, the initial value of the counter is initialized;
[0231] The AES algorithm and the key are used to encrypt the counter value to generate a key stream, the counter value being a combination of the initialization vector IV and the current counter;
[0232] Each key stream block is XORed with the corresponding encrypted data block to obtain the decrypted data block;
[0233] The above steps are repeated until all encrypted data blocks are decrypted, and the decryption formula is represented as follows: Decrypted = Encrypted XOR AES-CTR(Key, IV||Counter);
[0234] wherein Decrypted represents the result of the decryption operation, Encrypted is the encrypted data, Key is the decryption key, IV is the initialization vector, and Counter is the incremental counter value.
[0235] The updated audio stream is cached to a preset buffer area based on the adaptive buffering strategy, and the final audio stream is outputted, including:
[0236] A fixed-size memory is allocated as a first buffer area;
[0237] A write pointer for writing of new data and a read pointer for playing of data are configured;
[0238] When the corresponding pointer reaches the end of the first buffer area, the pointer is reset to the starting position to form a loop to realize the ring buffer adaptation processing of continuous audio streams; and / or,
[0239] A second buffer area and a third buffer area of the same size are created, the second buffer area is used for playing of the current audio stream, and the third buffer area is used for decryption of the next batch of audio streams;
[0240] When the second buffer area is played, the third buffer area that has been decrypted is switched to for playing immediately, and the decryption of the second buffer area that has just been played is started to use two buffer areas for alternately performing the decryption and playing operations, so that parallel processing is realized;
[0241] Wherein, a mutex is used to protect the read and write operations of the corresponding buffer area, and a condition variable is used to notify the related threads when the state of the corresponding buffer area changes to ensure correct synchronization of the decryption and playing; the first buffer area, the second buffer area and the third buffer area are dynamically adjusted in the number of segments pre-buffered according to the adaptive buffering strategy, so that the corresponding buffer area of variable size is realized to adapt to the segmentation characteristics of different platforms.
[0242] Further comprising:
[0243] A multi-level optimization strategy is used to meet the real-time playing requirements in a high-concurrency scenario, and the multi-level optimization strategy includes:
[0244] A thread pool is used to perform parallel processing of the decryption operations of multiple audio segments under multiple decryption threads, and a work-stealing algorithm is used to balance the load of each decryption thread;
[0245] According to the user's playback behavior prediction, the subsequent audio segments are predicted to be downloaded and decrypted in advance and stored in a preset buffer, and the adaptive pre-reading strategy is used to adjust the pre-reading amount according to the network condition to optimize the loading of the audio segments; and / or,
[0246] Based on the preset error handling strategy, the abnormal situation occurring in the decryption process is handled, and the handling operation includes:
[0247] When the network is abnormal, retry based on the exponential backoff algorithm;
[0248] When the network anomaly lasts more than the fault threshold, a degradation strategy is adopted;
[0249] The retry mechanism is separately performed on the decrypted audio segment, and the partial decryption strategy is implemented, allowing the playback to continue in the case of partial content decryption failure;
[0250] Based on the checkpoint mechanism, the current decryption state is saved periodically as a checkpoint, and when a system crash is detected, the system is automatically recovered from the nearest checkpoint.
[0251] Also includes:
[0252] Based on a multi-level security strategy to prevent illegal access, the multi-level security strategy includes:
[0253] A code obfuscation tool is used to perform obfuscation on the current code to increase the difficulty of reverse engineering and virtualize the protection of the key algorithm;
[0254] An integrity checking mechanism is started during decryption runtime, which includes periodically calculating the hash value of the key code module, and comparing the current calculated hash value with the expected hash value to ensure code integrity and prevent code tampering;
[0255] Based on the device features and runtime environment, the encryption key is dynamically generated by the key derivation function.
[0256] The encryption key is dynamically generated by the key derivation function based on the device features and runtime environment, which includes:
[0257] Collecting device features, including CPU ID, device ID, hardware serial number, installed software version, and unique identifier related to the device;
[0258] A strong hash function is used to calculate the hash value of the device features, and a fixed length hash value is obtained, and the calculation formula is represented as: H=SHA256(F);
[0259] The key derivation function based on HMAC derives the encryption key K from the target parameter, represented as K=HKDF(H,salt,info);
[0260] wherein F represents a device feature list, and the target parameter comprises a device feature hash value H, a random salt value salt and application specific information info.
[0261] Further comprising:
[0262] Optimizing the related improvement directions of adaptability and compatibility, testing and verification, and deployment and maintenance, the optimization operation comprising:
[0263] Adding new audio codec implementations through the plug-in architecture to adapt to multiple audio encoding formats;
[0264] Configuring a general DRM interface to integrate different DRM schemes to realize DRM scheme automatic identification and switching mechanism; and / or,
[0265] Generating preset mutation test cases based on the fuzz test generator, comprehensively testing the URL parsing and audio segmentation processing logic, and discovering abnormal problems in time; and / or,
[0266] Based on the preset automatic problem classification algorithm, collecting abnormal problems occurring in the decryption and playing process to realize automatic problem classification and priority sorting.
[0267] The computer implementation method for audio stream adaptive decryption, the electronic device and the computer program product of the storage medium provided in the embodiment, including a computer readable storage medium storing program codes, the instructions included in the program codes can be used to execute the method in the foregoing method embodiments, and the specific implementation can be referred to the method embodiments, which will not be described here.
[0268] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the foregoing method embodiments, which will not be described here.
[0269] In addition, in the description of the embodiment, unless otherwise explicitly specified and limited, the terms "mounting", "connecting", "connecting" should be understood in a broad sense, for example, it can be fixedly connected, or it can be detachably connected, or integrally connected; it can be mechanically connected, or it can be electrically connected; it can be directly connected, or it can be indirectly connected through an intermediate medium; it can be the communication inside two elements. For those skilled in the art, the specific meaning of the above terms in the present disclosure can be understood according to the specific circumstances.
[0270] If the functions are implemented in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present disclosure can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods of various embodiments of the present disclosure. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0271] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer" and the like indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the purpose of facilitating the description of the present disclosure and simplifying the description, and do not indicate or imply that the device or element referred to must have a particular orientation, be constructed and operated in a particular orientation, and therefore cannot be understood as a limitation on the present disclosure. In addition, the terms "first", "second", "third" are only for the purpose of description, and cannot be understood as indicating or implying relative importance.
[0272] The above-described and above-mentioned embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for some technical features; and these modifications or replacements do not cause the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present application.< / mpd>
Claims
1. A computer-implemented method of adaptive decryption of an audio stream, wherein, The method comprises the following steps: acquiring and parsing an MPEG-DASH manifest file to identify audio segment information from adaptive segment identification standards and non-standard audio segment modes; initializing a standard DRM interface, combining the standard DRM interface with a target audio streaming platform, and adapting the audio streaming based on the MPEG-DASH protocol to the audio segment mode of the target audio streaming platform; extracting features from the audio segment information in the identified audio segment mode, dynamically adjusting the segment request and processing logic based on the extracted features for adaptive segment downloading and preprocessing; acquiring encryption information corresponding to the current audio segment, extracting encryption parameters, identifying the encryption mark of the target audio streaming platform, selecting a corresponding decryption algorithm based on the encryption mark, and decrypting the current audio segment; reconstructing the decrypted data into an updated audio stream to ensure compatibility with the original unencrypted audio stream, and based on an adaptive buffering strategy, caching the updated audio stream to a preset cache area, and outputting the final audio stream to ensure the continuity of the final audio stream while achieving efficient parallel processing of decryption and playback.
2. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, The method comprises the following steps: acquiring an MPD file from a server through an HTTP request, wherein the MPD file comprises at least a Period element, an AdaptationSet element, and a SegmentTemplate element; verifying whether the MIME type of the MPD file matches a preset MIME type; after verification, traversing the Period element, the AdaptationSet element, and the SegmentTemplate element in the MPD file and performing parsing to obtain audio segment information, wherein the audio segment information comprises the duration, the start time, the URL template of the initialization audio segment, and the URL template of the media segment of each preset period.
3. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, The method comprises the following steps: loading a standard DRM interface module in a dynamic linking manner; initializing the context environment of the standard DRM interface and performing parameter configuration; processing the encryption method of the target audio streaming platform through a custom decryption callback function, and registering the callback function to the standard DRM interface; configuring a key acquisition mechanism, and the configuration content comprises the trigger conditions of key request and update, i.e., the validity period of the key, the number of content accesses, or the user authorization state.
4. The computer-implemented method of audio stream adaptive decryption of claim 3, wherein, The method further comprises the following steps: constructing a key request: R=E(Kpub,[KID||Nonce]); sending a request to a key server; receiving and decrypting a response: K=D(Kpriv,Response); wherein R is the encrypted key request, K is the decryption key, E is a public key encryption function, D is a private key decryption function, Kpub is a server public key, Kpriv is a client private key, KID is a key ID, and Nonce is a random number.
5. The computer-implemented method of audio stream adaptive decryption of claim 2, wherein, The feature extraction of the recognized audio segment information in the audio segment mode, the dynamic adjustment of the segment request and processing logic according to the extracted features for adaptive segment download and preprocessing comprises: By analyzing the MPD file to extract the preset segment rule of the audio segment, identifying the non-standard timestamp format or special segment number system, realizing flexible regular expression matching to adapt to various non-standard URL modes; Based on the preset segment rule, dynamically constructing a segment URL suitable for the target audio stream platform to realize a custom URL template parser; According to the preset rule of the target audio stream platform, dynamically replacing the variables in the URL to ensure that the generated URL meets the needs of the target audio stream platform, thereby successfully downloading the audio segment; Analyzing the downloaded audio segment, identifying the natural segment point to adjust the boundary of the audio segment, and ensuring the continuity and integrity of the audio stream, the natural segment point includes a silent period or an audio feature change.
6. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, The encryption information corresponding to the current audio segment is obtained, and the encryption parameter is extracted to identify the encryption mark of the target audio stream platform, and the current audio segment is decrypted according to the encryption mark to select the corresponding decryption algorithm, comprising: Obtaining the protection scheme sinfbox information box of the MP4 file, and extracting the encryption parameter, the encryption parameter including the key, the initialization vector IV, and the encryption mark or extension of the target audio stream platform; Based on the key storage mechanism, the trusted execution environment is used to protect the key from unauthorized access, and the decryption key is updated regularly according to the key rotation strategy; Call the decryption function of the standard DRM interface, input the key and the encrypted data for decryption processing.
7. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, The current audio segment is decrypted according to the encryption mark to select the corresponding decryption algorithm, which further comprises: When the selected decryption algorithm is the AES-CTR decryption algorithm, the initial value of the counter is initialized; The AES algorithm and the key are used to encrypt the counter value to generate a key stream, and the counter value is the combination value of the initialization vector IV and the current counter; Each key stream block is XORed with the corresponding encrypted data block to obtain the decrypted data block; Repeat the above steps until all encrypted data blocks are decrypted, and the decryption formula is as follows: Decrypted=Encrypted XORAES-CTR(Key,IV||Counter); Wherein, Decrypted represents the result of the decryption operation, Encrypted is the encrypted data, Key is the decryption key, IV is the initialization vector, and Counter is the incremental counter value.
8. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, The updated audio stream is cached to the preset cache area based on the adaptive buffering strategy, and the final audio stream is output, comprising: Allocate a fixed size of memory as a first buffer; Configure a write pointer for writing new data and a read pointer for playing data; When the corresponding pointer reaches the end of the first buffer, reset to the starting position to form a loop to realize the ring buffer adaptation processing of the continuous audio stream; and / or, A second buffer and a third buffer of the same size are created, the second buffer is used for playing the current audio stream, and the third buffer is used for decrypting the next batch of audio streams; When the second buffer is played out, switch to the decrypted third buffer for playing immediately, and start decrypting the second buffer just played out with new audio stream at the same time to use two buffers to alternate decryption and playing operations, realizing parallel processing; Wherein, the read and write operations of the corresponding buffer are protected by mutex during parallel processing, and the condition variable is used to notify the related threads when the state of the corresponding buffer changes to ensure the correct synchronization of decryption and playing; the first buffer, the second buffer and the third buffer are dynamically adjusted in size according to the adaptive buffer strategy to realize variable size of the corresponding buffer, and adapt to the segmentation characteristics of different platforms.
9. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, Further comprising: Based on the multi-level optimization strategy to meet the real-time playing demand in high concurrency scene, the multi-level optimization strategy includes: Through thread pool, the decryption operations of multiple audio segments under multiple decryption threads are processed in parallel, and the work-stealing algorithm is used to balance the load of each decryption thread; According to the user's playing behavior prediction, predict the subsequent audio segments to be downloaded and decrypted in advance and stored in the preset buffer, and adjust the pre-reading amount according to the network condition through the adaptive pre-reading strategy to optimize the loading of audio segments; and / or, Based on the preset error handling strategy, the abnormal situation in the decryption process is handled, and the handling operation includes: When the network is abnormal, retry based on the exponential backoff algorithm; When the network anomaly lasts more than the fault threshold, use the degradation strategy; For the audio segments that fail to decrypt, a separate retry mechanism is performed, and a partial decryption strategy is implemented to allow playing to continue in the case of partial content decryption failure; Based on the checkpoint mechanism, the current decryption state is saved periodically as a checkpoint, and when a system crash is detected, the system is automatically recovered from the nearest checkpoint.
10. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, Further comprising: Based on the multi-level security strategy to prevent illegal access, the multi-level security strategy includes: Using code obfuscation tools to perform obfuscation operations on the current code to increase the difficulty of reverse engineering and virtualize the protection of key algorithms; Starting an integrity checking mechanism during decryption runtime, the integrity checking mechanism includes periodically calculating the hash value of the key code module, and comparing the hash value calculated at present with the expected hash value to ensure code integrity and prevent code tampering; Based on device features and runtime environment, the encryption key is dynamically generated by the key derivation function.
11. The computer-implemented method of audio stream adaptive decryption of claim 10, wherein, The encryption key generated by the key derivation function based on the device features and the runtime environment includes: Collecting device features, including CPU ID, device ID, hardware serial number, installed software version and unique identifier related to the device; Using a strong hash function to calculate the hash value of the device features to get a fixed length hash value, the calculation formula is represented as: H = SHA256(F); The key derivation function based on HMAC derives the encryption key K from the target parameter, represented as K = HKDF(H, salt, info); Wherein, F represents a device feature list, the target parameter includes a device feature hash value H, a random salt value salt and application specific information info.
12. The computer-implemented method of audio stream adaptive decryption of claim 1, wherein, Also includes: Optimize the related improvement direction of adaptability and compatibility, testing and verification, and deployment and maintenance, the optimization operation includes: Add new audio codec implementation to adapt to multiple audio encoding formats through plug-in architecture; Configure a general DRM interface to integrate different DRM schemes to realize DRM scheme automatic identification and switching mechanism; and / or, Generate a preset variation test case based on the fuzz test generator to comprehensively test the URL parsing and audio segmentation processing logic and timely discover abnormal problems; and / or, Based on the preset automatic problem classification algorithm, collect abnormal problems occurring in the decryption and playback process to realize automatic problem classification and priority sorting.
13. A computer device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, The computer program is executed by the processor to implement the following computer-implemented steps of audio stream adaptive decryption: Obtain and parse the MPEG-DASH manifest file, and parse the audio segment information to adaptively identify standard and non-standard audio segment modes; Initialize the standard DRM interface, combine the standard DRM interface with the target audio stream platform, and make the MPEG-DASH protocol-based audio stream adapt to the audio segment mode of the target audio stream platform; Extract features from the audio segment information in the identified audio segment mode, dynamically adjust the segment request and processing logic based on the extracted features for adaptive segment download and preprocessing; Obtain the encryption information corresponding to the current audio segment and extract the encryption parameter to identify the encryption mark of the target audio stream platform, and select the corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment; Reconstruct the audio frame from the decrypted data to form an updated audio stream to ensure compatibility with the original unencrypted audio stream, and cache the updated audio stream to a preset cache area based on an adaptive buffering strategy, output the final audio stream to ensure the continuity of the final audio stream, and realize efficient parallel processing of decryption and playback.
14. The computer device of claim 13, wherein, The obtaining and parsing of the MPEG-DASH manifest file includes: Obtain the MPD file from the server through HTTP request, the MPD file at least includes Period element, AdaptationSet element and SegmentTemplate element; Verify whether the MIME type of the MPD file matches the preset MIME type; After matching, traverse the Period element, AdaptationSet element and SegmentTemplate element in the MPD file and parse to obtain audio segment information, the audio segment information includes the duration, start time, initialization audio segment and media segment URL template of each preset period.
15. The computer device of claim 13, wherein, The initialization of the standard DRM interface includes: Load the standard DRM interface module in a dynamic link mode; Initialize the context environment of the standard DRM interface and configure parameters; The encryption mode of the target audio stream platform is processed by a self-defined decryption callback function, and the callback function is registered to a standard DRM interface; The key acquisition mechanism is configured, and the configuration content includes the trigger condition of key request and update, that is, the validity period of the key, the content access times or the user authorization state.
16. The computer device of claim 13, wherein, The encryption information corresponding to the current audio segment is obtained, and the encryption parameter is extracted to identify the encryption mark of the target audio stream platform, and the current audio segment is decrypted according to the encryption mark to select the corresponding decryption algorithm, including: Obtain the protection scheme sinfbox information box of the MP4 file, and extract the encryption parameter, the encryption parameter including the key, the initialization vector IV and the encryption mark or extension of the target audio stream platform; Based on the key storage mechanism, the trusted execution environment is used to protect the key from unauthorized access, and the decryption key is updated regularly according to the key rotation strategy; The decryption function of the standard DRM interface is called, and the key and encrypted data are input for decryption processing.
17. The computer device of claim 13, wherein, The updated audio stream is cached to the preset buffer area based on the adaptive buffering strategy, and the final audio stream is output, including: Allocate a fixed size of memory as a first buffer; Configure a write pointer for writing new data and a read pointer for playing data; When the corresponding pointer reaches the end of the first buffer, reset to the starting position to form a loop to realize the circular buffer adaptation processing of continuous audio stream; and / or, Create a second buffer and a third buffer with the same size, the second buffer is used for playing the current audio stream, and the third buffer is used for decrypting the next batch of audio stream; When the second buffer is played, switch to the decrypted third buffer for playing immediately, while starting the decryption of the just played second buffer with new audio stream to use two buffers to alternate decryption and playing operation, realizing parallel processing; Wherein, the read and write operations of the corresponding buffer are protected by mutex, and the condition variable is used to notify the related threads when the state of the corresponding buffer changes to ensure the correct synchronization of decryption and playing; the first buffer, the second buffer and the third buffer are dynamically adjusted according to the adaptive buffering strategy The number of pre-buffer segments realizes the corresponding buffer with variable size, which adapts to the segmentation characteristics of different platforms.
18. The computer device of claim 13, wherein, Further comprising: Based on the multi-level optimization strategy, the real-time playing demand in high concurrency scene is met, and the multi-level optimization strategy includes: A plurality of audio segments in a plurality of decryption threads are processed in parallel by a thread pool, and the work-stealing algorithm is used to balance the load of each decryption thread; According to the user's playing behavior prediction, predict to download and decrypt the subsequent audio segment in advance and store it in the preset buffer area, and adjust the pre-reading amount according to the network condition by the adaptive pre-reading strategy to optimize the loading of the audio segment; and / or, Based on the preset error handling strategy, the abnormal situation in the decryption process is handled, and the handling operation includes: When the network is abnormal, retry based on the exponential backoff algorithm; When the network exception lasts more than the fault threshold, a degradation strategy is adopted. A retry mechanism is separately performed for the audio segment that fails to be decrypted, and a partial decryption strategy is implemented to allow the playback to continue in the case of partial content decryption failure; A checkpoint mechanism is used to periodically save the current decryption state as a checkpoint, and when a system crash is detected, the system is automatically recovered from the most recent checkpoint.
19. The computer device of claim 13, wherein, Further comprising: Prevent illegal access based on a multi-level security policy, which includes: A code obfuscation tool is used to perform obfuscation operations on the current code to increase the difficulty of reverse engineering and virtualize the protection of the key algorithm; An integrity checking mechanism is started at runtime, which includes periodically calculating the hash value of the key code module and comparing the current calculated hash value with the expected hash value to ensure code integrity and prevent code tampering; Based on the device features and runtime environment, the encryption key is dynamically generated by the key derivation function.
20. A computer readable storage medium having stored thereon a computer program, wherein, The computer program, when executed by a processor, implements the following computer-implemented steps for adaptive decryption of an audio stream: Obtain and parse the MPEG-DASH manifest file to parse the audio segment information, identify the adaptive segment identification standard and non-standard audio segment mode; Initialize the standard DRM interface, combine the standard DRM interface with the target audio stream platform, and make the MPEG-DASH protocol-based audio stream compatible with the audio segment mode of the target audio stream platform; Extract features from the audio segment information in the identified audio segment mode, dynamically adjust the segment request and processing logic based on the extracted features for adaptive segment download and preprocessing; Obtain the encryption information corresponding to the current audio segment and extract the encryption parameters to identify the encryption marker of the target audio stream platform, select the corresponding decryption algorithm based on the encryption marker to decrypt the current audio segment; Reconstruct the audio frame from the decrypted data to form an updated audio stream to ensure compatibility with the original unencrypted audio stream, cache the updated audio stream to a preset cache area based on an adaptive buffering strategy, and output the final audio stream to ensure the continuity of the final audio stream while achieving efficient parallel processing of decryption and playback.
Citation Information
Patent Citations
Method for playing encrypted audio and video based on AVPlayer and storage medium
CN110446074A
Video file playing processing method and device, electronic equipment and storage medium
CN113411638A
Self-adaptive segmentation selection method and device
CN117714795A
Audio stream adaptive decryption method, system and device and storage medium
CN119337396A