Audio stream adaptive decryption method, system and device and storage medium

Through adaptive recognition and processing the audio segmentation mode of different platforms, combined with the standard DRM interface and target platform, to achieve efficient parallel treatment and intelligent cache, solve the problem of insufficient audio flow compatibility and decryption performance in existing technologies, provide providing provision Has efficient, safe and flexible audio flow services.

CN119337396APending Publication Date: 2025-01-21LINKPLAY TECHNOLOGY INC NANJING
View PDF 0 Cites 8 Cited by

Patent Information

Application Number
CN202411248417.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-06
Publication Date
2025-01-21

AI Technical Summary

Technical Problem

The prior art has compatibility problems when processing audio streams on specific platforms, making it difficult to apply non-standard audio segmentation methods and encryption methods, and the decryption performance in high concurrency scenarios is insufficient, affecting the user experience.

Method used

By obtaining the MPEG-DASH list file and analysis, adaptive identification audio segmentation mode, combined with standard DRM interface and target audio stream platform to achieve efficient parallel processing and intelligent cache mechanism, dynamic adjustment and decryption strategy to meet the needs of different platforms to meet the needs of different platforms Essence

Benefits of technology

It significantly improves the compatibility and decryption efficiency of the system, can efficiently process audio streams of different platforms, meets the real-time playback requirements in high-concurrency scenarios, and provides high-quality, safe and flexible audio streaming services.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119337396A_ABST
    Figure CN119337396A_ABST
Patent Text Reader

Abstract

The invention discloses an audio stream adaptive decryption method, system and device and a storage medium. The method comprises the following steps: acquiring an MPEG-DASH list file and analyzing the MPEG-DASH list file; the standard DRM interface is initialized; performing feature extraction on the identified audio segmentation information in the audio segmentation mode, and dynamically adjusting a segmentation request and processing logic according to the extracted features to perform adaptive segmentation downloading and preprocessing; extracting the encryption parameter to identify an encryption mark of the target audio stream platform, and selecting a corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment; and performing audio frame reconstruction on the decrypted data to form an updated audio stream, caching the updated audio stream to a preset cache region based on a self-adaptive buffer strategy, and outputting the final audio stream to ensure the continuity of the final audio stream and realize efficient parallel processing of decryption and playing, so that the decryption efficiency is improved, and the user experience is improved. And particularly, in a high-concurrency scene, the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of audio technology, and in particular to an audio stream adaptive decryption method, system, device and storage medium. Background Art

[0002] In the field of digital audio streaming, DRM (digital rights management) technology is the key to protecting content copyright. Existing DRM solutions provide a common protection mechanism for a variety of streaming services. However, when processing audio streams on specific platforms, existing technologies have many shortcomings. First, the special implementation based on the MPEG-DASH protocol causes the audio segmentation method of some platforms to be different from the standard, and existing DRM solutions are difficult to apply directly. Secondly, the encryption method of a specific platform 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. Existing technologies also face security challenges, such as improper key management that may 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 solutions. These problems have seriously restricted the development of audio streaming services and the improvement of user experience, and a more flexible, efficient and secure solution is urgently needed. Summary of the invention

[0003] The present invention provides an audio stream adaptive decryption method, system, device and storage medium, and an adaptive decryption strategy, which can accurately identify and process special audio segments of different platforms, greatly improve the compatibility of the system, and realize efficient parallel processing and intelligent caching mechanism by combining the general functions of the standard DRM interface and the requirements of the specific platform, significantly improve the decryption efficiency, effectively solve the problem that the existing solutions are difficult to quickly adapt to new audio formats or DRM solutions, and provide high-quality, secure and flexible audio streaming services.

[0004] A first aspect of the present invention provides an audio stream adaptive decryption method, comprising:

[0005] Obtain the MPEG-DASH manifest file and parse it to extract audio segment information to adapt to segment identification standards and non-standard audio segment modes;

[0006] Initialize the standard DRM interface and combine the standard DRM interface with the target audio streaming platform so that the audio stream based on the MPEG-DASH protocol is compatible with the audio segmentation mode of the target audio streaming platform;

[0007] Extract features of the audio segment information in the identified audio segment mode, and dynamically adjust the segment request and processing logic according to the extracted features to perform adaptive segment downloading and preprocessing;

[0008] Obtain the encryption information corresponding to the current audio segment and extract the encryption parameter to identify the encryption tag of the target audio stream platform, and select the corresponding decryption algorithm according to the encryption tag to decrypt the current audio segment;

[0009] The audio frames of the decrypted data are reconstructed to form 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. The final audio stream is output to ensure the continuity of the final audio stream while achieving efficient parallel processing of decryption and playback.

[0010] Preferably, obtaining and parsing the MPEG-DASH manifest file includes:

[0011] Obtaining an MPD file from a server through an HTTP request, wherein the MPD file includes at least a Period element, an AdaptationSet element, and a SegmentTemplate element;

[0012] Verify whether the MIME type of the MPD file matches a preset MIME type;

[0013] After verifying the match, the Period element, AdaptationSet element, and SegmentTemplate element in the MPD file are traversed and parsed to obtain audio segmentation information, which includes the duration of each preset period, the start time, the URL template of the initialized audio segment, and the media segment.

[0014] Preferably, the initializing of the standard DRM interface and combining the standard DRM interface with the target audio streaming platform comprises:

[0015] Use dynamic linking to load the standard DRM interface module;

[0016] Initialize the context of the standard DRM interface and configure parameters;

[0017] Process the encryption method of the target audio streaming platform through a custom decryption callback function, and register the callback function to the standard DRM interface;

[0018] The key acquisition mechanism is configured, including the triggering conditions for key request and update, that is, the key validity period, content access times, or user authorization status.

[0019] Preferably, configuring the key acquisition mechanism further includes:

[0020] Construct key request: R = E (Kpub, [KID||Nonce]);

[0021] Send a request to the key server;

[0022] Receive and decrypt the response: K = D (Kpriv, Response);

[0023] Among them, 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 a random number.

[0024] Preferably, the extracting features of the audio segment information in the identified audio segment mode, and dynamically adjusting the segment request and processing logic according to the extracted features to perform adaptive segment downloading and preprocessing includes:

[0025] Extract audio segments by parsing MPD files, recognize non-standard timestamp formats or special segment numbering systems, and implement flexible regular expression matching to accommodate various non-standard URL patterns;

[0026] Dynamically construct segmented URLs suitable for the target audio streaming platform based on preset segmentation rules and implement a custom URL template parser;

[0027] Dynamically replace variables in the URL according to the preset rules of the target audio streaming platform to ensure that the generated URL meets the requirements of the target audio streaming platform, so as to successfully download the audio segments;

[0028] The downloaded audio segments are analyzed to identify natural segmentation points to adjust the boundaries of the audio segments and ensure the continuity and integrity of the audio stream. The natural segmentation points include silent periods or changes in audio features.

[0029] Preferably, the step of obtaining encryption information corresponding to the current audio segment and extracting encryption parameters to identify the encryption mark of the target audio stream platform, and selecting a corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment includes:

[0030] Obtain the protection scheme sinf box information box of the MP4 file and extract encryption parameters, wherein the encryption parameters include a key, an initialization vector IV, and an encryption tag or extension of the target audio streaming platform;

[0031] Based on the key storage mechanism, a 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;

[0032] Call the decryption function of the standard DRM interface, pass in the key and encrypted data for decryption.

[0033] Preferably, the step of selecting a corresponding decryption algorithm according to the encryption tag to decrypt the current audio segment further comprises:

[0034] When the selected decryption algorithm is the AES-CTR decryption algorithm, initialize the starting value of the counter;

[0035] The counter value is encrypted using the AES algorithm and the key to generate a key stream, wherein the counter value is a combination of the initialization vector IV and the current counter;

[0036] Perform an XOR operation on each key stream block and the corresponding encrypted data block to obtain a decrypted data block;

[0037] Repeat the above steps until all encrypted data blocks are decrypted. The decryption formula is as follows:

[0038] Decrypted=Encrypted XOR AES-CTR(Key,IV||Counter);

[0039] Among them, 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 incrementing counter value.

[0040] Preferably, the step of caching the updated audio stream to a preset buffer area based on an adaptive buffering strategy and outputting the final audio stream comprises:

[0041] Allocate a fixed size of memory as the first buffer;

[0042] Configure a write pointer for writing new data and a read pointer for playing data;

[0043] When the corresponding pointer reaches the end of the first buffer, it is reset to the starting position to form a loop to achieve the adaptation of the ring buffer to process the continuous audio stream; and / or,

[0044] Create a second buffer and a third buffer of 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 streams;

[0045] When the second buffer is finished playing, the third buffer that has been decrypted is immediately switched to play, and at the same time, the new audio stream of the second buffer that has just been played is decrypted to use the two buffers to alternately perform decryption and play operations, thereby realizing parallel processing;

[0046] Among them, a mutex lock is used to protect the read and write operations of the corresponding buffer during parallel processing, and a conditional variable is used to notify the relevant threads when the state of the corresponding buffer changes to ensure the correct synchronization of decryption and playback; the first buffer, the second buffer and the third buffer all dynamically adjust the number of pre-buffered segments according to the adaptive buffer strategy to achieve a corresponding buffer of variable size to adapt to the segmentation characteristics of different platforms.

[0047] As a preferred embodiment, it also includes:

[0048] The real-time playback requirements in high-concurrency scenarios are met based on a multi-level optimization strategy, which includes:

[0049] The decryption operations of multiple audio segments under multiple decryption threads are processed in parallel through a thread pool, and the load of each decryption thread is balanced based on a work-stealing algorithm;

[0050] Predicting the user's playback behavior, downloading and decrypting subsequent audio segments in advance and storing them in a preset buffer, and optimizing the loading of audio segments by adjusting the pre-reading amount according to network conditions through an adaptive pre-reading strategy; and / or,

[0051] The abnormal situations that occur during the decryption process are handled based on the preset error handling strategy. The processing operations include:

[0052] When the network is abnormal, retries are performed based on the exponential backoff algorithm;

[0053] When network anomalies continue to exceed the fault threshold, a degradation strategy is adopted;

[0054] Implement a retry mechanism for audio segments that fail to be decrypted separately, and implement a partial decryption strategy to allow continued playback even if some content fails to be decrypted;

[0055] Based on the checkpoint mechanism, the current decryption status is saved periodically and used as a checkpoint. When a system crash is detected, it is automatically restored from the most recent checkpoint.

[0056] As a preferred embodiment, it also includes:

[0057] Prevent illegal access based on a multi-level security strategy, which includes:

[0058] Use code obfuscation tools to perform obfuscation operations on the current code to increase the difficulty of reverse engineering and virtualize and protect key algorithms;

[0059] Initiate an integrity check mechanism during decryption operation, the integrity check mechanism comprising 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 through a key derivation function based on device characteristics and runtime environment.

[0061] Preferably, the dynamically generating an encryption key through a key derivation function based on device characteristics and runtime environment includes:

[0062] Collecting device characteristics, including CPU ID, device ID, hardware serial number, installed software version, and a unique identifier associated with the device;

[0063] A strong hash function is used to perform hash calculation on the device features to obtain a hash value of a fixed length. The calculation formula is expressed as: H = SHA256 (F);

[0064] The HMAC-based key derivation function derives the encryption key K from the target parameter, expressed as K = HKDF (H, salt, info);

[0065] Wherein, F represents a device feature list, and the target parameters include a device feature hash value H, a random salt value salt, and application specific information info.

[0066] As a preferred embodiment, it also includes:

[0067] Optimize the adaptability and compatibility, testing and verification, and deployment and maintenance related improvement directions. The optimization operations include:

[0068] Add new audio codecs through a plug-in architecture to adapt to multiple audio encoding formats;

[0069] Configure a universal DRM interface to integrate different DRM solutions to implement automatic DRM solution identification and switching mechanism; and / or,

[0070] Generate preset mutation test cases based on the fuzz test generator to comprehensively test the URL parsing and audio segmentation processing logic and detect abnormal problems in a timely manner; and / or,

[0071] Based on the preset automatic problem classification algorithm, abnormal problems that occur during decryption and playback are collected to achieve automatic problem classification and priority sorting.

[0072] A second aspect of the present invention provides an audio stream adaptive decryption system, characterized in that it includes:

[0073] A parsing module, used to obtain and parse the MPEG-DASH manifest file, and parse out audio segmentation information to adapt to segmentation recognition standards and non-standard audio segmentation modes;

[0074] An interface module is used to initialize the standard DRM interface and combine the standard DRM interface with the target audio streaming platform so that the audio stream based on the MPEG-DASH protocol is adapted to the audio segmentation mode of the target audio streaming platform;

[0075] The segment download module is used to extract features of the audio segment information in the recognized audio segment mode, dynamically adjust the segment request and processing logic according to the extracted features to perform adaptive segment download and preprocessing;

[0076] A decryption module is used to 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;

[0077] The reorganization module is used to reconstruct the audio frames of 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.

[0078] A third aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program implements the above-mentioned audio stream adaptive decryption method when executed by the processor.

[0079] A fourth aspect of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned audio stream adaptive decryption method.

[0080] The present invention proposes an audio stream adaptive decryption method, which not only solves the challenges brought by the implementation of a specific platform, but also comprehensively optimizes the performance, security and scalability. The core advantage of the technical solution lies in 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 the standard DRM interface and the requirements of a specific platform, efficient parallel processing and intelligent caching mechanisms are realized, and the decryption efficiency is significantly improved, especially in high-concurrency scenarios. In terms of security, the technical solution introduces multiple protection measures such as dynamic key management, code obfuscation and integrity verification, which effectively reduces 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 the technical solution not only support a variety of audio formats and DRM solutions, but also provide convenience for future expansion and maintenance. In addition, continuous optimization and improvement are achieved through real-time monitoring and intelligent user feedback processing systems. Overall, this adaptive decryption method represents an important advancement in audio streaming DRM technology, and lays a solid technical foundation for providing high-quality, secure and flexible audio streaming services.

[0081] The present invention innovatively combines the standard DRM interface with the implementation of a specific audio streaming platform to develop an adaptive decryption strategy. By deeply analyzing the MP4 file header information and the DASH manifest file, accurate identification and processing of special audio segments are achieved. The introduction of parallel processing and intelligent caching mechanisms significantly improves the decryption efficiency. At the same time, a dynamic key management system is designed to enhance security. The modular design of the solution ensures compatibility with a variety of DRM technologies.

[0082] The present invention can accurately and efficiently decrypt various audio streams, greatly improving compatibility with different platforms. Through optimized parallel processing and caching strategies, the decryption speed is increased by 50%, effectively supporting high-concurrency scenarios. Dynamic key management enhances system security and reduces the risk of being cracked. The modular design enables the system to have good scalability, facilitating the integration of other audio streaming services in the future. At the same time, the adaptive strategy ensures stable performance under different network conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0083] Figure 1 Schematic diagram of the process of the audio stream adaptive decryption method in this embodiment;

[0084] Figure 2 This is a schematic diagram of the steps of obtaining and parsing an MPEG-DASH manifest file in S1 of this embodiment;

[0085] Figure 3 FIG. 4 is a schematic diagram of an embodiment of a computer device in this embodiment. DETAILED DESCRIPTION

[0086] The present invention provides an audio stream adaptive decryption method, system, device and storage medium, which effectively solves the problem of reopening capture when the audio input player switches modes through a persistent audio capture session and a dynamic audio processing pipeline.

[0087] The terms "first", "second", "third", "fourth", etc. (if any) in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "including" or "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0088] Embodiment 1

[0089] For ease of understanding, the specific process of the embodiment of the present invention is described below. Figure 1 The embodiment of the present invention provides an audio stream adaptive decryption method, comprising the following steps:

[0090] S1: Obtain and parse the MPEG-DASH manifest file to parse out audio segmentation information to adapt to segmentation recognition standards and non-standard audio segmentation modes. The non-standard audio segmentation mode refers to the special implementation based on the MPEG-DASH protocol that causes the audio segmentation method of some platforms to be different from the standard.

[0091] See also Figure 2 As shown, in step S1, obtaining the MPEG-DASH manifest file and parsing it includes:

[0092] S11: Obtain an MPD file from a server through an HTTP request, where the MPD file includes at least a Period element, an AdaptationSet element, and a SegmentTemplate element;

[0093] S12: Verify whether the MIME type of the MPD file matches a preset MIME type, and verify whether the MIME type of the MPD file is "application / dash+xml";

[0094] S13: After verifying the match, traverse the Period element, AdaptationSet element and SegmentTemplate element in the MPD (Media Presentation Description) file and parse them to obtain audio segmentation information, which includes the duration of each preset period, the start time, the URL template of the initialized 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, and preparations are made for subsequent adaptive streaming selection. Different audio options are identified, such as multi-language support, and buffering and preloading strategies are accurately calculated to optimize the playback experience, laying the foundation for a smooth and high-quality streaming media experience, and enabling the system to intelligently manage content downloading and playback.

[0095] It can be understood as traversing the Period elements in the MPD, extracting the duration and start time of each period; analyzing the AdaptationSet elements to determine the available audio tracks; parsing the SegmentTemplate elements to obtain the URL templates for the initialization segments and media segments, and identifying the segmentation mode of a specific platform, such as a special numbering method or timestamp format. Among them, MPD is the core concept in the MPEG-DASH protocol. It is an XML document that describes the structure of the entire media content, the different quality versions available, time information, etc. It provides the client with the necessary information to enable it to request and play media content. The SegmentTemplate element is used to describe the address generation rules for media segments. In DASH, Period represents a time period of media content. Each Period may contain different encoding versions or content features. For example, a complete video may be divided into multiple Periods, each of which represents 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.

[0096] In this embodiment, the embodiment:

[0097] Assume that the MPD file contains the following segments:

[0098]

[0099] The parsing results are output as follows:

[0100] Initialization segment URL template: init-$RepresentationID$.mp4; media segment URL template: segment-$RepresentationID$-$Number$.m4s; time scale: 48000; segment duration: 96000 (2 seconds); starting number: 1.

[0101] Furthermore, the processing flow when the MIME type of the MPD file is not the expected "application / dash+xml" is as follows:

[0102] 1. Error detection: The system will immediately capture this anomaly when verifying the MIME type mismatch. This usually occurs 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 may include: retrying once immediately; if it fails, retrying multiple times with increasing waiting times, for example, an exponential backoff algorithm. 4. MIME type compatibility check: If the retry fails, the system will check whether the received MIME type is a known compatible type. For example, some servers may mistakenly mark 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 incompatible, the system will try to analyze the first few lines of the file content, looking for typical MPD file features (such as <mpd>Tags). If these features are found, the system can choose to continue processing, but a warning will be logged. 6. Downgrade processing: If it cannot be confirmed that the file is a valid MPD, the system may try to downgrade to other streaming protocols (such as HLS), provided that the system supports multi-protocol processing. 7. Error reporting: If all attempts fail, the system will generate a detailed error report, including: the URL of the original request, the MIME type received, other relevant header information of the server response, and possible file content samples (avoid including sensitive information). 8. User notification: The system will send an error notification to the user interface to inform the user in a friendly way that a problem has occurred. This may include suggesting that the user check the network connection or try again later. 9. Error recovery: The system will clean up any allocated resources and reset itself to a stable state, ready to handle new requests or user operations. 10. Telemetry data collection: If the system is configured with telemetry, it will send this error event and related context information back to the central server for further analysis and system improvement. 11. Automatic alarm: For serious or frequent MIME type mismatch errors, the system may trigger an automatic alarm mechanism to notify the operation and maintenance team to check. By implementing this comprehensive error handling process, the system is able to gracefully handle situations where the MPD file MIME type does not match. This not only improves system stability and user experience, but also provides valuable information for continuous improvement. This approach demonstrates the robustness and adaptability of the system, and is able to cope with a variety of potential abnormal situations.

[0103] S2: Initialize the standard DRM interface, combine the standard DRM interface with the target audio stream platform, so that the audio stream based on the MPEG-DASH protocol is compatible with the audio segmentation mode of the target audio stream platform; the specific implementation steps include: S21: load the standard DRM interface module using a dynamic link; S22: initialize the context environment of the standard DRM interface and configure parameters; S23: process the encryption method of the target audio stream platform through a custom decryption callback function, and register the callback function to the standard DRM interface; S24: configure the key acquisition mechanism, the configuration content includes the trigger conditions for key request and update, that is, the validity period of the key, the number of content accesses or the user authorization status.

[0104] 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 common 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 special 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 a specific platform. 3. Dynamic loading mechanism: Implement a dynamic loading mechanism to automatically select and load the appropriate DRM adapter based on the runtime environment or configuration. This allows the system to switch seamlessly 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 special key acquisition and management logic for a 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 error types defined by the standard DRM interface to ensure that upper-layer applications can handle errors consistently. 7. Performance optimization: Implement performance optimization in the adapter for the hardware and software characteristics of a specific platform. This may include leveraging platform-specific hardware acceleration features or optimized memory management strategies. 8. Data format conversion: If a specific platform uses a non-standard data format, 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 to avoid 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. Logging and debugging support: Implement detailed logging and debugging support in the adapter to facilitate problem diagnosis and performance analysis on specific platforms. 12. Version compatibility processing: Considering that the DRM implementation of a specific platform may evolve over time, design a version compatibility processing mechanism to ensure that the system can adapt to different versions of the DRM library. 13. Security enhancement: Implement additional security measures in the adapter according to the security requirements of the specific platform, such as code obfuscation, integrity verification, etc. 14. Test suite: Develop a test suite for a specific platform to ensure the correctness and performance of the DRM function on that platform.

[0105] Through the above approach, the system is able to fully utilize the unique features and optimization opportunities of specific audio streaming platforms while maintaining the universality of the standard DRM interface. This combination not only improves the adaptability and performance of the system, but also ensures a consistent user experience on 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.

[0106] Preferably, configuring the key acquisition mechanism further includes: 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 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 a random number.

[0107] S3: Extract features from the audio segment information in the identified audio segmentation mode, dynamically adjust the segmentation request and processing logic according to the extracted features to perform adaptive segmentation downloading and preprocessing; specifically includes the following steps: First implement adaptive segmentation downloading: dynamically adjust the quality of the downloaded segments according to network conditions, and use multi-threading technology to download multiple segments in parallel. Segment integrity verification: calculate the hash value of the downloaded segment, compare it with the checksum provided by the server, and implement an automatic retry mechanism for the segments that fail the checksum. Segment cache management: implement the LRU (least recently used) cache algorithm, optimize memory usage, and dynamically adjust the cache size according to the available memory. Among them, the LRU cache algorithm specifically includes: 1. Use a bidirectional linked list to store cache items, and move the most recently used items to the head of the linked list. 2. Use a hash table to implement a search with O(1) time complexity. 3. When the cache is full, remove the items at the end of the linked list.

[0108] In this embodiment, assume that 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).

[0109] Specifically, in step S3, feature extraction is performed on the audio segment information in the identified audio segment mode, and segment request and processing logic are dynamically adjusted according to the extracted features to perform adaptive segment downloading and preprocessing, including:

[0110] S31: Extracts preset segmentation rules for audio segments by parsing MPD files, identifies non-standard timestamp formats or special segment numbering systems, and implements flexible regular expression matching to accommodate various non-standard URL patterns;

[0111] S32: dynamically constructing a segmented URL suitable for the target audio streaming platform based on preset segmentation rules, and implementing a customized URL template parser;

[0112] S33: dynamically replace variables in the URL according to preset rules of the target audio streaming platform to ensure that the generated URL meets the requirements of the target audio streaming platform, thereby successfully downloading the audio segment;

[0113] S34: Analyze the downloaded audio segments, identify natural segmentation points to adjust the boundaries of the audio segments, and ensure the continuity and integrity of the audio stream. The natural segmentation points include silent periods or changes in audio features.

[0114] S4: Obtain the encryption information corresponding to the current audio segment and extract the encryption parameters to identify the encryption tag of the target audio streaming platform, and select the corresponding decryption algorithm according to the encryption tag to decrypt the current audio segment; specifically, it includes the following steps: obtain the protection scheme sinf box information box of the MP4 file, and extract the encryption parameters, the encryption parameters include the key, the initialization vector IV and the encryption tag or extension of the target audio streaming platform; based on the key storage mechanism, use the trusted execution environment to protect the key from unauthorized access, and regularly update the decryption key according to the key rotation strategy; call the decryption function of the standard DRM interface, and pass in the key and encrypted data for decryption processing.

[0115] Preferably, selecting a corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment further includes:

[0116] When the selected decryption algorithm is the AES-CTR decryption algorithm, initialize the starting value of the counter;

[0117] The counter value is encrypted using the AES algorithm and the key to generate a key stream, wherein the counter value is a combination of the initialization vector IV and the current counter;

[0118] Perform an XOR operation on each key stream block and the corresponding encrypted data block to obtain a decrypted data block;

[0119] Repeat the above steps until all encrypted data blocks are decrypted. The decryption formula is as follows:

[0120] Decrypted=Encrypted XOR AES-CTR(Key,IV||Counter);

[0121] Among them, 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 incrementing counter value.

[0122] In this embodiment, the following data is assumed:

[0123] -Key: 000102030405060708090A0B0C0D0E0F;

[0124] -IV: 000000000000000000000000;

[0125] -Encrypted data: 1A2B3C4D5E6F7A8B9C0D1E2F3A4B5C6D;

[0126] Decryption steps:

[0127] 1. Initial counter value: 00000000;

[0128] 2. Generate key stream: AES-CTR(Key,00000000000000000000000||00000000);

[0129] 3. Perform XOR operation on the key stream and the encrypted data.

[0130] S5: Reconstruct the audio frames of 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 buffer 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. Specifically, it includes the following steps: according to the specifications of audio encoding formats such as AAC, reconstruct the audio frame structure, process possible audio header information, and 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 achieve dynamic adjustment of sampling rate and bit depth. The audio output buffer implements a circular buffer, supports continuous audio data streams, and uses double buffering technology to achieve parallel processing of decryption and playback.

[0131] For example, a circular 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 implementing,

[0132] Assume the buffer size is 8 and the initial state is empty:

[0133] [_,_,_,_,_,_,_,_],read_pos=0,write_pos=0

[0134] Write 5 elements:

[0135] [1,2,3,4,5,_,_,_],read_pos=0,write_pos=5

[0136] Read 3 elements:

[0137] [_,_,_,4,5,_,_,_],read_pos=3,write_pos=5

[0138] Write 6 more elements:

[0139] [9,10,11,4,5,6,7,8], read_pos=3, write_pos=11.

[0140] In this embodiment, achieving a continuous audio data stream and realizing parallel processing of decryption and playback at the same time is a key performance optimization point. Specifically, in step S5, based on the adaptive buffering strategy, the updated audio stream is cached to the preset buffer area, and the final audio stream is outputted, including: allocating a fixed-size memory as the first buffer; 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, it is reset to the starting position to form a loop to realize the adaptation of the ring buffer to process the continuous audio stream; it can be understood that the ring buffer realizes: the ring buffer is a fixed-size buffer, and when it reaches the end, it will wrap around to the beginning to form a loop. This is very suitable for processing continuous audio streams.

[0141] In another embodiment, 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;

[0142] When the second buffer is finished playing, the third buffer that has been decrypted is immediately switched to play, and at the same time, the new audio stream of the second buffer that has just been played is decrypted to use the two buffers to alternately perform decryption and play operations, thereby realizing parallel processing;

[0143] Among them, a mutex lock is used to protect the read and write operations of the corresponding buffer during parallel processing, and a conditional variable is used to notify the relevant thread when the corresponding buffer state changes to ensure the correct synchronization of decryption and playback; 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 to achieve a corresponding buffer of variable size to adapt to the segmentation characteristics of different platforms. The double buffering technology uses two buffers to alternately perform decryption and playback operations to achieve parallel processing. The specific implementation examples of subsequent decryption and playback parallel processing are as follows:

[0144] a) Initialization: Create two buffers: Buffer A and Buffer B, each with a size of 5 seconds of audio data. Create two threads: the decryption thread and the playback thread. b) Start processing: The decryption thread first decrypts 5 seconds of audio data into Buffer A. The playback thread starts playing the contents of Buffer A. At the same time, the decryption thread starts decrypting the next 5 seconds of data into Buffer B. c) Switching process: When Buffer A is almost finished, for example, there are 0.5 seconds left, the system is ready to switch to Buffer B. The playback thread continues to play the remaining contents of Buffer A. The decryption thread has completed the decryption of Buffer B at this time and starts decrypting new data into Buffer A. d) Seamless switching: After Buffer A is finished playing, the playback thread immediately switches to playing Buffer B. At the same time, the decryption thread continues to fill Buffer A. e) Looping: This process is repeated continuously to ensure the continuity of the audio stream. 4. Synchronization mechanism: In order to ensure the correct synchronization of decryption and playback, the following mechanism needs to be implemented: Use a mutex to protect the read and write operations of the buffer. Use a condition variable to notify the relevant threads when the buffer status changes. 5. Handling edge cases: Network latency: If new data is not downloaded in time, the system can implement audio stretching or silent padding to maintain playback continuity. Insufficient decryption speed: The buffer size can be adjusted dynamically or a more aggressive pre-decryption strategy can be implemented. 6. Optimization considerations: Use memory alignment technology 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.

[0145] This implementation allows the system to efficiently parallelize decryption and playback while maintaining audio stream continuity. This not only improves overall performance, but also significantly improves the user experience, especially when network conditions are unstable or when dealing with high bitrate audio.

[0146] In this embodiment, the above steps are used to solve the problem of audio segmentation differences caused by the special implementation of the MPEG-DASH protocol. The specific principle can be understood as follows: 1. Adaptive segmentation recognition: The system implements an intelligent segmentation recognition mechanism that can dynamically identify and adapt to the special segmentation methods of different platforms. This includes: analyzing the SegmentTemplate element in the MPD file, extracting custom segmentation rules, identifying non-standard timestamp formats or special segment numbering systems, and 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 builds segmented URLs suitable for specific platforms. This includes: implementing a custom URL template parser. Dynamically replace variables in the URL such as timestamps, segment numbers, etc. according to the rules of a specific platform. 3. Segment boundary detection: For those platforms with fuzzy or irregular segment boundaries, the system implements an advanced boundary detection algorithm: analyzing the audio data stream and identifying natural segmentation points such as silent periods or changes in audio features. Use heuristic algorithms to adjust segment boundaries to ensure the continuity and integrity of the audio. 4. Adaptive buffering strategy: Implement intelligent buffering strategy to adapt to different segment sizes and distributions: Dynamically adjust the number of pre-buffered segments based on segment size and network conditions. Implement variable-size buffers to adapt to segment characteristics of different platforms. 5. Segment reassembly: For some platforms that may further subdivide standard segments, the system implements segment reassembly function: Reassemble small segments on the client side to match the segment size expected by standard DRM solutions. Implement caching mechanism to effectively manage intermediate data during the reassembly process. 6. Metadata adaptation: Handle non-standard segment metadata: Implement metadata conversion layer to convert segment description information of specific platforms to standard format. Supplement or correct missing metadata information when necessary. 7. Timeline alignment: Address differences in timeline representation on different platforms: Implement timeline conversion function to unify time representation in different formats. Handle possible timestamp discontinuity or overlap issues. 8. Error recovery mechanism: Enhance error handling capabilities to deal with problems that may be caused by non-standard segmentation: Implement intelligent retry logic and take corresponding recovery strategies for specific types of segmentation errors. 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 segmentation strategies: Detect changes in segmentation strategies during playback, such as live broadcast to on-demand. Seamlessly switch to the 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 processing efficiency of non-standard segments. Use prediction algorithms to prepare special format segments that may be needed in advance. 11. Compatibility layer: Develop a compatibility layer to convert between special segment formats and standard DRM solutions: Before decryption, convert non-standard segments into a format that the DRM solution can handle.If necessary, implement a custom decryption process to handle special segmentation formats. 12. Segmentation analysis tools: Develop specialized analysis tools to study and adapt to new non-standard segmentation methods: Automatically analyze the segmentation characteristics of new platforms. Generate adaptation strategy recommendations to assist in the rapid development of new platform support.

[0147] Through these methods, the system can effectively overcome the segmentation difference problem caused by the special implementation of the MPEG-DASH protocol. This comprehensive and flexible approach not only solves the existing compatibility issues, 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.

[0148] In various embodiments of the present application, a multi-level optimization strategy is used to meet the real-time playback requirements in a high-concurrency scenario. The multi-level optimization strategy includes:

[0149] The decryption operations of multiple audio segments under multiple decryption threads are processed in parallel through a thread pool, and the load of each decryption thread is balanced based on a work-stealing algorithm;

[0150] According to the prediction of the user's playback behavior, the subsequent audio segments are predicted to be downloaded and decrypted in advance and stored in a preset buffer. The pre-reading amount is adjusted according to the network conditions through an adaptive pre-reading strategy to optimize the loading of the audio segments; it can be understood that this embodiment performs parallel processing and performance optimization, which specifically includes the following steps: Multi-threaded decryption: implement a thread pool, manage multiple decryption threads, and use a work-stealing algorithm to balance the thread load. Pre-reading and pre-decryption: Based on the prediction of the user's playback behavior, download and decrypt the 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, reduce frequent memory allocation and release, and 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 the queue of another thread. 3. Steal tasks from the tail of the selected queue. Suppose there are three threads A, B, and C, and the initial task allocation is as follows: A: [1, 2, 3, 4], B: [5, 6], C: [7, 8, 9]; after thread B completes its task, it steals tasks from C: A: [1, 2, 3, 4], B: [9], C: [7, 8].

[0151] In this embodiment, the abnormal situation occurring during the decryption process is handled based on a preset error handling strategy, and the handling operation includes:

[0152] When an abnormality occurs in the network, retries are performed based on an exponential backoff algorithm; the exponential backoff algorithm adopted in this embodiment specifically includes: 1. Initial waiting time: t = t_initial; 2. Each retry, waiting time: t = min (t*2, t_max); 3. Adding random jitter: t = t+random (-t*0.1, t*0.1).

[0153] When network anomalies continue to exceed the fault threshold, a degradation strategy is adopted to achieve an elegant degradation strategy in the event of continuous network failures;

[0154] Implement a retry mechanism for audio segments that fail to be decrypted separately, and implement a partial decryption strategy to allow continued playback even if some content fails to be decrypted;

[0155] Based on the checkpoint mechanism, the current decryption status is saved periodically and used as a checkpoint. When a system crash is detected, it is automatically restored from the most recent checkpoint.

[0156] When implementing, assuming the initial wait time is 1 second and the maximum wait time is 60 seconds: 1st retry: wait 1 second; 2nd retry: wait 2 seconds; 3rd retry: wait 4 seconds; 4th retry: wait 8 seconds... 6th retry: wait 60 seconds to reach the maximum value.

[0157] In this embodiment, illegal access is prevented based on a multi-level security strategy, and the multi-level security strategy includes:

[0158] Use code obfuscation tools to perform obfuscation operations on the current code to increase the difficulty of reverse engineering. Virtualization protection of key algorithms. Use code obfuscation tools to increase the difficulty of decompilation and implement virtualization protection of key algorithms.

[0159] Initiate an integrity check mechanism during decryption operation, which includes periodically calculating the hash value of the key code module and comparing the currently 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;

[0160] The encryption key is dynamically generated through a key derivation function based on device characteristics and runtime environment, and key dispersion technology is used to avoid storing the complete key in memory.

[0161] Preferably, the dynamically generating an encryption key through a key derivation function based on device characteristics and runtime environment includes:

[0162] Collecting device characteristics, including CPU ID, device ID, hardware serial number, installed software version, and a unique identifier associated with the device;

[0163] A strong hash function is used to perform hash calculation on the device features to obtain a hash value of a fixed length. The calculation formula is expressed as: H = SHA256 (F);

[0164] The HMAC-based key derivation function derives the encryption key K from the target parameter, expressed as K = HKDF (H, salt, info);

[0165] Wherein, F represents a device feature list, and the target parameters include a device feature hash value H, a random salt value salt, and application specific information info.

[0166] During implementation, we assume that the device feature hash H is:

[0167] 5B4DA95F5FA08280FC9879DF44F418C8F9F12BA424B7757DE02BBDFBAE0D4C4F;

[0168] Use HKDF to derive a 256-bit key:

[0169] salt=0123456789ABCDEF

[0170] info="AUDIO_STREAM_DRM_KEY"

[0171] K=HKDF-SHA256(H,salt,info).

[0172] In this embodiment, the improvement directions related to adaptability and compatibility, testing and verification, and deployment and maintenance may also be optimized. The optimization operations include:

[0173] Add new audio codecs through a plug-in architecture to adapt to multiple audio encoding formats and support multiple audio codecs, such as AAC, Opus, MP3, etc. Develop a plug-in architecture to facilitate adding new codec support;

[0174] Configure a universal DRM interface to integrate different DRM solutions to implement automatic identification and switching mechanisms for DRM solutions. A universal DRM interface is designed here to facilitate future integration with other DRM solutions; it can also adapt to platform features: optimize the underlying implementation for different operating systems (iOS, Android, Windows, etc.), and utilize platform-specific hardware acceleration capabilities, such as hardware decoders.

[0175] This embodiment adopts dynamic loading of codecs, defines a unified codec interface, and uses the reflection mechanism to dynamically load the codec, which is described in detail as follows: 1. Codec interface definition: `interface Codec` defines a general codec interface. This interface contains three methods: -`init`: used to initialize the codec, and parameters such as sampling rate, number of channels, etc. can be passed in. -`decode`: decode the input encoded data into raw audio data. -`encode`: encode the raw audio data into a specific format. The design of this interface allows the system to handle different types of codecs in a unified manner. 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 based on the provided class name. -`cls.newInstance()` creates a new instance of the class. -The returned object is transformed into the `Codec` interface type. This method allows the system to load different codecs as needed at runtime without having to decide which specific codec to use at compile time.

[0176] When implemented, this example shows how to load and use an AAC decoder using the above mechanism.

[0177] - `loadCodec("com.example.AACCodec")` dynamically loads the class named "com.example.AACCodec".

[0178] - `aacCodec.init(...)` initializes the decoder, sets the sampling rate to 44100Hz and 2 audio channels.

[0179] - `aacCodec.decode(encryptedData)` decodes the encrypted AAC data and returns the raw audio data in PCM format.

[0180] The advantages of the above method are as follows: 1. Flexibility: The system can load different codecs as needed, which is easy to expand and maintain. 2. Decoupling: The specific implementation of the codec is separated from the code that uses them, which improves the modularity of the system. 3. Runtime adaptation: The most suitable codec can be selected at runtime according to different audio formats or device capabilities. 4. Resource optimization: The corresponding codec is only loaded when it is needed, saving system resources. This dynamic loading mechanism is a key part of realizing a flexible and scalable audio processing system, especially suitable for application scenarios that need to support multiple audio formats.

[0181] In this embodiment, the improvement directions related to adaptability and compatibility, testing and verification, and deployment and maintenance are optimized, and the optimization operation also includes:

[0182] Based on the fuzz test generator, preset mutation test cases are generated to comprehensively test the URL parsing and audio segmentation processing logic and detect abnormal problems in a timely manner; it can be understood that the test and verification are described in detail as follows: Unit testing: Write unit tests for each core component, such as DASH parsing, decryption algorithm, etc.; use mock objects (Mock Objects) to test external dependencies, such as network requests. Integration testing: Develop end-to-end test cases to verify the entire decryption and playback process, and use different network conditions and device configurations for testing. Performance testing: Implement load testing to evaluate the performance of the system under high concurrency, perform memory leak and CPU usage analysis, and optimize resource usage. Security testing: Conduct penetration testing to try to crack DRM protection. Use fuzz testing (Fuzzing) to detect potential security vulnerabilities. Among them, the fuzz test generator used is described as follows:

[0183] 1. Define input template: template = "segment-$RepresentationID$-$Number$.m4s"

[0184] 2. Define mutation rules:

[0185] -Replace: Randomly replace characters

[0186] -Insert: insert random characters

[0187] -Delete: delete random characters

[0188] -Repeat: Repeat a part

[0189] 3. Generate test cases:

[0190] for i=1toN: / / This is a loop that will generate N test cases;

[0191] case = mutate(template, random_rule()) / / The mutate function applies a randomly selected mutation rule to the original template. The random_rule() function randomly selects a mutation rule such as replacement, insertion, deletion, or duplication.

[0192] test(case) / / The function executes the test using the generated test case;

[0193] When implementing:

[0194] Original template: segment-$RepresentationID$-$Number$.m4s

[0195] Variant 1 (replacement): segment-$RepresentationID$-$Number$.m4s

[0196] Variant 2 (insert): segme!nt-$RepresentationID$-$Number$.m4s

[0197] Variant 3 (deletion): segment-RepresentationID$-$Number$.m4s

[0198] Variant 4 (duplicate): segment-$RepresentationID$-$Number$-$Number$.m4s

[0199] The purpose of the above fuzz testing method is to: 1. Generate various abnormal or edge case inputs. 2. Test the system's ability to handle non-standard or erroneous inputs. 3. Discover potential security vulnerabilities or stability issues. By systematically generating these mutation test cases, the robustness of the URL parsing and segment processing logic can be fully tested to ensure that the system can gracefully handle various unexpected situations.

[0200] In this embodiment, the improvement directions related to adaptability and compatibility, testing and verification, and deployment and maintenance are optimized, and the optimization operation also includes: collecting abnormal problems that occur during decryption and playback based on a preset automatic problem classification algorithm to achieve automatic problem classification and priority sorting. It can be understood that the deployment and maintenance optimization specifically includes the following steps: Version control: implement semantic version control, clearly manage API changes, maintain detailed update logs, and record changes in each version. Hot update mechanism: design a modular update system to support dynamic updates of some components; implement a rollback mechanism to quickly restore to the previous stable version when the update fails. 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 during decryption and playback; implement an automated problem classification and priority sorting system.

[0201] This embodiment uses a preset automatic question classification algorithm, which is described in detail as follows: 1. Extract keywords: Use the TF-IDF algorithm to extract keywords from user feedback. 2. Construct feature vectors: Convert keywords into numerical features. 3. Use machine learning models (such as Naive Bayes or SVM) for classification. During implementation, assume that user feedback is received: "Audio playback suddenly stops with error code E0023"

[0202] 1. Extract keywords: ["play stop", "error code", "E0023"]; 2. Convert to feature vector: [1,1,1,0,0,...] / / Assume there is a predefined feature dictionary; 3. Use the trained model to classify, such as classifying into the "decryption failure" category.

[0203] Through the above detailed technical solutions, the embodiment of the present invention realizes an audio stream adaptive decryption method. This solution not only solves the challenges brought by the implementation of a specific platform, but also comprehensively optimizes performance, security and scalability. By innovatively combining the general functions of the standard DRM interface with the requirements of a specific platform, this solution provides a powerful and flexible solution for audio streaming media services.

[0204] The core advantages of this solution include: 1. Adaptive decryption strategy, which can accurately identify and process special audio segments of different platforms. 2. Efficient parallel processing and intelligent caching mechanism, which significantly improves decryption efficiency. 3. Powerful security measures, including dynamic key management and code protection. 4. Excellent error handling and recovery mechanism to ensure service stability. 5. Good scalability and compatibility, supporting multiple audio formats and DRM solutions.

[0205] In addition, the modular design and comprehensive testing and verification process of the solution 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 the ever-changing market needs and technical environment.

[0206] Overall, this audio stream adaptive decryption method represents an important advancement in audio streaming DRM technology, opening up new possibilities for providing high-quality, secure and flexible audio streaming services.

[0207] Second embodiment

[0208] Based on the same inventive concept, this embodiment provides an audio stream adaptive decryption system, including:

[0209] A parsing module, used to obtain and parse the MPEG-DASH manifest file, and parse out audio segmentation information to adapt to segmentation recognition standards and non-standard audio segmentation modes;

[0210] An interface module is used to initialize the standard DRM interface and combine the standard DRM interface with the target audio streaming platform so that the audio stream based on the MPEG-DASH protocol is adapted to the audio segmentation mode of the target audio streaming platform;

[0211] The segment download module is used to extract features of the audio segment information in the recognized audio segment mode, dynamically adjust the segment request and processing logic according to the extracted features to perform adaptive segment download and preprocessing;

[0212] A decryption module is used to 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;

[0213] The reorganization module is used to reconstruct the audio frames of 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. The principle is shown in Example 1 and will not be repeated here.

[0214] Based on the same inventive concept, this embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that when the computer program is executed by the processor, the steps of any one of the above-mentioned audio stream adaptive decryption methods are implemented.

[0215] Based on the same inventive concept, this embodiment provides a computer-readable storage medium on which a computer program is stored, characterized in that when the computer program is executed by a processor, the steps of any of the above-mentioned audio stream adaptive decryption methods are implemented.

[0216] The computer device in this embodiment is described in detail from the perspective of hardware processing.

[0217] See also Figure 3 As shown, the computer device includes a processor 100 and a memory 101. The memory 101 stores machine executable instructions that can be executed by the processor 100. The processor 100 executes the machine executable instructions to implement the above audio stream adaptive decryption method.

[0218] further, Figure 3 The computer device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0219] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), for example, at least one disk storage. 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 may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may 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, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0220] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present disclosure can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101 , and the processor 100 reads the information in the memory 101 and completes the method steps of the above-mentioned embodiment in combination with its hardware.

[0221] The present invention also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. Instructions are stored in the computer-readable storage medium. When the instructions are executed on a computer, the computer executes the steps of the audio stream adaptive decryption method.

[0222] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described systems, systems and units can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0223] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for 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 each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0224] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.< / mpd>

Claims

1. An audio stream adaptive decryption method, characterized in that: include: Obtain the MPEG-DASH manifest file and parse it to extract audio segment information to adapt to segment identification standards and non-standard audio segment modes; Initialize the standard DRM interface and combine the standard DRM interface with the target audio streaming platform so that the audio stream based on the MPEG-DASH protocol is compatible with the audio segmentation mode of the target audio streaming platform; Extract features of the audio segment information in the identified audio segment mode, and dynamically adjust the segment request and processing logic according to the extracted features to perform adaptive segment downloading and preprocessing; Obtain the encryption information corresponding to the current audio segment and extract the encryption parameter to identify the encryption tag of the target audio stream platform, and select the corresponding decryption algorithm according to the encryption tag to decrypt the current audio segment; The audio frames of the decrypted data are reconstructed to form 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. The final audio stream is output to ensure the continuity of the final audio stream while achieving efficient parallel processing of decryption and playback.

2. The audio stream adaptive decryption method according to claim 1, characterized in that: The obtaining and parsing of the MPEG-DASH manifest file includes: Obtaining an MPD file from a server through an HTTP request, wherein the MPD file includes at least a Period element, an AdaptationSet element, and a SegmentTemplate element; Verify whether the MIME type of the MPD file matches a preset MIME type; After verifying the match, the Period element, AdaptationSet element, and SegmentTemplate element in the MPD file are traversed and parsed to obtain audio segmentation information, which includes the duration of each preset period, the start time, the URL template of the initialized audio segment, and the media segment.

3. The audio stream adaptive decryption method according to claim 1, characterized in that: Initializing the standard DRM interface and combining the standard DRM interface with the target audio streaming platform includes: Use dynamic linking to load the standard DRM interface module; Initialize the context of the standard DRM interface and configure parameters; Process the encryption method of the target audio streaming platform through a custom decryption callback function, and register the callback function to the standard DRM interface; The key acquisition mechanism is configured, including the triggering conditions for key request and update, that is, the key validity period, content access times, or user authorization status.

4. The audio stream adaptive decryption method according to claim 3, characterized in that: Configuring the key acquisition mechanism further includes: Construct key request: R = E (Kpub, [KID||Nonce]); Send a request to the key server; Receive and decrypt the response: K = D (Kpriv, Response); Among them, 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 a random number.

5. The audio stream adaptive decryption method according to claim 2, characterized in that: The step of extracting features from the audio segment information in the identified audio segment mode and dynamically adjusting the segment request and processing logic according to the extracted features to perform adaptive segment downloading and preprocessing includes: Extract audio segments by parsing MPD files, recognize non-standard timestamp formats or special segment numbering systems, and implement flexible regular expression matching to accommodate various non-standard URL patterns; Dynamically construct segmented URLs suitable for the target audio streaming platform based on preset segmentation rules and implement a custom URL template parser; Dynamically replace variables in the URL according to the preset rules of the target audio streaming platform to ensure that the generated URL meets the requirements of the target audio streaming platform, so as to successfully download the audio segments; The downloaded audio segments are analyzed to identify natural segmentation points to adjust the boundaries of the audio segments and ensure the continuity and integrity of the audio stream. The natural segmentation points include silent periods or changes in audio features.

6. The audio stream adaptive decryption method according to claim 1, characterized in that: The step of obtaining encryption information corresponding to the current audio segment and extracting encryption parameters to identify the encryption mark of the target audio stream platform, and selecting a corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment includes: Obtain the protection scheme sinf box information box of the MP4 file and extract encryption parameters, wherein the encryption parameters include a key, an initialization vector IV, and an encryption tag or extension of the target audio streaming platform; Based on the key storage mechanism, a 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, pass in the key and encrypted data for decryption.

7. The audio stream adaptive decryption method according to claim 1, characterized in that: The step of selecting a corresponding decryption algorithm according to the encryption mark to decrypt the current audio segment further comprises: When the selected decryption algorithm is the AES-CTR decryption algorithm, initialize the starting value of the counter; The counter value is encrypted using the AES algorithm and the key to generate a key stream, wherein the counter value is a combination of the initialization vector IV and the current counter; Perform an XOR operation on each key stream block and the corresponding encrypted data block to obtain a decrypted data block; Repeat the above steps until all encrypted data blocks are decrypted. The decryption formula is as follows: Decrypted=Encrypted XOR AES-CTR(Key,IV||Counter); Among them, 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 incrementing counter value.

8. The audio stream adaptive decryption method according to claim 1, characterized in that: The method of caching the updated audio stream to a preset buffer area based on the adaptive buffering strategy and outputting the final audio stream includes: Allocate a fixed size of memory as the 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, it is reset to the starting position to form a loop to achieve the adaptation of the ring buffer to process the continuous audio stream; and / or, Create a second buffer and a third buffer of 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 streams; When the second buffer is finished playing, the third buffer that has been decrypted is immediately switched to play, and at the same time, the new audio stream of the second buffer that has just been played is decrypted to use the two buffers to alternately perform decryption and play operations, thereby realizing parallel processing; Among them, a mutex lock is used to protect the read and write operations of the corresponding buffer during parallel processing, and a conditional variable is used to notify the relevant threads when the state of the corresponding buffer changes to ensure the correct synchronization of decryption and playback; the first buffer, the second buffer and the third buffer all dynamically adjust the number of pre-buffered segments according to the adaptive buffer strategy to achieve a corresponding buffer of variable size to adapt to the segmentation characteristics of different platforms.

9. The audio stream adaptive decryption method according to claim 1, characterized in that: Also includes: The real-time playback requirements in high-concurrency scenarios are met based on a multi-level optimization strategy, which includes: The decryption operations of multiple audio segments under multiple decryption threads are processed in parallel through a thread pool, and the load of each decryption thread is balanced based on a work-stealing algorithm; Predicting the user's playback behavior, downloading and decrypting subsequent audio segments in advance and storing them in a preset buffer, and optimizing the loading of audio segments by adjusting the pre-reading amount according to network conditions through an adaptive pre-reading strategy; and / or, The abnormal situations that occur during the decryption process are handled based on the preset error handling strategy. The processing operations include: When the network is abnormal, retries are performed based on the exponential backoff algorithm; When network anomalies continue to exceed the fault threshold, a degradation strategy is adopted; Implement a retry mechanism for audio segments that fail to be decrypted separately, and implement a partial decryption strategy to allow continued playback even if some content fails to be decrypted; Based on the checkpoint mechanism, the current decryption status is saved periodically and used as a checkpoint. When a system crash is detected, it is automatically restored from the most recent checkpoint.

10. The audio stream adaptive decryption method according to claim 1, characterized in that: Also includes: Prevent illegal access based on a multi-level security strategy, which includes: Use code obfuscation tools to perform obfuscation operations on the current code to increase the difficulty of reverse engineering and virtualize and protect key algorithms; Initiate an integrity check mechanism during decryption operation, the integrity check mechanism comprising 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; The encryption key is dynamically generated through a key derivation function based on device characteristics and runtime environment.

11. The audio stream adaptive decryption method according to claim 10, characterized in that: The dynamically generating an encryption key through a key derivation function based on device characteristics and runtime environment includes: Collecting device characteristics, including CPU ID, device ID, hardware serial number, installed software version, and a unique identifier associated with the device; A strong hash function is used to perform hash calculation on the device features to obtain a hash value of a fixed length. The calculation formula is expressed as: H = SHA256 (F); The HMAC-based key derivation function derives the encryption key K from the target parameter, expressed as K = HKDF (H, salt, info); Wherein, F represents a device feature list, and the target parameters include a device feature hash value H, a random salt value salt, and application specific information info.

12. The audio stream adaptive decryption method according to claim 1, characterized in that: Also includes: Optimize the adaptability and compatibility, testing and verification, and deployment and maintenance related improvement directions. The optimization operations include: Add new audio codecs through a plug-in architecture to adapt to multiple audio encoding formats; Configure a universal DRM interface to integrate different DRM solutions to implement automatic DRM solution identification and switching mechanism; and / or, Generate preset mutation test cases based on the fuzz test generator to comprehensively test the URL parsing and audio segmentation processing logic and detect abnormal problems in a timely manner; and / or, Based on the preset automatic problem classification algorithm, abnormal problems that occur during decryption and playback are collected to achieve automatic problem classification and priority sorting.

13. An audio stream adaptive decryption system, characterized in that: include: A parsing module, used to obtain and parse the MPEG-DASH manifest file, and parse out audio segmentation information to adapt to segmentation recognition standards and non-standard audio segmentation modes; An interface module is used to initialize the standard DRM interface and combine the standard DRM interface with the target audio streaming platform so that the audio stream based on the MPEG-DASH protocol is adapted to the audio segmentation mode of the target audio streaming platform; The segment download module is used to extract features of the audio segment information in the recognized audio segment mode, dynamically adjust the segment request and processing logic according to the extracted features to perform adaptive segment download and preprocessing; A decryption module is used to 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; The reorganization module is used to reconstruct the audio frames of 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. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the computer program is executed by a processor, the method steps for adaptively decrypting an audio stream as described in any one of claims 1 to 12 are implemented.

15. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method steps for adaptively decrypting an audio stream as described in any one of claims 1 to 12 are implemented.

Citation Information

Cited By

  • Dynamic expansion method and system for S3 standard object storage interface and medium

    CN119720161A

  • Video and audio digital copyright encryption method, decryption method, system and device

    CN119967204A

  • Low-delay high-security data transmission method and system for video platform

    CN120018123A

  • Data acquisition method and device based on encryption request, electronic equipment and medium

    CN120030568A

  • Data acquisition method, device, electronic device and medium based on encryption request

    CN120030568B