WO2017124904A1 - Audio playing method and device - Google Patents

Audio playing method and device Download PDF

Info

Publication number
WO2017124904A1
WO2017124904A1 PCT/CN2016/113252 CN2016113252W WO2017124904A1 WO 2017124904 A1 WO2017124904 A1 WO 2017124904A1 CN 2016113252 W CN2016113252 W CN 2016113252W WO 2017124904 A1 WO2017124904 A1 WO 2017124904A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio data
speed
buffer
decoding
data packet
Prior art date
Application number
PCT/CN2016/113252
Other languages
French (fr)
Chinese (zh)
Inventor
张龙华
Original Assignee
广州视睿电子科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 广州视睿电子科技有限公司 filed Critical 广州视睿电子科技有限公司
Publication of WO2017124904A1 publication Critical patent/WO2017124904A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • H04N21/4392Processing of audio elementary streams involving audio buffer management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/439Processing of audio elementary streams
    • H04N21/4398Processing of audio elementary streams involving reformatting operations of audio signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/442Monitoring of processes or resources, e.g. detecting the failure of a recording device, monitoring the downstream bandwidth, the number of times a movie has been viewed, the storage space available from the internal hard disk
    • H04N21/44204Monitoring of content usage, e.g. the number of times a movie has been viewed, copied or the amount which has been watched

Definitions

  • the present invention relates to the field of network technologies, and in particular, to an audio playing method and apparatus.
  • the ideal audio interactive communication is that the interval at which the transmitting end sends the data packet is equal to the interval at which the receiving end receives the data packet, and the receiving end directly decodes and plays the data packet after receiving the data packet.
  • UDP User Datagram Protocol
  • UDP transmission may be out of order and packet loss, and the time when each data packet arrives at the receiving end may also be There will be different delays, so that the interval at which the receiving end receives the data packet is not fixed. If the network becomes better, the interval at which the receiving end receives the data packet becomes smaller.
  • the receiving end can normally decode and play the data packet; if the network is degraded, the interval at which the receiving end receives the data packet becomes larger, and the decoding and playback of the data is inevitable. Waiting occurs, making the playback inconsistent, resulting in a problem that the receiving end receives data quickly and slowly, and the data distortion is serious.
  • the embodiment of the invention provides an audio playing method and device, which can improve the smoothness of audio playing.
  • An embodiment of the present invention provides an audio playing method, including:
  • the audio data packet is read from the first buffer at the decoding speed for decoding playback.
  • the detecting the number of the audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets specifically includes:
  • the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated.
  • the third speed is represented as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded.
  • the audio playing method further includes:
  • the decoding operation is suspended, and the first buffer is expanded into a second buffer to buffer the received audio data packet;
  • the second threshold is the number of audio data packets that can be buffered in the first buffer
  • the first threshold is half of the number of audio data packets that can be buffered in the first buffer
  • the third threshold is the number of audio data packets that can be buffered in the second buffer.
  • an audio playback device including:
  • a cache module configured to receive an audio data packet, and cache the audio data packet into a first buffer
  • a detecting module configured to detect a number of audio data packets buffered in the first buffer, and adjust a decoding speed in real time according to the number of the audio data packets
  • a playing module configured to read the audio data packet from the first buffer according to the decoding speed for decoding and playing.
  • the detecting module specifically includes:
  • a detecting unit configured to detect the number of audio data packets buffered in the first buffer
  • a first adjusting unit configured to adjust the decoding speed to a first speed when the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold;
  • a second adjusting unit configured to adjust the decoding speed to a second speed when the number of the audio data packets is less than a preset first threshold; the second speed is smaller than the first speed;
  • the third adjusting unit is configured to adjust the playing speed to a third speed when the number of the audio data packets is greater than a preset second threshold; the third speed is greater than the first speed.
  • the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated.
  • the third speed is expressed as decoding the discarded audio data after each audio data packet is played and the next audio data packet is discarded. The next audio packet of the package.
  • the audio playback device further includes:
  • a loop detection module configured to start timing when the decoding speed is adjusted to the second speed, and cyclically detect whether the decoding speed is still the second speed;
  • a buffer expansion module configured to: if the decoding speed is still the second speed, if the time period of the timer reaches a preset duration threshold, pause the decoding operation, and expand the first buffer to the first buffer Two buffers to buffer the received audio packets; and,
  • a replay module configured to re-read from the second buffer according to the first speed when detecting that the number of audio data packets buffered in the second buffer reaches a preset third threshold The audio data packet is decoded and played.
  • the second threshold is the number of audio data packets that can be buffered in the first buffer
  • the first threshold is half of the number of audio data packets that can be buffered in the first buffer
  • the third threshold is the number of audio data packets that can be buffered in the second buffer.
  • the audio playing method and device provided by the embodiments of the present invention can buffer the received audio data packet, and adjust the speed of decoding and playing in real time according to the number of buffered audio data packets to adapt to different network conditions and ensure audio.
  • the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved.
  • the fluency when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.
  • FIG. 1 is a schematic flow chart of an embodiment of an audio playing method provided by the present invention.
  • step S2 is a schematic flow chart of an embodiment of step S2 in the audio playing method provided by the present invention
  • FIG. 3 is a schematic structural diagram of an embodiment of an audio playback device provided by the present invention.
  • FIG. 4 is a schematic structural diagram of an embodiment of a detection module in an audio playback device provided by the present invention.
  • a schematic flowchart of an embodiment of an audio playing method provided by the present invention includes:
  • a buffer is initialized, and the received audio data packets are cached in the buffer for queuing.
  • the buffer area is full, that is, after the audio data packets buffered in the buffer area reach their capacity, the audio data packets are read from the buffer area for decoding and playing according to the order of the cache.
  • the number of audio data packets buffered in the buffer area is detected in real time, and the decoding speed is adjusted in real time according to the number of audio data packets, so that the audio data packets are decoded and played according to the decoding speed.
  • the decoding speed is adjusted in real time according to different network conditions to ensure the smoothness of audio playback and improve user experience.
  • the detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets specifically includes:
  • the speed of receiving the audio data packet is fast and slow, so that the network condition is determined according to the number of audio data packets buffered in the first buffer. If the number of the audio data packets is greater than the preset first threshold and less than the preset second threshold, the network condition is normal, and the decoding is performed according to the first speed, that is, the normal speed of decoding; if the audio data packet If the number is less than the preset first threshold, the network condition is poor, and the audio data packet needs to be decelerated and decoded, so that the decoding speed is adjusted to the second speed; if the number of audio data packets is greater than the preset number The second threshold indicates that the network condition is good, and the audio data packet needs to be acceleratedly decoded and played, thereby adjusting the decoding speed to the third speed.
  • the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated.
  • the third speed is expressed as decoding the discarded audio data after each audio data packet is played and the next audio data packet is discarded. The next audio packet of the package.
  • the playback time of each audio packet is 10ms.
  • the first speed is to read and decode the audio data packet in the first buffer every 10 ms.
  • the second speed is 10 ms after each 10 ms audio data packet is played, and then the audio data packet in the first buffer is read and played, so that the speech rate heard by the user is slowed down, thereby achieving the purpose of deceleration.
  • the third speed is that after a 10ms audio data packet is played, one 10ms audio data packet in the first buffer is discarded, and the next 10ms audio data packet of the discarded audio data packet in the first buffer is read, so that the next 10ms audio data packet is discarded.
  • the speed of speech that the user hears is accelerated, thereby achieving the purpose of acceleration.
  • the audio playing method further includes:
  • the decoding operation is suspended, and the first buffer is expanded into a second buffer to buffer the received audio data packet;
  • the timing starts. If the duration of the timing reaches the preset duration threshold, such as 5s, the decoding speed cannot be restored to the normal speed, that is, the audio data packet is still in the deceleration decoding state. , indicating that the network situation is very poor, will first suspend the decoding operation, and expand the capacity of the first buffer, generally double the capacity of the buffer, thereby expanding the first buffer to the second buffer, and Wait until the number of audio data buffers buffered in the second buffer reaches the preset third threshold, and then restart the decoding operation. If the decoding speed cannot be restored to normal speed after the decoding operation is performed, continue. Expand the capacity of the second buffer. If the decoding speed returns to the normal speed before the timer duration reaches the preset duration threshold, the network condition is improved, and the audio data packet can be decoded according to the normal speed.
  • the preset duration threshold such as 5s
  • the second threshold is the number of audio data packets that can be buffered in the first buffer
  • the first threshold is half of the number of audio data packets that can be buffered in the first buffer
  • the third threshold is the number of audio data packets that can be buffered in the second buffer.
  • each audio data packet has a play duration of 10 ms, and the first buffer can buffer 10 audio data packets, then the second threshold is set to 10, and the first threshold is set to 5. If the number of audio data packets buffered in the first buffer is maintained at 5 to 10, the network condition is normal, and the audio data packet is normally decoded and played; if the audio data packet is buffered in the first buffer If the number is less than 5, the network condition is poor, there is a certain delay, and the audio data packet needs to be decelerated and decoded. If the number of audio data packets buffered in the first buffer exceeds 10, the network is described. The situation is better, and the audio data packet needs to be acceleratedly decoded and played.
  • the first buffer is expanded.
  • the second buffer is buffered so that the second buffer can buffer 20 audio data packets, that is, the third threshold is set to 20, and the decoding operation is suspended, waiting for the reception of the audio data packet.
  • the audio data packets in the second buffer are re-read at normal speed for decoding and playing.
  • the audio playing method provided by the embodiment of the invention can buffer the received audio data packet, and adjust the speed of decoding and playing in real time according to the number of buffered audio data packets, so as to adapt to different network conditions and ensure audio playback. Fluency while improving user experience. Moreover, when the network condition is good, the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved. The fluency; when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.
  • the present invention also provides an audio playback device capable of implementing all the processes of the audio playback method in the above embodiments.
  • FIG. 3 is a schematic structural diagram of an embodiment of an audio playback device provided by the present invention, including:
  • a cache module 1 configured to receive an audio data packet and buffer the audio data packet into a first buffer
  • the detecting module 2 is configured to detect the number of audio data packets buffered in the first buffer, and adjust the decoding speed in real time according to the number of the audio data packets;
  • the playing module 3 is configured to read the audio data packet from the first buffer according to the decoding speed for decoding and playing.
  • the detecting module 2 specifically includes:
  • the detecting unit 21 is configured to detect the number of audio data packets buffered in the first buffer.
  • the first adjusting unit 22 is configured to adjust the decoding speed to a first speed when the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold;
  • the second adjusting unit 23 is configured to adjust the decoding speed to a second speed when the number of the audio data packets is less than a preset first threshold; the second speed is smaller than the first speed;
  • the third adjusting unit 24 is configured to adjust the playing speed to a third speed when the number of the audio data packets is greater than a preset second threshold; the third speed is greater than the first speed.
  • the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated.
  • the third speed is represented as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded.
  • the audio playback device further includes:
  • a loop detection module configured to start timing when the decoding speed is adjusted to the second speed, and cycle detection Whether the decoding speed is still the second speed
  • a buffer expansion module configured to: if the decoding speed is still the second speed, if the time period of the timer reaches a preset duration threshold, pause the decoding operation, and expand the first buffer to the first buffer Two buffers to buffer the received audio packets; and,
  • a replay module configured to re-read from the second buffer according to the first speed when detecting that the number of audio data packets buffered in the second buffer reaches a preset third threshold The audio data packet is decoded and played.
  • the second threshold is the number of audio data packets that can be buffered in the first buffer
  • the first threshold is half of the number of audio data packets that can be buffered in the first buffer
  • the third threshold is the number of audio data packets that can be buffered in the second buffer.
  • the audio playing device can buffer the received audio data packet, and adjust the speed of the decoding and playing in real time according to the number of the buffered audio data packets, so as to adapt to different network conditions and ensure audio playback. Fluency while improving user experience. Moreover, when the network condition is good, the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved. The fluency; when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Databases & Information Systems (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed in the present invention is an audio playing method, comprising: receiving an audio data packet, and buffering the audio data packet into a first buffer area; determining the number of the audio data packet buffered in the first buffer area, and adjusting a decoding speed in real time according to the number of the audio data packet; reading the audio data packet from the first buffer area at the decoding speed for decoding and playing. Correspondingly, also disclosed is an audio playing device. The embodiments of the present invention can improve the fluency of audio playing.

Description

一种音频播放方法及装置Audio playing method and device 技术领域Technical field
本发明涉及网络技术领域,尤其涉及一种音频播放方法及装置。The present invention relates to the field of network technologies, and in particular, to an audio playing method and apparatus.
背景技术Background technique
在广域网下,理想情况下的音频互动通信为,发送端发送数据包的间隔等于接收端接收数据包的间隔,接收端在接收到数据包后直接解码播放即可。但现实情况中,由于数据包采用UDP(User Datagram Protocol,用户数据报协议)传输,而在广域网下,UDP传输会存在乱序、丢包的情况,而且每一个数据包到达接收端的时间也可能会有不同的延迟,从而导致接收端接收到数据包的间隔是不固定的。如果网络变好,则接收端接收数据包的间隔变小,此时接收端能对数据包进行正常解码播放;如果网络变差,接收端接收数据包的间隔变大,数据的解码播放必然会出现等待,使得播放不连贯,从而导致接收端接收数据时快时慢,数据失真严重的问题产生。Under the wide area network, the ideal audio interactive communication is that the interval at which the transmitting end sends the data packet is equal to the interval at which the receiving end receives the data packet, and the receiving end directly decodes and plays the data packet after receiving the data packet. However, in reality, since the data packet is transmitted by UDP (User Datagram Protocol), under the wide area network, UDP transmission may be out of order and packet loss, and the time when each data packet arrives at the receiving end may also be There will be different delays, so that the interval at which the receiving end receives the data packet is not fixed. If the network becomes better, the interval at which the receiving end receives the data packet becomes smaller. At this time, the receiving end can normally decode and play the data packet; if the network is degraded, the interval at which the receiving end receives the data packet becomes larger, and the decoding and playback of the data is inevitable. Waiting occurs, making the playback inconsistent, resulting in a problem that the receiving end receives data quickly and slowly, and the data distortion is serious.
发明内容Summary of the invention
本发明实施例提出一种音频播放方法及装置,能够提高音频播放的流畅性。The embodiment of the invention provides an audio playing method and device, which can improve the smoothness of audio playing.
本发明实施例提供一种音频播放方法,包括:An embodiment of the present invention provides an audio playing method, including:
接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;Receiving an audio data packet and buffering the audio data packet into a first buffer;
检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;Detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets;
按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。The audio data packet is read from the first buffer at the decoding speed for decoding playback.
进一步地,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:Further, the detecting the number of the audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets, specifically includes:
检测所述第一缓冲区中缓存的音频数据包的个数;Detecting the number of audio data packets buffered in the first buffer;
若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;If the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold, adjusting the decoding speed to a first speed;
若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;If the number of the audio data packets is less than a preset first threshold, adjusting the decoding speed to a second speed; the second speed is less than the first speed;
若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所 述第三速度大于所述第一速度。If the number of the audio data packets is greater than a preset second threshold, adjusting the playback speed to a third speed; The third speed is greater than the first speed.
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。Preferably, the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated. The third speed is represented as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded.
进一步地,所述音频播放方法还包括:Further, the audio playing method further includes:
在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;When the decoding speed is adjusted to the second speed, timing is started, and it is cyclically detected whether the decoding speed is still the second speed;
若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;If yes, when the duration of the timing reaches a preset duration threshold, the decoding operation is suspended, and the first buffer is expanded into a second buffer to buffer the received audio data packet;
在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。After detecting that the number of the audio data packets buffered in the second buffer reaches a preset third threshold, reading the audio data packet from the second buffer to perform decoding and playing according to the first speed. .
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。Preferably, the second threshold is the number of audio data packets that can be buffered in the first buffer, and the first threshold is half of the number of audio data packets that can be buffered in the first buffer. The third threshold is the number of audio data packets that can be buffered in the second buffer.
相应地,本发明还提供了一种音频播放装置,包括:Accordingly, the present invention also provides an audio playback device, including:
缓存模块,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;a cache module, configured to receive an audio data packet, and cache the audio data packet into a first buffer;
检测模块,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,a detecting module, configured to detect a number of audio data packets buffered in the first buffer, and adjust a decoding speed in real time according to the number of the audio data packets; and
播放模块,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。And a playing module, configured to read the audio data packet from the first buffer according to the decoding speed for decoding and playing.
进一步地,所述检测模块具体包括:Further, the detecting module specifically includes:
检测单元,用于检测所述第一缓冲区中缓存的音频数据包的个数;a detecting unit, configured to detect the number of audio data packets buffered in the first buffer;
第一调整单元,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;a first adjusting unit, configured to adjust the decoding speed to a first speed when the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold;
第二调整单元,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;a second adjusting unit, configured to adjust the decoding speed to a second speed when the number of the audio data packets is less than a preset first threshold; the second speed is smaller than the first speed;
第三调整单元,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。The third adjusting unit is configured to adjust the playing speed to a third speed when the number of the audio data packets is greater than a preset second threshold; the third speed is greater than the first speed.
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据 包的下一个音频数据包。Preferably, the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated. The third speed is expressed as decoding the discarded audio data after each audio data packet is played and the next audio data packet is discarded. The next audio packet of the package.
进一步地,所述音频播放装置还包括:Further, the audio playback device further includes:
循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;a loop detection module, configured to start timing when the decoding speed is adjusted to the second speed, and cyclically detect whether the decoding speed is still the second speed;
缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,a buffer expansion module, configured to: if the decoding speed is still the second speed, if the time period of the timer reaches a preset duration threshold, pause the decoding operation, and expand the first buffer to the first buffer Two buffers to buffer the received audio packets; and,
重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。a replay module, configured to re-read from the second buffer according to the first speed when detecting that the number of audio data packets buffered in the second buffer reaches a preset third threshold The audio data packet is decoded and played.
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。Preferably, the second threshold is the number of audio data packets that can be buffered in the first buffer, and the first threshold is half of the number of audio data packets that can be buffered in the first buffer. The third threshold is the number of audio data packets that can be buffered in the second buffer.
实施本发明实施例,具有如下有益效果:Embodiments of the present invention have the following beneficial effects:
本发明实施例提供的音频播放方法及装置,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。The audio playing method and device provided by the embodiments of the present invention can buffer the received audio data packet, and adjust the speed of decoding and playing in real time according to the number of buffered audio data packets to adapt to different network conditions and ensure audio. The smoothness of playback while improving the user experience.
而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。Moreover, when the network condition is good, the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved. The fluency; when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.
附图说明DRAWINGS
图1是本发明提供的音频播放方法的一个实施例的流程示意图;1 is a schematic flow chart of an embodiment of an audio playing method provided by the present invention;
图2是本发明提供的音频播放方法中步骤S2的一个实施例的流程示意图;2 is a schematic flow chart of an embodiment of step S2 in the audio playing method provided by the present invention;
图3是本发明提供的音频播放装置的一个实施例的结构示意图;3 is a schematic structural diagram of an embodiment of an audio playback device provided by the present invention;
图4是本发明提供的音频播放装置中检测模块的一个实施例的结构示意图。4 is a schematic structural diagram of an embodiment of a detection module in an audio playback device provided by the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts, All fall within the scope of protection of the present invention.
参见图1,本发明提供的音频播放方法的一个实施例的流程示意图,包括:Referring to FIG. 1 , a schematic flowchart of an embodiment of an audio playing method provided by the present invention includes:
S1、接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;S1. Receive an audio data packet, and buffer the audio data packet into a first buffer.
S2、检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;S2, detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets;
S3、按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。S3. Read an audio data packet from the first buffer according to the decoding speed for decoding and playing.
需要说明的是,在程序运行开始时,会初始化一个缓冲区,将接收到的音频数据包都缓存在该缓冲区中进行排队。在缓存区存满后,即缓存区中缓存的音频数据包达到其容量后,开始按照缓存的先后顺序,从缓存区中读取音频数据包进行解码并播放。同时,在解码播放过程中,对实时检测缓存区中缓存的音频数据包的个数,并根据音频数据包的个数来实时调整解码速度,以根据该解码速度对音频数据包进行解码播放。根据不同的网络情况来实时调整解码速度,以保证音频播放的流畅性,同时提高用户体验度。It should be noted that at the beginning of the program run, a buffer is initialized, and the received audio data packets are cached in the buffer for queuing. After the buffer area is full, that is, after the audio data packets buffered in the buffer area reach their capacity, the audio data packets are read from the buffer area for decoding and playing according to the order of the cache. At the same time, in the decoding and playing process, the number of audio data packets buffered in the buffer area is detected in real time, and the decoding speed is adjusted in real time according to the number of audio data packets, so that the audio data packets are decoded and played according to the decoding speed. The decoding speed is adjusted in real time according to different network conditions to ensure the smoothness of audio playback and improve user experience.
进一步地,如图2所示,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:Further, as shown in FIG. 2, the detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets, specifically includes:
S21、检测所述第一缓冲区中缓存的音频数据包的个数;S21. Detect the number of audio data packets buffered in the first buffer.
S22、若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;S22, if the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold, adjusting the decoding speed to a first speed;
S23、若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;S23, if the number of the audio data packets is less than a preset first threshold, adjusting the decoding speed to a second speed; the second speed is smaller than the first speed;
S24、若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。S24. If the number of the audio data packets is greater than a preset second threshold, adjust the playing speed to a third speed; the third speed is greater than the first speed.
需要说明的是,由于网络的不稳定性,接收音频数据包的速度时快时慢,从而根据第一缓冲区中缓存的音频数据包的个数来判断网络情况。若音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则说明网络情况正常,按照第一速度,即解码的正常速度来进行解码播放即可;若音频数据包的个数小于预设的第一阈值,则说明网络情况较差,需对音频数据包进行减速解码播放,从而将解码速度调整为第二速度;若音频数据包的个数大于预设的第二阈值,则说明网络情况较好,需对音频数据包进行加速解码播放,从而将解码速度调整为第三速度。It should be noted that due to the instability of the network, the speed of receiving the audio data packet is fast and slow, so that the network condition is determined according to the number of audio data packets buffered in the first buffer. If the number of the audio data packets is greater than the preset first threshold and less than the preset second threshold, the network condition is normal, and the decoding is performed according to the first speed, that is, the normal speed of decoding; if the audio data packet If the number is less than the preset first threshold, the network condition is poor, and the audio data packet needs to be decelerated and decoded, so that the decoding speed is adjusted to the second speed; if the number of audio data packets is greater than the preset number The second threshold indicates that the network condition is good, and the audio data packet needs to be acceleratedly decoded and played, thereby adjusting the decoding speed to the third speed.
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据 包的下一个音频数据包。Preferably, the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated. The third speed is expressed as decoding the discarded audio data after each audio data packet is played and the next audio data packet is discarded. The next audio packet of the package.
例如,每个音频数据包的播放时长为10ms。其中,第一速度为每隔10ms即对第一缓冲区中的音频数据包进行读取并解码播放。第二速度为每播放完一个10ms音频数据包后休眠10ms,再读取第一缓冲区中的音频数据包进行解码播放,使用户听到的语速减慢,从而达到减速的目的。第三速度为每播放完一个10ms音频数据包后,丢弃第一缓冲区中的一个10ms音频数据包,同时读取第一缓冲区中被丢弃的音频数据包的下一个10ms音频数据包,使用户听到的语速加快,从而达到加速的目的。For example, the playback time of each audio packet is 10ms. The first speed is to read and decode the audio data packet in the first buffer every 10 ms. The second speed is 10 ms after each 10 ms audio data packet is played, and then the audio data packet in the first buffer is read and played, so that the speech rate heard by the user is slowed down, thereby achieving the purpose of deceleration. The third speed is that after a 10ms audio data packet is played, one 10ms audio data packet in the first buffer is discarded, and the next 10ms audio data packet of the discarded audio data packet in the first buffer is read, so that the next 10ms audio data packet is discarded. The speed of speech that the user hears is accelerated, thereby achieving the purpose of acceleration.
进一步地,所述音频播放方法还包括:Further, the audio playing method further includes:
在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;When the decoding speed is adjusted to the second speed, timing is started, and it is cyclically detected whether the decoding speed is still the second speed;
若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;If yes, when the duration of the timing reaches a preset duration threshold, the decoding operation is suspended, and the first buffer is expanded into a second buffer to buffer the received audio data packet;
在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。After detecting that the number of the audio data packets buffered in the second buffer reaches a preset third threshold, reading the audio data packet from the second buffer to perform decoding and playing according to the first speed. .
需要说明的是,在音频数据包开始减速解码播放时,开始计时,若在计时的时长达到预设的时长阈值,如5s时,解码速度无法恢复正常速度,即音频数据包仍处于减速解码状态,则说明网络情况极差,会先暂停解码操作,并将第一缓冲区的容量进行扩充,一般对缓冲区的容量进行加倍扩充,从而使第一缓冲区扩大为第二缓冲区,并在等到第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,再重新启动解码操作,若重新进行解码操作后,还会出现解码速度无法恢复正常速度的情况,则继续对第二缓冲区的容量进行扩充。若在计时的时长达到预设的时长阈值之前,解码速度恢复正常速度,则说明网络情况好转,按照正常速度对音频数据包进行解码即可。It should be noted that when the audio data packet starts to decelerate and decode, the timing starts. If the duration of the timing reaches the preset duration threshold, such as 5s, the decoding speed cannot be restored to the normal speed, that is, the audio data packet is still in the deceleration decoding state. , indicating that the network situation is very poor, will first suspend the decoding operation, and expand the capacity of the first buffer, generally double the capacity of the buffer, thereby expanding the first buffer to the second buffer, and Wait until the number of audio data buffers buffered in the second buffer reaches the preset third threshold, and then restart the decoding operation. If the decoding speed cannot be restored to normal speed after the decoding operation is performed, continue. Expand the capacity of the second buffer. If the decoding speed returns to the normal speed before the timer duration reaches the preset duration threshold, the network condition is improved, and the audio data packet can be decoded according to the normal speed.
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。Preferably, the second threshold is the number of audio data packets that can be buffered in the first buffer, and the first threshold is half of the number of audio data packets that can be buffered in the first buffer. The third threshold is the number of audio data packets that can be buffered in the second buffer.
例如,每个音频数据包的播放时长为10ms,第一缓冲区可缓存10个音频数据包,则第二阈值设置为10,而第一阈值设置为5。若第一缓冲区中缓存的音频数据包的个数维持在5至10个,则说明网络状况正常,对音频数据包进行正常解码播放即可;若第一缓冲区中缓存的音频数据包的个数低于5个,则说明网络状况较差,存在一定延时,需对音频数据包进行减速解码播放;若第一缓冲区中缓存的音频数据包的个数超过10个,则说明网络状况较好,需对音频数据包进行加速解码播放。其中,减速解码播放的时长达到5s时,对第一缓冲区扩 充为第二缓冲区,使第二缓冲区能够缓存20个音频数据包,即第三阈值设置为20,并暂停解码操作,等待音频数据包的接收。在第二缓冲区中缓存的音频数据包的个数达到20时,再按照正常速度重新读取第二缓冲区中的音频数据包进行解码播放。For example, each audio data packet has a play duration of 10 ms, and the first buffer can buffer 10 audio data packets, then the second threshold is set to 10, and the first threshold is set to 5. If the number of audio data packets buffered in the first buffer is maintained at 5 to 10, the network condition is normal, and the audio data packet is normally decoded and played; if the audio data packet is buffered in the first buffer If the number is less than 5, the network condition is poor, there is a certain delay, and the audio data packet needs to be decelerated and decoded. If the number of audio data packets buffered in the first buffer exceeds 10, the network is described. The situation is better, and the audio data packet needs to be acceleratedly decoded and played. Wherein, when the duration of the deceleration decoding play reaches 5 s, the first buffer is expanded. The second buffer is buffered so that the second buffer can buffer 20 audio data packets, that is, the third threshold is set to 20, and the decoding operation is suspended, waiting for the reception of the audio data packet. When the number of audio data packets buffered in the second buffer reaches 20, the audio data packets in the second buffer are re-read at normal speed for decoding and playing.
本发明实施例提供的音频播放方法,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。The audio playing method provided by the embodiment of the invention can buffer the received audio data packet, and adjust the speed of decoding and playing in real time according to the number of buffered audio data packets, so as to adapt to different network conditions and ensure audio playback. Fluency while improving user experience. Moreover, when the network condition is good, the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved. The fluency; when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.
相应的,本发明还提供一种音频播放装置,能够实现上述实施例中的音频播放方法的所有流程。Correspondingly, the present invention also provides an audio playback device capable of implementing all the processes of the audio playback method in the above embodiments.
参见图3,是本发明提供的音频播放装置的一个实施例的结构示意图,包括:3 is a schematic structural diagram of an embodiment of an audio playback device provided by the present invention, including:
缓存模块1,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;a cache module 1 configured to receive an audio data packet and buffer the audio data packet into a first buffer;
检测模块2,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,The detecting module 2 is configured to detect the number of audio data packets buffered in the first buffer, and adjust the decoding speed in real time according to the number of the audio data packets; and
播放模块3,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。The playing module 3 is configured to read the audio data packet from the first buffer according to the decoding speed for decoding and playing.
进一步地,所述检测模块2具体包括:Further, the detecting module 2 specifically includes:
检测单元21,用于检测所述第一缓冲区中缓存的音频数据包的个数;The detecting unit 21 is configured to detect the number of audio data packets buffered in the first buffer.
第一调整单元22,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;The first adjusting unit 22 is configured to adjust the decoding speed to a first speed when the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold;
第二调整单元23,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;The second adjusting unit 23 is configured to adjust the decoding speed to a second speed when the number of the audio data packets is less than a preset first threshold; the second speed is smaller than the first speed;
第三调整单元24,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。The third adjusting unit 24 is configured to adjust the playing speed to a third speed when the number of the audio data packets is greater than a preset second threshold; the third speed is greater than the first speed.
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。Preferably, the first speed is expressed as decoding the next audio data packet after each audio data packet is played; the second speed is expressed as decoding the next audio data after each audio data packet is played and the preset duration is hibernated. The third speed is represented as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded.
进一步地,所述音频播放装置还包括:Further, the audio playback device further includes:
循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测 所述解码速度是否仍为所述第二速度;a loop detection module, configured to start timing when the decoding speed is adjusted to the second speed, and cycle detection Whether the decoding speed is still the second speed;
缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,a buffer expansion module, configured to: if the decoding speed is still the second speed, if the time period of the timer reaches a preset duration threshold, pause the decoding operation, and expand the first buffer to the first buffer Two buffers to buffer the received audio packets; and,
重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。a replay module, configured to re-read from the second buffer according to the first speed when detecting that the number of audio data packets buffered in the second buffer reaches a preset third threshold The audio data packet is decoded and played.
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。Preferably, the second threshold is the number of audio data packets that can be buffered in the first buffer, and the first threshold is half of the number of audio data packets that can be buffered in the first buffer. The third threshold is the number of audio data packets that can be buffered in the second buffer.
本发明实施例提供的音频播放装置,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。The audio playing device provided by the embodiment of the invention can buffer the received audio data packet, and adjust the speed of the decoding and playing in real time according to the number of the buffered audio data packets, so as to adapt to different network conditions and ensure audio playback. Fluency while improving user experience. Moreover, when the network condition is good, the audio data packet in the playback buffer area is accelerated, and when the network condition is poor, the audio data packet in the playback buffer area is decelerated and decoded, so that the speed of normal decoding playback can be restored as soon as possible, and the audio playback is improved. The fluency; when the network situation is very poor, expand the buffer capacity, in order to cache more audio data packets before decoding and playback, improve user experience.
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。 The above is a preferred embodiment of the present invention, and it should be noted that those skilled in the art can also make several improvements and retouchings without departing from the principles of the present invention. It is the scope of protection of the present invention.

Claims (10)

  1. 一种音频播放方法,其特征在于,包括:An audio playing method, comprising:
    接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;Receiving an audio data packet and buffering the audio data packet into a first buffer;
    检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;Detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets;
    按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。The audio data packet is read from the first buffer at the decoding speed for decoding playback.
  2. 如权利要求1所述的音频播放方法,其特征在于,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:The audio playing method according to claim 1, wherein the detecting the number of audio data packets buffered in the first buffer, and adjusting the decoding speed in real time according to the number of the audio data packets, include:
    检测所述第一缓冲区中缓存的音频数据包的个数;Detecting the number of audio data packets buffered in the first buffer;
    若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;If the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold, adjusting the decoding speed to a first speed;
    若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;If the number of the audio data packets is less than a preset first threshold, adjusting the decoding speed to a second speed; the second speed is less than the first speed;
    若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。And if the number of the audio data packets is greater than a preset second threshold, adjusting the playing speed to a third speed; the third speed is greater than the first speed.
  3. 如权利要求2所述的音频播放方法,其特征在于,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。The audio playing method according to claim 2, wherein said first speed is expressed as decoding the next audio data packet every time an audio data packet is played; said second speed is expressed as each audio data is played back Decoding and decoding the next audio data packet after sleeping for a preset duration; the third speed is expressed as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded. .
  4. 如权利要求2或3所述的音频播放方法,其特征在于,所述音频播放方法还包括:The audio playing method according to claim 2 or 3, wherein the audio playing method further comprises:
    在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;When the decoding speed is adjusted to the second speed, timing is started, and it is cyclically detected whether the decoding speed is still the second speed;
    若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;If yes, when the duration of the timing reaches a preset duration threshold, the decoding operation is suspended, and the first buffer is expanded into a second buffer to buffer the received audio data packet;
    在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。After detecting that the number of the audio data packets buffered in the second buffer reaches a preset third threshold, reading the audio data packet from the second buffer to perform decoding and playing according to the first speed. .
  5. 如权利要求4所述的音频播放方法,其特征在于,所述第二阈值为所述第一缓冲区中 可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。The audio playing method according to claim 4, wherein said second threshold is said first buffer a number of bufferable audio data packets, the first threshold being half of the number of audio data packets that can be buffered in the first buffer, the third threshold being cacheable in the second buffer The number of audio packets.
  6. 一种音频播放装置,其特征在于,包括:An audio playback device, comprising:
    缓存模块,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;a cache module, configured to receive an audio data packet, and cache the audio data packet into a first buffer;
    检测模块,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,a detecting module, configured to detect a number of audio data packets buffered in the first buffer, and adjust a decoding speed in real time according to the number of the audio data packets; and
    播放模块,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。And a playing module, configured to read the audio data packet from the first buffer according to the decoding speed for decoding and playing.
  7. 如权利要求6所述的音频播放装置,其特征在于,所述检测模块具体包括:The audio playback device of claim 6, wherein the detecting module comprises:
    检测单元,用于检测所述第一缓冲区中缓存的音频数据包的个数;a detecting unit, configured to detect the number of audio data packets buffered in the first buffer;
    第一调整单元,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;a first adjusting unit, configured to adjust the decoding speed to a first speed when the number of the audio data packets is greater than a preset first threshold and less than a preset second threshold;
    第二调整单元,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;a second adjusting unit, configured to adjust the decoding speed to a second speed when the number of the audio data packets is less than a preset first threshold; the second speed is smaller than the first speed;
    第三调整单元,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。The third adjusting unit is configured to adjust the playing speed to a third speed when the number of the audio data packets is greater than a preset second threshold; the third speed is greater than the first speed.
  8. 如权利要求7所述的音频播放装置,其特征在于,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。The audio playback device according to claim 7, wherein said first speed is expressed as decoding the next audio data packet every time an audio data packet is played; said second speed is expressed as each audio data being played back Decoding and decoding the next audio data packet after sleeping for a preset duration; the third speed is expressed as decoding the next audio data packet of the discarded audio data packet after each audio data packet is played and the next audio data packet is discarded. .
  9. 如权利要求7或8所述的音频播放装置,其特征在于,所述音频播放装置还包括:The audio playback device of claim 7 or 8, wherein the audio playback device further comprises:
    循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;a loop detection module, configured to start timing when the decoding speed is adjusted to the second speed, and cyclically detect whether the decoding speed is still the second speed;
    缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,a buffer expansion module, configured to: if the decoding speed is still the second speed, if the time period of the timer reaches a preset duration threshold, pause the decoding operation, and expand the first buffer to the first buffer Two buffers to buffer the received audio packets; and,
    重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。 a replay module, configured to re-read from the second buffer according to the first speed when detecting that the number of audio data packets buffered in the second buffer reaches a preset third threshold The audio data packet is decoded and played.
  10. 如权利要求9所述的音频播放装置,其特征在于,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。 The audio playback device of claim 9, wherein the second threshold is a number of bufferable audio data packets in the first buffer, and the first threshold is the first buffer One half of the number of audio data packets that can be buffered, and the third threshold is the number of audio data packets that can be buffered in the second buffer.
PCT/CN2016/113252 2016-01-22 2016-12-29 Audio playing method and device WO2017124904A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610046305.5A CN105704554A (en) 2016-01-22 2016-01-22 Audio play method and device
CN201610046305.5 2016-01-22

Publications (1)

Publication Number Publication Date
WO2017124904A1 true WO2017124904A1 (en) 2017-07-27

Family

ID=56229276

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113252 WO2017124904A1 (en) 2016-01-22 2016-12-29 Audio playing method and device

Country Status (2)

Country Link
CN (1) CN105704554A (en)
WO (1) WO2017124904A1 (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736796A (en) * 2020-05-15 2020-10-02 深圳市战音科技有限公司 Real-time stream data processing method, device, equipment and storage medium
CN112398912A (en) * 2020-10-26 2021-02-23 北京佳讯飞鸿电气股份有限公司 Voice signal acceleration method and device, computer equipment and storage medium
CN114339406A (en) * 2022-01-27 2022-04-12 重庆紫光华山智安科技有限公司 Method, system, device and medium for adjusting decoding speed
CN114416013A (en) * 2022-01-04 2022-04-29 深圳Tcl新技术有限公司 Data transmission method, data transmission device, electronic equipment and computer-readable storage medium

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105704554A (en) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 Audio play method and device
CN110072125A (en) * 2018-01-23 2019-07-30 北京大学 Video broadcasting method and device
CN108495177B (en) * 2018-03-30 2021-07-13 北京世纪好未来教育科技有限公司 Audio frequency speed change processing method and device
CN110661992A (en) * 2018-06-29 2020-01-07 视联动力信息技术股份有限公司 Data processing method and device
CN109918038B (en) * 2019-01-14 2022-08-12 珠海慧联科技有限公司 Audio playing speed synchronization method and system
CN110634511B (en) * 2019-09-27 2021-09-14 北京西山居互动娱乐科技有限公司 Audio data processing method and device
CN110677715B (en) * 2019-10-11 2022-04-22 北京达佳互联信息技术有限公司 Decoding method, decoder, electronic device and storage medium
CN110798458B (en) * 2019-10-22 2022-05-06 潍坊歌尔微电子有限公司 Data synchronization method, device, equipment and computer readable storage medium
CN111540349B (en) * 2020-03-27 2023-10-10 北京捷通华声科技股份有限公司 Voice breaking method and device
CN111586529A (en) * 2020-05-08 2020-08-25 北京三体云联科技有限公司 Audio data processing method, device, terminal and computer readable storage medium
CN112601109A (en) * 2020-11-30 2021-04-02 海信视像科技股份有限公司 Audio playing method and display device
CN112911376A (en) * 2021-02-01 2021-06-04 华录智达科技股份有限公司 Playing method based on real-time video playing fluency
CN112948296A (en) * 2021-02-24 2021-06-11 合肥宏晶微电子科技股份有限公司 Method for transmitting audio data, electronic device, and computer-readable storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1497933A (en) * 2002-09-30 2004-05-19 ������������ʽ���� Network telephone set and voice decoder
CN102271280A (en) * 2011-07-20 2011-12-07 宝利微电子系统控股公司 Method and apparatus for variable speed playing of digital audio and video
JP2014011749A (en) * 2012-07-02 2014-01-20 Hitachi Ltd Voice signal receiver, fluctuation absorption buffer control method, voice signal reproduction system
CN103905897A (en) * 2014-04-23 2014-07-02 无锡天脉聚源传媒科技有限公司 Video playing device and method thereof
CN104584466A (en) * 2012-08-29 2015-04-29 大陆汽车有限责任公司 Playback of media data at reduced speed
CN105704554A (en) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 Audio play method and device

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464685A (en) * 2002-06-13 2003-12-31 优创科技(深圳)有限公司 Method for processing acoustic frequency flow playback in network terminal buffer
KR20070085203A (en) * 2004-06-07 2007-08-27 슬링 미디어 인코퍼레이티드 Personal media broadcasting system
CN101583025B (en) * 2009-06-11 2011-05-11 中兴通讯股份有限公司 Streaming media playing method and device
CN101662676B (en) * 2009-09-30 2011-09-28 四川长虹电器股份有限公司 Processing method for streaming media buffer
CN102665131A (en) * 2012-04-27 2012-09-12 山东省计算中心 Video buffer method for receiving end of network video service system
CN104639977B (en) * 2015-02-05 2018-05-08 小米科技有限责任公司 The method and device that program plays

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1497933A (en) * 2002-09-30 2004-05-19 ������������ʽ���� Network telephone set and voice decoder
CN102271280A (en) * 2011-07-20 2011-12-07 宝利微电子系统控股公司 Method and apparatus for variable speed playing of digital audio and video
JP2014011749A (en) * 2012-07-02 2014-01-20 Hitachi Ltd Voice signal receiver, fluctuation absorption buffer control method, voice signal reproduction system
CN104584466A (en) * 2012-08-29 2015-04-29 大陆汽车有限责任公司 Playback of media data at reduced speed
CN103905897A (en) * 2014-04-23 2014-07-02 无锡天脉聚源传媒科技有限公司 Video playing device and method thereof
CN105704554A (en) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 Audio play method and device

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736796A (en) * 2020-05-15 2020-10-02 深圳市战音科技有限公司 Real-time stream data processing method, device, equipment and storage medium
CN112398912A (en) * 2020-10-26 2021-02-23 北京佳讯飞鸿电气股份有限公司 Voice signal acceleration method and device, computer equipment and storage medium
CN112398912B (en) * 2020-10-26 2024-02-27 北京佳讯飞鸿电气股份有限公司 Voice signal acceleration method and device, computer equipment and storage medium
CN114416013A (en) * 2022-01-04 2022-04-29 深圳Tcl新技术有限公司 Data transmission method, data transmission device, electronic equipment and computer-readable storage medium
CN114339406A (en) * 2022-01-27 2022-04-12 重庆紫光华山智安科技有限公司 Method, system, device and medium for adjusting decoding speed
CN114339406B (en) * 2022-01-27 2023-01-24 重庆紫光华山智安科技有限公司 Method, system, device and medium for adjusting decoding speed

Also Published As

Publication number Publication date
CN105704554A (en) 2016-06-22

Similar Documents

Publication Publication Date Title
WO2017124904A1 (en) Audio playing method and device
CA2682800C (en) Method and apparatus for modifying playback timing of talkspurts within a sentence without affecting intelligibility
CN103916716B (en) The code rate smoothing method of realtime video transmission under a kind of wireless network
CN103051955B (en) Flow media playing method and device
WO2016041445A1 (en) Audio synchronous playing method, device and system
US7870281B2 (en) Content playback device, content playback method, computer-readable storage medium, and content playback system
CN105992025B (en) System time calibration method, audio sync playback method and the device played based on audio sync
TW201735656A (en) Method for playback data and apparatus and system thereof
WO2011038565A1 (en) Streaming media audio-video synchronization method and system
JP2005269632A5 (en)
JP2007535258A (en) Method and apparatus for providing continuous adaptive control of a voice packet buffer at a receiving terminal
WO2010094234A1 (en) Audio/video data play control method and apparatus
CN102185835A (en) Real-time network signal playing method and device
TWI480861B (en) Method, apparatus, and system for controlling time-scaling of audio signal
TWI267307B (en) Timing synchronization module and method for synchronously playing media signal
CN108540855B (en) Self-adaptive low-delay streaming media playing method suitable for network live broadcast scene
WO2022150235A1 (en) Call audio playback speed adjustment
TW202029796A (en) Method for controlling audio device and associated control circuit
JP2017011336A (en) Audio apparatus and synchronized reproduction method
CN109327724B (en) Audio and video synchronous playing method and device
WO2017176728A1 (en) Streaming synchronized media content to separate devices
CN111556467B (en) Mobile phone interconnection audio playing processing method
WO2012013024A1 (en) Method and client for stream media connection buffer
FR2848049B1 (en) METHOD FOR PROCESSING DATA PACKETS RECEIVED ON ASYNCHRONOUS NETWORKS, AND DEVICE FOR IMPLEMENTING THE METHOD
CN112511886B (en) Audio and video synchronous playing method based on audio expansion and contraction

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16886163

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16886163

Country of ref document: EP

Kind code of ref document: A1