Audio playback control method, device and electronic equipment
View Patent ↗This specification embodiments discloses an audio playback control method, device and electronic equipment, which can make audio playback more stable, reduce lagging rate and frequent acceleration and deceleration, and the like, while ensuring that the delay is not degraded. The method comprises: receiving an audio data packet sent by a sender through a target network and caching it to a jitter buffer to wait for a player to play; estimating a target delay of the target network based on an inter-arrival time IAT of the audio data packet sent by the sender; determining a target playback strategy of the player for the audio data playback, based on the target delay of the target network and an actual cached data amount of the jitter buffer; obtaining an audio data from the jitter buffer and playing through the player, based on the target playback strategy.
1 . A method of audio playback control, comprising:
receiving an audio data packet sent by a sender through a network and caching the audio data packet to a jitter buffer to wait for a player to play;
estimating a delay of the network in a first historical time period based on an inter-arrival time (IAT) of audio data packets received by the jitter buffer in the first historical time period, wherein the first historical time period is a historical time period before a current moment, and the estimating the delay of the network in the first historical time period based on the IAT of the audio data packets comprises:
computing a plurality of estimated delays based on a plurality of predetermined delay estimation algorithms and the IAT of the audio data packets received by the jitter buffer during the first historical time period, and
determining the delay of the network in the first historical time period based on a maximum value among the plurality of estimated delays;
determining a playback strategy of the player to perform playback of audio data at the current moment based on the delay of the network in the first historical time period and an actual cached data amount in the jitter buffer in the first historical time period, wherein the playback strategy comprises controlling the player to accelerate or decelerate the playback of the audio data; and
obtaining audio data from the jitter buffer and playing the audio data through the player based on the playback strategy.
2 . The method of claim 1 , wherein determining the playback strategy of the player comprises:
determining change information of cached data in the jitter buffer in the first historical time period periodically based on the actual cached data amount in the jitter buffer in the first historical time period;
if the actual cached data amount, the change information of cached data and the delay in the first historical time period satisfy a predetermined acceleration condition, determining that the playback strategy comprises accelerated playback;
wherein, the predetermined acceleration condition comprises anyone of the following:
the actual cached data amount in the first historical time period being greater than a predetermined maximum cached data amount in the jitter buffer; or
the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than a predetermined change amount, a duration of the actual cached data amount in the first historical time period being continually greater than a first predetermined maximum data amount exceeding a first predetermined duration, and the duration of the actual cached data amount in the first historical time period being continually greater than a second predetermined maximum data amount exceeds a second predetermined duration, wherein the second predetermined duration is greater than the first predetermined duration, determining both of the first predetermined maximum data amount and the second predetermined maximum data amount based on a target-delay in the first historical time period, and the first predetermined maximum data amount is greater than a target delay of the first historical time period, the second predetermined maximum data amount being greater than the first predetermined maximum data amount; or
the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than the predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than the first predetermined maximum data amount exceeding a third predetermined duration, the third predetermined duration being greater than the first predetermined duration.
3 . The method of claim 2 , wherein the target-playback strategy further comprises a target acceleration rate;
determining the playback strategy of the player further comprising:
if the actual cached data amount in the first historical time period is greater than a predetermined maximum cached data amount in the jitter buffer, determining the target acceleration rate as a first acceleration rate;
if the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than a predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than a first predetermined maximum data amount exceeding a predetermined duration, and a duration of the actual cached data amount in the first historical time period being continually greater than a second predetermined maximum data amount exceeding a second predetermined duration, determining the target acceleration rate as a second acceleration rate, the second acceleration rate being less than the first acceleration rate; and
if the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than the predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than the first predetermined maximum data amount exceeding a third predetermined duration, determining the target acceleration rate as a third acceleration rate, the third acceleration rate being less than the second acceleration rate.
4 . The method of claim 1 , wherein determining the playback strategy of the player comprises;
determining change information of cached data in the jitter buffer in the first historical time period periodically based on the actual cached data amount in the jitter buffer in the first historical time period;
if the actual cached data amount, change information of cached data and the delay in the first historical time period satisfy a predetermined deceleration condition, determining that the playback strategy comprises decelerated playback;
wherein, the predetermined deceleration condition comprises anyone of the following:
the actual cached data amount in the first historical time period continually increasing for a fourth predetermined duration, an increased data amount being less than or equal to the predetermined change amount, and an interval duration between the current decision moment and a last moment of determining to take the decelerated playback exceeds a fifth predetermined duration; or
the actual cached data amount in the first historical time period increasing, an increased data amount being less than or equal to the predetermined change amount, and an actual cached data amount in the first historical time period is less than a first minimum data amount threshold, the first minimum data amount threshold being three-quarters of a delay in the first historical time period; or
the actual cached data amount in the first historical time period increasing, an increased data amount being less than or equal to the predetermined change amount, and an actual cached data amount in the first historical time period is less than a second minimum data amount threshold, the second minimum data amount threshold being one-half of a delay in the first historical time period.
5 . The method of claim 1 , wherein determining the playback strategy of the player comprises:
if the actual cached data amount in the jitter buffer in the first historical time period is less than or equal to a delay in the first historical time period, determining that the playback strategy is packet loss compensation.
6 . The method of claim 5 , wherein, after determining the playback strategy, the method further comprises:
determining the data amount to be compensated based on the actual cached data amount and the delay in the first historical time period; and
adjusting the delay in the first historical time period based on the data amount to be compensated and the actual cached data amount in the first historical time period.
7 . The method of claim 6 , wherein adjusting the delay in the first historical time period based on a data amount to be compensated and the actual cached data amount in the first historical time period, comprises:
if the data amount to be compensated exceeds a first predetermined compensation data amount and the actual cached data amount in the first historical time period is greater than the data amount to be compensated, determining whether packet loss occurs in the jitter buffer in the first historical time period;
if the packet loss occurs in the jitter buffer in the first historical time period, reducing the delay.
8 . The method of claim 6 , wherein adjusting the delay in the first historical time period comprises:
if the data amount to be compensated exceeds the a predetermined compensation data amount and the actual cached data amount in the first historical time period is less than or equal to the data amount to be compensated, determining a maximum value of a delay in the first historical time period and a second predetermined compensation data amount as a new delay, wherein the second predetermined compensation data amount is greater than the first predetermined compensation data amount.
9 . The method of claim 1 , wherein the plurality of predetermined delay estimation algorithms comprises a probability histogram calculation method, a disordered histogram calculation method, and a peak calculation method.
10 . The method of claim 1 , further comprising:
if the maximum value is greater than a delay in a second historical time period, determining whether packet loss occurs in the jitter buffer in the first historical time period, to obtain a packet loss detection result, wherein the second historical time period comprises a historical time period prior to a last decision moment; and
determining the delay of the first historical time period, based on the packet loss detection result, the maximum value, and the actual cached data amount in the first historical time period.
11 . The method of claim 10 , wherein determining the delay in the first historical time period based on the packet loss detection result, the maximum value and the actual cached data amount in the first historical time period, comprising:
if packet loss occurs in the jitter buffer in the first historical time period, determining the maximum value as a delay in the first historical time period;
if no packet loss occurs in the jitter buffer in the first historical time period, determining a product of the maximum value and a predetermined coefficient as a delay of the first historical time period, the predetermined coefficient being a value greater than 0 and less than 1; and
if the actual cached data amount in the first historical time period is greater than or equal to the maximum value, determining a minimum value of the actual cached data amount in the first historical time period and the maximum value as the delay in the historical time period.
12 . The method of claim 1 , further comprising:
if the maximum value is less than or equal to a delay of a second historical time period, determining the delay in the first historical time period, based on the delay in the second historical time period, the interval time between a last decision moment and the current moment, and predetermined delay decreases rate, wherein the second historical time period comprises a historical time period prior to a last decision moment.
13 . An electronic device, comprising:
a processor; and
a memory disposed to store computer-executable instructions that, in response to being executed, cause the processor to perform operations comprising:
receiving an audio data packet sent by a sender through a network and cache the audio data packet in a jitter buffer to wait for a player to play;
estimating a delay of the network in a first historical time period based on an inter-arrival time (IAT) of audio data packets received by the jitter buffer in the first historical time period, wherein the first historical time period is a historical time period before a current moment, and the estimating the delay of the network in the first historical time period based on the IAT of the audio data packets comprises:
computing a plurality of estimated delays based on a plurality of predetermined delay estimation algorithms and the IAT of the audio data packets received by the jitter buffer during the first historical time period, and
determining the delay of the network in the first historical time period based on a maximum value among the plurality of estimated delays;
determining a playback strategy of the player to perform playback of audio data at the current moment based on the delay of the network in the first historical time period and an actual cached data amount in the jitter buffer in the first historical time period, wherein the playback strategy comprises controlling the player to accelerate or decelerate the playback of the audio data; and
based on the playback strategy, obtaining audio data from the jitter buffer and playing the audio data through the player.
14 . The electronic device of claim 13 , wherein determining the playback strategy of the player comprises:
determining change information of cached data in the jitter buffer in the first historical time period periodically based on the actual cached data amount in the jitter buffer in the first historical time period;
if the actual cached data amount, the change information of cached data and the delay in the first historical time period satisfy a predetermined acceleration condition, determining that the playback strategy comprises accelerated playback;
wherein the predetermined acceleration condition comprises any one of:
the actual cached data amount in the first historical time period being greater than a predetermined maximum cached data amount in the jitter buffer; or
the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than a predetermined change amount, a duration of the actual cached data amount in the first historical time period being continually greater than a first predetermined maximum data amount exceeding a first predetermined duration, and the duration of the actual cached data amount in the first historical time period being continually greater than a second predetermined maximum data amount exceeds a second predetermined duration, wherein the second predetermined duration is greater than the first predetermined duration, determining both of the first predetermined maximum data amount and the second predetermined maximum data amount based on a delay in the first historical time period, and the first predetermined maximum data amount is greater than a delay of the first historical time period, the second predetermined maximum data amount being greater than the first predetermined maximum data amount; or
the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than the predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than the first predetermined maximum data amount exceeding a third predetermined duration, the third predetermined duration being greater than the first predetermined duration.
15 . The electronic device of claim 14 , wherein the playback strategy further comprises a target acceleration rate, and wherein the operations playback strategy of the player further comprise:
if the actual cached data amount in the first historical time period is greater than a predetermined maximum cached data amount in the jitter buffer, determining the target acceleration rate as a first acceleration rate;
if the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than a predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than a first predetermined maximum data amount exceeding a predetermined duration, and a duration of the actual cached data amount in the first historical time period being continually greater than a second predetermined maximum data amount exceeding a second predetermined duration, determining the target acceleration rate as a second acceleration rate, the second acceleration rate being less than the first acceleration rate; and
if the actual cached data amount in the first historical time period reduces, a reduced data amount being greater than the predetermined change amount, the duration of the actual cached data amount in the first historical time period being continually greater than the first predetermined maximum data amount exceeding a third predetermined duration, determining the target acceleration rate as a third acceleration rate, the third acceleration rate being less than the second acceleration rate.
16 . The electronic device of claim 13 , wherein determining the playback strategy of the player comprises:
determining change information of cached data in the jitter buffer in the first historical time period periodically based on the actual cached data amount in the jitter buffer in the first historical time period;
if the actual cached data amount, change information of cached data and the delay in the first historical time period satisfy a predetermined deceleration condition, determining that the playback strategy comprises decelerated playback;
wherein the predetermined deceleration condition comprises: the actual cached data amount in the first historical time period continually increasing for a fourth predetermined duration, an increased data amount being less than or equal to the predetermined change amount, and an interval duration between the current decision moment and a last moment of determining to take the decelerated playback exceeds a fifth predetermined duration; or
the actual cached data amount in the first historical time period increasing, an increased data amount being less than or equal to the predetermined change amount, and an actual cached data amount in the first historical time period is less than a first minimum data amount threshold, the first minimum data amount threshold being three-quarters of a delay in the first historical time period; or
the actual cached data amount in the first historical time period increasing, an increased data amount being less than or equal to the predetermined change amount, and an actual cached data amount in the first historical time period is less than a second minimum data amount threshold, the second minimum data amount threshold being one-half of a delay in the first historical time period.
17 . The electronic device of claim 13 , wherein the playback strategy of the player comprises:
if the actual cached data amount in the jitter buffer in the first historical time period is less than or equal to a delay in the first historical time period, determining that the playback strategy is packet loss compensation.
18 . The electronic device of claim 17 , wherein, after determining the playback strategy, the operations further comprise:
determining the data amount to be compensated based on the actual cached data amount and the delay in the first historical time period; and
adjusting the delay in the first historical time period based on the data amount to be compensated and the actual cached data amount in the first historical time period.
19 . A non-transitory computer-readable storage medium, wherein the computer-readable storage medium stores one or more programs, and in response to the one or more programs being executed by a terminal device comprising a plurality of application programs, cause the terminal device performs operations comprising:
receiving an audio data packet sent by a sender through a network and cache the audio data packet to a jitter buffer to wait for a player to play;
estimating a delay of the network in a first historical time period based on an inter-arrival time (IAT) of audio data packets received by the jitter buffer in the first historical time period, wherein the first historical time period is a historical time period before a current moment, and the estimating the delay of the network in the first historical time period based on the IAT of the audio data packets comprises:
computing a plurality of estimated delays based on a plurality of predetermined delay estimation algorithms and the IAT of the audio data packets received by the jitter buffer during the first historical time period, and
determining the delay of the network in the first historical time period based on a maximum value among the plurality of estimated delays;
determining a playback strategy of the player to perform playback of audio data at the current moment based on the delay of the network in the first historical time period and an actual cached data amount in the jitter buffer in the first historical time period, wherein the playback strategy comprises controlling the player to accelerate or decelerate the playback of the audio data; and
based on the playback strategy, obtaining audio data from the jitter buffer and playing the audio data through the player.