WO2017124904A1 - 一种音频播放方法及装置 - Google Patents

一种音频播放方法及装置 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
Legal status (The legal status 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 status listed.)
Ceased
Application number
PCT/CN2016/113252
Other languages
English (en)
French (fr)
Inventor
张龙华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Guangzhou Shirui Electronics Co Ltd
Original Assignee
Guangzhou Shirui Electronics Co Ltd
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 Guangzhou Shirui Electronics Co Ltd filed Critical Guangzhou Shirui Electronics Co Ltd
Publication of WO2017124904A1 publication Critical patent/WO2017124904A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

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

本发明公开了一种音频播放方法,包括:接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。相应的,本发明还公开了一种音频播放装置。采用本发明实施例,能够提高音频播放的流畅性。

Description

一种音频播放方法及装置 技术领域
本发明涉及网络技术领域,尤其涉及一种音频播放方法及装置。
背景技术
在广域网下,理想情况下的音频互动通信为,发送端发送数据包的间隔等于接收端接收数据包的间隔,接收端在接收到数据包后直接解码播放即可。但现实情况中,由于数据包采用UDP(User Datagram Protocol,用户数据报协议)传输,而在广域网下,UDP传输会存在乱序、丢包的情况,而且每一个数据包到达接收端的时间也可能会有不同的延迟,从而导致接收端接收到数据包的间隔是不固定的。如果网络变好,则接收端接收数据包的间隔变小,此时接收端能对数据包进行正常解码播放;如果网络变差,接收端接收数据包的间隔变大,数据的解码播放必然会出现等待,使得播放不连贯,从而导致接收端接收数据时快时慢,数据失真严重的问题产生。
发明内容
本发明实施例提出一种音频播放方法及装置,能够提高音频播放的流畅性。
本发明实施例提供一种音频播放方法,包括:
接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;
按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
进一步地,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:
检测所述第一缓冲区中缓存的音频数据包的个数;
若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;
若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所 述第三速度大于所述第一速度。
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。
进一步地,所述音频播放方法还包括:
在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;
若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;
在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
相应地,本发明还提供了一种音频播放装置,包括:
缓存模块,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
检测模块,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,
播放模块,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
进一步地,所述检测模块具体包括:
检测单元,用于检测所述第一缓冲区中缓存的音频数据包的个数;
第一调整单元,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;
第二调整单元,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
第三调整单元,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据 包的下一个音频数据包。
进一步地,所述音频播放装置还包括:
循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;
缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,
重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
实施本发明实施例,具有如下有益效果:
本发明实施例提供的音频播放方法及装置,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。
而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。
附图说明
图1是本发明提供的音频播放方法的一个实施例的流程示意图;
图2是本发明提供的音频播放方法中步骤S2的一个实施例的流程示意图;
图3是本发明提供的音频播放装置的一个实施例的结构示意图;
图4是本发明提供的音频播放装置中检测模块的一个实施例的结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例, 都属于本发明保护的范围。
参见图1,本发明提供的音频播放方法的一个实施例的流程示意图,包括:
S1、接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
S2、检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;
S3、按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
需要说明的是,在程序运行开始时,会初始化一个缓冲区,将接收到的音频数据包都缓存在该缓冲区中进行排队。在缓存区存满后,即缓存区中缓存的音频数据包达到其容量后,开始按照缓存的先后顺序,从缓存区中读取音频数据包进行解码并播放。同时,在解码播放过程中,对实时检测缓存区中缓存的音频数据包的个数,并根据音频数据包的个数来实时调整解码速度,以根据该解码速度对音频数据包进行解码播放。根据不同的网络情况来实时调整解码速度,以保证音频播放的流畅性,同时提高用户体验度。
进一步地,如图2所示,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:
S21、检测所述第一缓冲区中缓存的音频数据包的个数;
S22、若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;
S23、若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
S24、若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。
需要说明的是,由于网络的不稳定性,接收音频数据包的速度时快时慢,从而根据第一缓冲区中缓存的音频数据包的个数来判断网络情况。若音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则说明网络情况正常,按照第一速度,即解码的正常速度来进行解码播放即可;若音频数据包的个数小于预设的第一阈值,则说明网络情况较差,需对音频数据包进行减速解码播放,从而将解码速度调整为第二速度;若音频数据包的个数大于预设的第二阈值,则说明网络情况较好,需对音频数据包进行加速解码播放,从而将解码速度调整为第三速度。
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据 包的下一个音频数据包。
例如,每个音频数据包的播放时长为10ms。其中,第一速度为每隔10ms即对第一缓冲区中的音频数据包进行读取并解码播放。第二速度为每播放完一个10ms音频数据包后休眠10ms,再读取第一缓冲区中的音频数据包进行解码播放,使用户听到的语速减慢,从而达到减速的目的。第三速度为每播放完一个10ms音频数据包后,丢弃第一缓冲区中的一个10ms音频数据包,同时读取第一缓冲区中被丢弃的音频数据包的下一个10ms音频数据包,使用户听到的语速加快,从而达到加速的目的。
进一步地,所述音频播放方法还包括:
在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;
若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;
在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
需要说明的是,在音频数据包开始减速解码播放时,开始计时,若在计时的时长达到预设的时长阈值,如5s时,解码速度无法恢复正常速度,即音频数据包仍处于减速解码状态,则说明网络情况极差,会先暂停解码操作,并将第一缓冲区的容量进行扩充,一般对缓冲区的容量进行加倍扩充,从而使第一缓冲区扩大为第二缓冲区,并在等到第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,再重新启动解码操作,若重新进行解码操作后,还会出现解码速度无法恢复正常速度的情况,则继续对第二缓冲区的容量进行扩充。若在计时的时长达到预设的时长阈值之前,解码速度恢复正常速度,则说明网络情况好转,按照正常速度对音频数据包进行解码即可。
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
例如,每个音频数据包的播放时长为10ms,第一缓冲区可缓存10个音频数据包,则第二阈值设置为10,而第一阈值设置为5。若第一缓冲区中缓存的音频数据包的个数维持在5至10个,则说明网络状况正常,对音频数据包进行正常解码播放即可;若第一缓冲区中缓存的音频数据包的个数低于5个,则说明网络状况较差,存在一定延时,需对音频数据包进行减速解码播放;若第一缓冲区中缓存的音频数据包的个数超过10个,则说明网络状况较好,需对音频数据包进行加速解码播放。其中,减速解码播放的时长达到5s时,对第一缓冲区扩 充为第二缓冲区,使第二缓冲区能够缓存20个音频数据包,即第三阈值设置为20,并暂停解码操作,等待音频数据包的接收。在第二缓冲区中缓存的音频数据包的个数达到20时,再按照正常速度重新读取第二缓冲区中的音频数据包进行解码播放。
本发明实施例提供的音频播放方法,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。
相应的,本发明还提供一种音频播放装置,能够实现上述实施例中的音频播放方法的所有流程。
参见图3,是本发明提供的音频播放装置的一个实施例的结构示意图,包括:
缓存模块1,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
检测模块2,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,
播放模块3,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
进一步地,所述检测模块2具体包括:
检测单元21,用于检测所述第一缓冲区中缓存的音频数据包的个数;
第一调整单元22,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;
第二调整单元23,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
第三调整单元24,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。
优选地,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。
进一步地,所述音频播放装置还包括:
循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测 所述解码速度是否仍为所述第二速度;
缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,
重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
优选地,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
本发明实施例提供的音频播放装置,能够将接收到的音频数据包进行缓存,并根据缓存的音频数据包的个数来实时调整解码播放的速度,以适应不同的网络情况,保证音频播放的流畅性,同时提高用户体验度。而且,在网络情况好时,加速解码播放缓存区内的音频数据包,在网络情况差时,减速解码播放缓存区内的音频数据包,以能最快恢复正常解码播放的速度,提高音频播放的流畅性;在网络情况极差时,扩大缓冲区的容量,以便在缓存更多的音频数据包后再进行解码播放,提高用户体验度。
以上所述是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也视为本发明的保护范围。

Claims (10)

  1. 一种音频播放方法,其特征在于,包括:
    接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
    检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;
    按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
  2. 如权利要求1所述的音频播放方法,其特征在于,所述检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度,具体包括:
    检测所述第一缓冲区中缓存的音频数据包的个数;
    若所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值,则将所述解码速度调整为第一速度;
    若所述音频数据包的个数小于预设的第一阈值,则将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
    若所述音频数据包的个数大于预设的第二阈值,则将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。
  3. 如权利要求2所述的音频播放方法,其特征在于,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。
  4. 如权利要求2或3所述的音频播放方法,其特征在于,所述音频播放方法还包括:
    在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;
    若是,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;
    在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
  5. 如权利要求4所述的音频播放方法,其特征在于,所述第二阈值为所述第一缓冲区中 可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
  6. 一种音频播放装置,其特征在于,包括:
    缓存模块,用于接收音频数据包,并将所述音频数据包缓存到第一缓冲区中;
    检测模块,用于检测所述第一缓冲区中缓存的音频数据包的个数,并根据所述音频数据包的个数实时调整解码速度;以及,
    播放模块,用于按照所述解码速度从所述第一缓冲区中读取音频数据包进行解码播放。
  7. 如权利要求6所述的音频播放装置,其特征在于,所述检测模块具体包括:
    检测单元,用于检测所述第一缓冲区中缓存的音频数据包的个数;
    第一调整单元,用于在所述音频数据包的个数大于预设的第一阈值且小于预设的第二阈值时,将所述解码速度调整为第一速度;
    第二调整单元,用于在所述音频数据包的个数小于预设的第一阈值时,将所述解码速度调整为第二速度;所述第二速度小于所述第一速度;
    第三调整单元,用于在所述音频数据包的个数大于预设的第二阈值时,将所述播放速度调整为第三速度;所述第三速度大于所述第一速度。
  8. 如权利要求7所述的音频播放装置,其特征在于,所述第一速度表示为每播放完一个音频数据包即解码下一个音频数据包;所述第二速度表示为每播放完一个音频数据包并休眠预设时长后解码下一个音频数据包;所述第三速度表示为每播放完一个音频数据包并丢弃下一个音频数据包后,解码被丢弃的音频数据包的下一个音频数据包。
  9. 如权利要求7或8所述的音频播放装置,其特征在于,所述音频播放装置还包括:
    循环检测模块,用于在将所述解码速度调整为所述第二速度时,开始计时,并循环检测所述解码速度是否仍为所述第二速度;
    缓冲区扩大模块,用于若循环检测所述解码速度仍为所述第二速度,则在计时的时长达到预设的时长阈值时,暂停解码操作,并将所述第一缓冲区扩大为第二缓冲区,以缓存接收到的音频数据包;以及,
    重新播放模块,用于在检测到所述第二缓冲区中缓存的音频数据包的个数达到预设的第三阈值时,按照所述第一速度重新从所述第二缓冲区中读取音频数据包进行解码播放。
  10. 如权利要求9所述的音频播放装置,其特征在于,所述第二阈值为所述第一缓冲区中可缓存的音频数据包的个数,所述第一阈值为所述第一缓冲区中可缓存的音频数据包的个数的一半,所述第三阈值为所述第二缓冲区中可缓存的音频数据包的个数。
PCT/CN2016/113252 2016-01-22 2016-12-29 一种音频播放方法及装置 Ceased WO2017124904A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610046305.5A CN105704554A (zh) 2016-01-22 2016-01-22 一种音频播放方法及装置
CN201610046305.5 2016-01-22

Publications (1)

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

Family

ID=56229276

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/113252 Ceased WO2017124904A1 (zh) 2016-01-22 2016-12-29 一种音频播放方法及装置

Country Status (2)

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

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736796A (zh) * 2020-05-15 2020-10-02 深圳市战音科技有限公司 实时流数据处理方法、装置、设备和存储介质
CN112398912A (zh) * 2020-10-26 2021-02-23 北京佳讯飞鸿电气股份有限公司 一种语音信号加速方法、装置、计算机设备及存储介质
CN114339406A (zh) * 2022-01-27 2022-04-12 重庆紫光华山智安科技有限公司 送解码速度调整方法、系统、设备及介质
CN114416013A (zh) * 2022-01-04 2022-04-29 深圳Tcl新技术有限公司 数据发送方法、装置、电子设备及计算机可读存储介质

Families Citing this family (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105704554A (zh) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 一种音频播放方法及装置
CN110072125A (zh) * 2018-01-23 2019-07-30 北京大学 视频播放方法及装置
CN108495177B (zh) * 2018-03-30 2021-07-13 北京世纪好未来教育科技有限公司 一种音频变速处理方法及装置
CN110661992A (zh) * 2018-06-29 2020-01-07 视联动力信息技术股份有限公司 数据处理方法和装置
CN109918038B (zh) * 2019-01-14 2022-08-12 珠海慧联科技有限公司 一种音频播放速度同步方法及系统
CN110634511B (zh) * 2019-09-27 2021-09-14 北京西山居互动娱乐科技有限公司 一种音频数据处理方法及装置
CN110677715B (zh) * 2019-10-11 2022-04-22 北京达佳互联信息技术有限公司 一种解码方法、解码器、电子设备及存储介质
CN110798458B (zh) * 2019-10-22 2022-05-06 潍坊歌尔微电子有限公司 数据同步方法、装置、设备及计算机可读存储介质
CN111540349B (zh) * 2020-03-27 2023-10-10 北京捷通华声科技股份有限公司 一种语音的打断方法和装置
CN111586529A (zh) * 2020-05-08 2020-08-25 北京三体云联科技有限公司 音频数据处理方法、装置、终端和计算机可读存储介质
CN112601109A (zh) * 2020-11-30 2021-04-02 海信视像科技股份有限公司 音频播放方法及显示设备
CN112911376A (zh) * 2021-02-01 2021-06-04 华录智达科技股份有限公司 一种基于实时视频播放流畅的播放方法
CN112948296A (zh) * 2021-02-24 2021-06-11 合肥宏晶微电子科技股份有限公司 传输音频数据的方法、电子设备、计算机可读存储介质
CN115038002B (zh) * 2022-05-26 2025-06-24 恒玄科技(上海)股份有限公司 一种蓝牙音频的播放方法、存储介质以及真无线耳机
CN115002420A (zh) * 2022-06-06 2022-09-02 武汉市芯中芯科技有限公司 一种ipc设备回放视频播放控制系统及方法
CN118609610B (zh) * 2024-08-07 2024-11-15 深圳市飞易通科技有限公司 音频播放的调频方法及电子设备

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1497933A (zh) * 2002-09-30 2004-05-19 ������������ʽ���� 网络电话机以及声音解码装置
CN102271280A (zh) * 2011-07-20 2011-12-07 宝利微电子系统控股公司 一种数字音视频变速播放的方法和装置
JP2014011749A (ja) * 2012-07-02 2014-01-20 Hitachi Ltd 音声信号受信装置、揺らぎ吸収バッファ制御方法、音声信号再生システム
CN103905897A (zh) * 2014-04-23 2014-07-02 无锡天脉聚源传媒科技有限公司 一种视频播放装置及其播放方法
CN104584466A (zh) * 2012-08-29 2015-04-29 大陆汽车有限责任公司 以降低的速度播放媒体数据
CN105704554A (zh) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 一种音频播放方法及装置

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1464685A (zh) * 2002-06-13 2003-12-31 优创科技(深圳)有限公司 一种在网络终端缓冲区中处理音频流回放的方法
US7647614B2 (en) * 2004-06-07 2010-01-12 Sling Media, Inc. Fast-start streaming and buffering of streaming content for personal media player
CN101583025B (zh) * 2009-06-11 2011-05-11 中兴通讯股份有限公司 一种流媒体播放方法及装置
CN101662676B (zh) * 2009-09-30 2011-09-28 四川长虹电器股份有限公司 流媒体缓冲的处理方法
CN102665131A (zh) * 2012-04-27 2012-09-12 山东省计算中心 一种网络视频服务系统接收端的视频缓冲方法
CN104639977B (zh) * 2015-02-05 2018-05-08 小米科技有限责任公司 节目播放的方法及装置

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1497933A (zh) * 2002-09-30 2004-05-19 ������������ʽ���� 网络电话机以及声音解码装置
CN102271280A (zh) * 2011-07-20 2011-12-07 宝利微电子系统控股公司 一种数字音视频变速播放的方法和装置
JP2014011749A (ja) * 2012-07-02 2014-01-20 Hitachi Ltd 音声信号受信装置、揺らぎ吸収バッファ制御方法、音声信号再生システム
CN104584466A (zh) * 2012-08-29 2015-04-29 大陆汽车有限责任公司 以降低的速度播放媒体数据
CN103905897A (zh) * 2014-04-23 2014-07-02 无锡天脉聚源传媒科技有限公司 一种视频播放装置及其播放方法
CN105704554A (zh) * 2016-01-22 2016-06-22 广州视睿电子科技有限公司 一种音频播放方法及装置

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111736796A (zh) * 2020-05-15 2020-10-02 深圳市战音科技有限公司 实时流数据处理方法、装置、设备和存储介质
CN112398912A (zh) * 2020-10-26 2021-02-23 北京佳讯飞鸿电气股份有限公司 一种语音信号加速方法、装置、计算机设备及存储介质
CN112398912B (zh) * 2020-10-26 2024-02-27 北京佳讯飞鸿电气股份有限公司 一种语音信号加速方法、装置、计算机设备及存储介质
CN114416013A (zh) * 2022-01-04 2022-04-29 深圳Tcl新技术有限公司 数据发送方法、装置、电子设备及计算机可读存储介质
CN114339406A (zh) * 2022-01-27 2022-04-12 重庆紫光华山智安科技有限公司 送解码速度调整方法、系统、设备及介质
CN114339406B (zh) * 2022-01-27 2023-01-24 重庆紫光华山智安科技有限公司 送解码速度调整方法、系统、设备及介质

Also Published As

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

Similar Documents

Publication Publication Date Title
WO2017124904A1 (zh) 一种音频播放方法及装置
CA2682800C (en) Method and apparatus for modifying playback timing of talkspurts within a sentence without affecting intelligibility
CN105812902A (zh) 数据播放的方法、设备及系统
CN103839558B (zh) 同步播放方法及服务器、播放器
CN103051955B (zh) 流媒体播放方法及装置
CN105992025B (zh) 基于音频同步播放的系统时间校准方法、音频同步播放方法及装置
WO2016015670A1 (zh) 一种音频流解码方法及装置
WO2016041445A1 (zh) 一种音频同步播放的方法、装置和系统
WO2011038565A1 (zh) 一种流媒体音视频同步方法及系统
JP2007511939A (ja) 時間順に並んだコンテンツを含むパケットに対するスムーズな適応型管理を受信端末において提供する方法及び装置
CN108540855B (zh) 一种适用于网络直播场景下的自适应低延时流媒体播放方法
TW201644239A (zh) 用於控制語音品質的方法和裝置
EP3440828A1 (en) Streaming synchronized media content to separate devices
CN113162812A (zh) 语音处理方法、直播的语音播放方法、装置、设备及系统
JP2024513707A5 (zh)
CN111556467B (zh) 一种手机互联音频播放处理方法
CN109327724B (zh) 音视频同步播放方法和装置
CN103716650B (zh) 服务器装置和信息处理方法
CN101702711B (zh) 播放数据的方法和终端
CN107087210A (zh) 基于缓存时间判断视频播放状态的方法及终端
CN101917412A (zh) 一种提高流媒体连接缓冲速度的方法及客户端
FR2848049B1 (fr) Procede de traitement de paquets de donnees recus sur des reseaux asynchrones, et dispositif pour la mise en oeuvre du procede
CN120980256A (zh) 一种直播音频传输方法、装置、设备、存储介质及产品
JP2006133698A (ja) 復号装置
CN112511886B (zh) 一种基于音频伸缩的音视频同步播放方法

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