IP Library Granted Patent US 12675556
Granted Patent B2
US 12675556 · App. 19/166,888 · Granted Jul 7, 2026

Computer-implemented method for adaptive decryption of audio streams, device, and storage medium

Inventors: Keying Zhao (Nanjing, CN); Qi Wang (Nanjing, CN)
Assignee: Linkplay Technology Inc. Nanjing
G06F21/106G06F3/165G06F21/602
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 12675556
App. No.
19/166,888
Granted
Jul 7, 2026
Kind
B2
Abstract

A computer-implemented method for adaptive decryption of audio streams includes acquiring an MPEG-DASH manifest file and parsing the MPEG-DASH manifest file; initializing a standard DRM interface; performing feature extraction on the audio segment information in the identified audio segment mode, and dynamically adjusting segment requests and processing logic for adaptive segment downloading and preprocessing; extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment; and performing audio frame reconstruction on the decrypted data to form an updated audio stream and buffering, based on an adaptive buffering strategy, the updated audio stream in a preset buffer, and outputting a final audio stream to ensure audio stream continuity while achieving efficient parallel processing of decryption and playback, improving decryption efficiency, and enhancing user experience, especially in high concurrency scenarios.

Claims (132)

1 . A computer-implemented method for adaptive decryption of audio streams, comprising:

acquiring a Moving Picture Experts Group (MPEG)-Dynamic Adaptive Streaming over HyperText Transfer Protocol (DASH) manifest file and parsing the MPEG-DASH manifest file to extract audio segment information for adaptive segment recognition of standard and non-standard audio segment modes;

initializing a standard Digital Rights Management (DRM) interface and integrating the DRM interface with a target audio stream platform to adapt an MPEG-DASH protocol-based audio stream to an audio segment mode of the target audio stream platform;

performing feature extraction on the audio segment information in the identified audio segment mode, and dynamically adjusting segment requests and processing logic for adaptive segment downloading and preprocessing;

acquiring encryption information corresponding to a current audio segment, extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment; and

performing audio frame reconstruction on the decrypted data to form an updated audio stream to ensure compatibility with an original unencrypted audio stream, and buffering, based on an adaptive buffering strategy, an updated audio stream in a preset buffer, and outputting a final audio stream to ensure audio stream continuity while achieving efficient parallel processing of decryption and playback.

2 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , wherein the acquiring the MPEG-DASH manifest file and parsing the MPEG-DASH manifest file comprises:

acquiring an MPD file from a server via an HTTP request, wherein the MPD file at least comprises a Period element, an AdaptationSet element, and a SegmentTemplate element;

verifying whether a MIME type of the MPD file matches a preset MIME type; and

after the verification and matching, traversing the Period element, AdaptationSet element, and SegmentTemplate element in the MPD file and parsing the elements to obtain the audio segment information, wherein the audio segment information comprises duration, start time, initialization audio segment, and a URL template for media segment for each preset period.

3 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , wherein the initializing the standard DRM interface and integrating same with the target audio stream platform comprises:

loading a standard DRM interface module using a dynamic linking method;

initializing a context environment of the standard DRM interface and performing parameter configuration;

processing an encryption method of the target audio stream platform through a custom decryption callback function, and registering the custom decryption callback function with the standard DRM interface; and

configuring a key acquisition mechanism, wherein a configuration content comprises trigger conditions for key requests and updates, namely, a validity period of the key, a content access count, or a user authorization status.

4 . The computer-implemented method for adaptive decryption of audio streams according to claim 3 , wherein the configuring the key acquisition mechanism further comprises:

creating a key request: R=E(Kpub, [KID∥Nonce]);

sending the request to a key server; and

receiving and decrypting a response: K=D(Kpriv, Response);

wherein R is an encrypted key request, K is a decryption key, E is a public key encryption function, D is a private key decryption function, Kpub is a server public key, Kpriv is a client private key, KID is a key ID, and Nonce is a nonce.

5 . The computer-implemented method for adaptive decryption of audio streams according to claim 2 , wherein the performing feature extraction on the audio segment information in the identified audio segment mode, and dynamically adjusting segment requests and processing logic for adaptive segment downloading and preprocessing comprises:

identifying, by parsing the MPD file to extract preset segment rules of audio segments, a non-standard timestamp format or a special segment numbering system, and achieving flexible regular expression matching to adapt to various non-standard URL modes;

dynamically constructing, based on the preset segment rules, a segment URL suitable for the target audio stream platform to achieve a customized URL template parser;

dynamically replacing, according to preset rules of the target audio stream platform, a variable in the URL to ensure that the generated URL meets the requirements of the target audio stream platform to successfully download an audio segment; and

analyzing the downloaded audio segment, identifying natural segment points to adjust boundaries of the audio segment to ensure continuity and integrity of the audio stream, wherein the natural segment points comprise silence periods or audio feature changes.

6 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , wherein the acquiring encryption information corresponding to the current audio segment, extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment comprises:

acquiring a protection scheme sinf box information box of an MP4 file, and extracting encryption parameters, wherein the encryption parameters comprise a key, an initialization vector IV and an encryption flag or extension of the target audio stream platform;

using, based on a key storage mechanism, a trusted execution environment to protect the key from unauthorized access, and periodically updating, according to a key rotation strategy, a decryption key; and

calling a decryption function of the standard DRM interface, and passing in the key and encrypted data for decryption processing.

7 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , wherein the selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment further comprises:

initializing, when the selected decryption algorithm is an AES-CTR decryption algorithm, a starting value of a counter;

encrypting a counter value using an AES algorithm and a key to generate a keystream, wherein the counter value is a combined value of an initialization vector IV and a current counter;

performing an XOR operation on each keystream block and a corresponding encrypted data block to obtain a decrypted data block; and

repeating the above steps until all encrypted data blocks are decrypted, wherein the decryption formula is expressed as follows:

Decrypted

=

Encrypted

XOR

AES

-

CTR

(

Key

,

IV

Counter

)

;

wherein Decrypted represents a result of a decryption operation, Encrypted is encrypted data, Key is a decryption key, IV is the initialization vector, and Counter is an incremented counter value.

8 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , wherein the buffering, based on the adaptive buffering strategy, the updated audio stream in the preset buffer, and outputting the final audio stream comprises:

allocating a memory of a fixed size as a first buffer;

configuring a write pointer for writing new data and a read pointer for playing the data;

resetting, when the corresponding pointer reaches an end of the first buffer, to a starting position to form a loop to enable a ring buffer to adaptively process continuous audio streams; and/or,

creating a second buffer and a third buffer of the same size, wherein the second buffer is used for playing a current audio stream, and the third buffer is used for decrypting a next batch of audio streams; and

immediately switching, when a playback of the second buffer is completed, to the decrypted third buffer for playback, starting decrypting a new audio stream in the second buffer that has just finished the playback at the same time to use the two buffers to alternately perform decryption and playback operations to achieve parallel processing;

wherein during the parallel processing, a mutex is used to protect read-write operations of the corresponding buffer, and a condition variable is used to notify relevant threads when a state of the corresponding buffer changes to ensure correct synchronization of the decryption and the playback; the first buffer, the second buffer, and the third buffer all dynamically adjust a number of pre-buffered segments according to an adaptive buffering strategy to achieve a corresponding buffer with a variable size to adapt to segment characteristics of different platforms.

9 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , further comprising:

meeting, based on a multi-level optimization strategy, real-time playback requirements in high concurrency scenarios, the multi-level optimization strategy comprising:

processing decryption operations of a plurality of audio segments under a plurality of decryption threads in parallel via a thread pool, and balancing, based on a work-stealing algorithm, a load of each decryption thread;

predicting, according to a user's playback behavior prediction, downloading and decrypting subsequent audio segments in advance, and storing the audio segments in a preset buffer, optimizing, according to network conditions, loading of audio segments by adjusting a pre-fetching amount by means of an adaptive pre-fetching strategy; and/or,

handling, based on a preset error handling strategy, abnormal situations occurring during the decryption process, the handling operations comprising:

retrying, based on an exponential backoff algorithm, when the network is abnormal;

adopting a degradation strategy when the network abnormality continues to exceed a fault threshold;

separately executing a retry mechanism on audio segments for which decryption has failed, and implementing a partial decryption strategy to allow playback to continue in the case of partial content decryption failure; and

periodically saving, based on a checkpoint mechanism, a current decryption state as a checkpoint, and automatically restoring, when a system crash is detected, from a most recent checkpoint.

10 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , further comprising:

preventing, based on a multi-level security strategy, illegal access, the multi-level security strategy comprising:

performing obfuscation operations on a current code using code obfuscation tools to increase difficulty of reverse engineering and virtualizing to protect key algorithms;

starting an integrity checking mechanism when decryption runs, the integrity checking mechanism comprising regularly calculating a hash value of key code modules and comparing a currently calculated hash value with an expected hash value to ensure code integrity and prevent code tampering; and

dynamically generating, based on device characteristics and runtime environment, encryption keys through a key derivation function.

11 . The computer-implemented method for adaptive decryption of audio streams according to claim 10 , wherein the dynamically generating, based on device characteristics and runtime environment, encryption keys through the key derivation function comprises:

collecting device characteristics, the device characteristics comprising a CPU ID, a device ID, a hardware serial number, an installed software version, and a unique identifier associated with the device;

performing hash calculation on the device characteristics using a strong hash function to obtain a hash value with a fixed length, wherein the calculation formula is expressed as: H=SHA256(F); and

deriving, by an HMAC-based key derivation function, an encryption key K from the target parameters, denoted as K=HKDF(H, salt, info);

wherein F represents a list of device characteristics, and the target parameters comprise a device characteristic hash value H, a random salt value salt, and application-specific information info.

12 . The computer-implemented method for adaptive decryption of audio streams according to claim 1 , further comprising:

optimizing improvements in adaptability and compatibility, testing and verification, and deployment and maintenance, the optimizing operations comprise:

adding a new audio codec through a plugin-based architecture to achieve adaptation to a plurality of audio coding formats;

configuring a general DRM interface to integrate different DRM schemes to achieve automatic identification and switching mechanism of the DRM schemes; and/or

generating preset mutated test cases using a fuzzing generator, comprehensively testing a URL parsing and audio segment processing logic, and promptly identifying abnormal issues; and/or

collecting, based on a preset automatic issue classification algorithm, the abnormal issues that occur during the decryption and the playback to achieve automated issue classification and priority sorting.

13 . A computer device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein when the computer program is executed by a processor, the computer implementing adaptive decryption of audio streams performs the following steps:

acquiring a Moving Picture Experts Group (MPEG)-Dynamic Adaptive Streaming over HyperText Transfer Protocol (DASH) manifest file and parsing the MPEG-DASH manifest file to extract audio segment information for adaptive segment recognition of standard and non-standard audio segment modes;

initializing a standard Digital Rights Management (DRM) interface and integrating the DRM interface with a target audio stream platform to adapt an MPEG-DASH protocol-based audio stream to an audio segment mode of the target audio stream platform;

performing feature extraction on the audio segment information in the identified audio segment mode, and dynamically adjusting segment requests and processing logic for adaptive segment downloading and preprocessing;

acquiring encryption information corresponding to a current audio segment, extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment; and

performing audio frame reconstruction on the decrypted data to form an updated audio stream to ensure compatibility with an original unencrypted audio stream, and buffering, based on an adaptive buffering strategy, an updated audio stream in a preset buffer, and outputting a final audio stream to ensure audio stream continuity while achieving efficient parallel processing of decryption and playback.

14 . The computer device according to claim 13 , wherein the acquiring the MPEG-DASH manifest file and parsing the MPEG-DASH manifest file comprises:

acquiring an MPD file from a server via an HTTP request, wherein the MPD file at least comprises a Period element, an AdaptationSet element, and a SegmentTemplate element;

verifying whether a MIME type of the MPD file matches a preset MIME type; and

after the verification and matching, traversing the Period element, AdaptationSet element, and SegmentTemplate element in the MPD file and parsing the elements to obtain the audio segment information, wherein the audio segment information comprises duration, start time, initialization audio segment, and a URL template for media segment for each preset period.

15 . The computer device according to claim 13 , wherein the initializing a standard DRM interface and integrating same with the target audio stream platform comprises:

loading a standard DRM interface module using a dynamic linking method;

initializing a context environment of the standard DRM interface and performing parameter configuration;

processing an encryption method of the target audio stream platform through a custom decryption callback function, and registering the custom decryption callback function with the standard DRM interface; and

configuring a key acquisition mechanism, wherein a configuration content comprises trigger conditions for key requests and updates, namely, a validity period of the key, a content access count, or a user authorization status.

16 . The computer device according to claim 13 , wherein the acquiring encryption information corresponding to the current audio segment, extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment comprises:

acquiring a protection scheme sinf box information box of an MP4 file, and extracting encryption parameters, wherein the encryption parameters comprise a key, an initialization vector IV and an encryption flag or extension of the target audio stream platform;

using, based on a key storage mechanism, a trusted execution environment to protect the key from unauthorized access, and periodically updating, according to a key rotation strategy, a decryption key; and

calling a decryption function of the standard DRM interface, and passing in the key and encrypted data for decryption processing.

17 . The computer device according to claim 13 , wherein the buffering, based on the adaptive buffering strategy, the updated audio stream in the preset buffer, and outputting the final audio stream comprises:

allocating a memory of a fixed size as a first buffer;

configuring a write pointer for writing new data and a read pointer for playing the data;

resetting, when the corresponding pointer reaches an end of the first buffer, to a starting position to form a loop to enable a ring buffer to adaptively process continuous audio streams; and/or,

creating a second buffer and a third buffer of the same size, wherein the second buffer is used for playing a current audio stream, and the third buffer is used for decrypting a next batch of audio streams; and

immediately switching, when a playback of the second buffer is completed, to the decrypted third buffer for playback, starting decrypting a new audio stream in the second buffer that has just finished the playback at the same time to use the two buffers to alternately perform decryption and playback operations to achieve parallel processing;

wherein during the parallel processing, a mutex is used to protect read-write operations of the corresponding buffer, and a condition variable is used to notify relevant threads when a state of the corresponding buffer changes to ensure correct synchronization of the decryption and the playback; the first buffer, the second buffer, and the third buffer all dynamically adjust a number of pre-buffered segments according to an adaptive buffering strategy to achieve a corresponding buffer with a variable size to adapt to segment characteristics of different platforms.

18 . The computer device according to claim 13 , further comprising:

meeting, based on a multi-level optimization strategy, real-time playback requirements in high concurrency scenarios, the multi-level optimization strategy comprising:

processing decryption operations of a plurality of audio segments under a plurality of decryption threads in parallel via a thread pool, and balancing, based on a work-stealing algorithm, a load of each decryption thread;

predicting, according to a user's playback behavior prediction, downloading and decrypting subsequent audio segments in advance, and storing the audio segments in a preset buffer, optimizing, according to network conditions, loading of audio segments by adjusting a pre-fetching amount by means of an adaptive pre-fetching strategy; and/or,

handling, based on a preset error handling strategy, abnormal situations occurring during the decryption process, the handling operations comprising:

retrying, based on an exponential backoff algorithm, when the network is abnormal;

adopting a degradation strategy when the network abnormality continues to exceed a fault threshold;

separately executing a retry mechanism on audio segments for which decryption has failed, and implementing a partial decryption strategy to allow playback to continue in the case of partial content decryption failure; and

periodically saving, based on a checkpoint mechanism, a current decryption state as a checkpoint, and automatically restoring, when a system crash is detected, from a most recent checkpoint.

19 . The computer device according to claim 13 , further comprising:

preventing, based on a multi-level security strategy, illegal access, the multi-level security strategy comprising:

performing obfuscation operations on a current code using code obfuscation tools to increase difficulty of reverse engineering and virtualizing to protect key algorithms;

starting an integrity checking mechanism when decryption runs, the integrity checking mechanism comprising regularly calculating a hash value of key code modules and comparing a currently calculated hash value with an expected hash value to ensure code integrity and prevent code tampering; and

dynamically generating, based on device characteristics and runtime environment, encryption keys through a key derivation function.

20 . A non-transitory computer-readable storage medium having stored thereon a computer program, wherein when the computer program is executed by a processor, the computer implementing adaptive decryption of audio streams performs the following steps:

acquiring a Moving Picture Experts Group (MPEG)-Dynamic Adaptive Streaming over HyperText Transfer Protocol (DASH) manifest file and parsing the MPEG-DASH manifest file to extract audio segment information for adaptive segment recognition of standard and non-standard audio segment modes;

initializing a standard Digital Rights Management (DRM) interface and integrating the DRM interface with a target audio stream platform to adapt an MPEG-DASH protocol-based audio stream to an audio segment mode of the target audio stream platform;

performing feature extraction on the audio segment information in the identified audio segment mode, and dynamically adjusting segment requests and processing logic for adaptive segment downloading and preprocessing;

acquiring encryption information corresponding to a current audio segment, extracting encryption parameters to identify encryption flags of the target audio stream platform, and selecting, according to the encryption flags, corresponding decryption algorithms to decrypt the current audio segment; and

performing audio frame reconstruction on the decrypted data to form an updated audio stream to ensure compatibility with an original unencrypted audio stream, and buffering, based on an adaptive buffering strategy, an updated audio stream in a preset buffer, and outputting a final audio stream to ensure audio stream continuity while achieving efficient parallel processing of decryption and playback.