WO2024103961A1 - Low-delay playing method and apparatus, and electronic device and storage medium - Google Patents

Low-delay playing method and apparatus, and electronic device and storage medium Download PDF

Info

Publication number
WO2024103961A1
WO2024103961A1 PCT/CN2023/120692 CN2023120692W WO2024103961A1 WO 2024103961 A1 WO2024103961 A1 WO 2024103961A1 CN 2023120692 W CN2023120692 W CN 2023120692W WO 2024103961 A1 WO2024103961 A1 WO 2024103961A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
storage area
playback
time
audio
Prior art date
Application number
PCT/CN2023/120692
Other languages
French (fr)
Chinese (zh)
Inventor
侯锐填
Original Assignee
Oppo广东移动通信有限公司
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 Oppo广东移动通信有限公司 filed Critical Oppo广东移动通信有限公司
Publication of WO2024103961A1 publication Critical patent/WO2024103961A1/en

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R1/00Details of transducers, loudspeakers or microphones
    • H04R1/20Arrangements for obtaining desired frequency or directional characteristics
    • H04R1/22Arrangements for obtaining desired frequency or directional characteristics for obtaining desired frequency characteristic only 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04RLOUDSPEAKERS, MICROPHONES, GRAMOPHONE PICK-UPS OR LIKE ACOUSTIC ELECTROMECHANICAL TRANSDUCERS; DEAF-AID SETS; PUBLIC ADDRESS SYSTEMS
    • H04R3/00Circuits for transducers, loudspeakers or microphones
    • H04R3/12Circuits for transducers, loudspeakers or microphones for distributing signals to two or more loudspeakers

Definitions

  • the present application relates to the field of audio, and in particular to a low-latency playback method, device, electronic device and storage medium.
  • Embodiments of the present application provide a low-latency playback method, device, electronic device, and storage medium.
  • a low-latency playback method is provided, which is applied to an audio playback device, wherein the audio playback device includes a playback storage area, and the playback storage area includes a first storage area and a second storage area.
  • the method includes: when a playback trigger time Tt arrives, the playback storage area is read from a first preset position in the first storage area and played; at a first time T1, decoding is triggered to obtain first data, and the first data is stored in the playback storage area according to a first storage rule; at a second time T2, decoding is triggered to obtain second data, and the second data is stored in the playback storage area according to a second storage rule; wherein T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, and T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since T
  • a low-latency playback method is provided, which is applied to an audio playback device, wherein the audio playback device includes a first audio playback device and a second audio playback device, the first audio playback device and the second audio playback device respectively having a playback storage area as described in the first aspect, the first audio playback device and the second audio playback device respectively execute the method as described in the first aspect to achieve synchronous playback, wherein first data of the first audio playback device and first data of the second audio playback device have the same timestamp Ts1; second data of the first audio playback device and second data of the second audio playback device have the same timestamp Ts2; Tt is determined based on Ts1.
  • a low-latency playback device comprising: a playback storage area, the playback storage area comprising a first storage area and a second storage area;
  • a playing module configured to read and play the playing storage area from the first preset position of the first storage area when the playing triggering moment Tt arrives;
  • the audio module is configured to trigger decoding at a first moment T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second moment T2 to obtain second data, and store the second data in a playback storage area according to a second storage rule; wherein T1 is equal to or later than the time Tr1 when the first data is received, T2 is equal to or later than the time Tr2 when the second data is received, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time starting from Tt.
  • an audio playback device includes: a playback buffer area, the playback buffer area includes a first buffer area and a second buffer area;
  • the decoding unit is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
  • a playback unit configured to read and play the playback storage area from a first preset position in the first storage area when a playback triggering moment Tt arrives;
  • T1 is equal to or later than the time Tr1 when the audio playback device receives the first data
  • T2 is equal to or later than the time Tr2 when the audio playback device receives the second data
  • T2 is equal to or later than Tt
  • the first data starts to play before the second storage area is read for the first time since Tt.
  • an electronic device comprising: at least one processor, at least one wireless transceiver and at least one memory, wherein the memory stores a computer program, and the computer program is executed by the electronic device to perform a method as described in any one of the preceding aspects.
  • a storage medium which stores a computer program, and when the computer program is executed by an audio playback device, the The method of any one of the above aspects.
  • FIG1A is a schematic diagram of wireless communication between an audio playback device and an audio source device in some embodiments
  • FIG1B is a schematic diagram of wireless communication between a mobile phone and a TWS headset in some embodiments
  • FIG2 is a flow chart of switching to a low latency mode in some embodiments.
  • FIG3 is a flowchart of switching a low-latency mode of a game in some embodiments.
  • Figure 4 is a schematic diagram of full-link delay based on LE Audio Bluetooth technology
  • FIG5 is a schematic diagram of data transmission between a mobile phone and a TWS headset in some embodiments
  • FIG6 is a diagram of a data processing architecture of a Bluetooth audio playback device in some embodiments.
  • Figure 7 is a schematic diagram of pingpang buffer decoding storage and playback
  • FIG8 is a basic flow chart of low-latency playback in some embodiments.
  • FIG9 is a low-latency playback flow chart in Example A.
  • FIG10 is a flowchart of low-latency playback of headphones in Example A;
  • FIG11 is a low-latency playback flow chart in Example B.
  • FIG12 is a flowchart of low-latency playback of headphones in Example B;
  • FIG13 is a flowchart of low-latency headphone playback in Example C.
  • FIG14 is a low-latency playback flow chart in Embodiment D.
  • FIG15 is a flowchart of low-latency playback of headphones in Example D.
  • the audio playback device 100 communicates wirelessly with the sound source device 200 via a wireless link, and the sound source device 100 transmits the audio data to the audio playback device 200 via the wireless link for playback, and the wireless link can be based on Bluetooth technology.
  • LE Audio is a new audio transmission technology promoted by the Bluetooth SIG Alliance, which brings people wireless audio services with lower power consumption, lower cost, higher quality, and lower latency. Different from the traditional classic Bluetooth, it can support audio data encoded by LC3 (Low Complexity Communications Codec, low-power audio codec), so that the transmission of audio data can better balance power consumption, real-time performance, sound quality and other aspects.
  • LC3 Low Complexity Communications Codec, low-power audio codec
  • a Bluetooth transmission link based on LE Audio can be established between the left earphone 201, the right earphone 202 and the mobile phone 100, such as a Connected Isochronous Stream (CIS for short).
  • CIS Connected Isochronous Stream
  • Some embodiments of the present application can ensure that the left and right earphones are connected to each other. The earphones play synchronously while further reducing audio delay.
  • the present application can be exemplified based on LE Aduio Bluetooth technology, and can also be applied to other wireless communication technologies without conflict.
  • CIS Connected Isochronous Stream
  • BIS Broadcast Isochronous Stream
  • CIS adopts a synchronous transmission mechanism, that is, the number of retransmissions of the packet sent by the sender is limited, which is qualitatively different from the unlimited retransmission mechanism of BT. This is one of the reasons why CIS can achieve lower latency. However, in some specific scenarios, lower latency is still required to meet user needs, such as gaming scenarios.
  • a method for switching to a low latency mode based on LE Audio technology includes:
  • the audio source device updates CIS parameters in a preset mode, where the CIS parameters include: the number of retransmissions of a data packet;
  • the preset mode can be a game mode.
  • the process of switching the game low-latency mode is taken as an example when the mobile phone is used as the sound source device and the headset is used as the audio playback device and the LE Audio Bluetooth technology is applied. It can be seen that when the mobile phone maintains the LE Audio Bluetooth connection with the headset, if the mobile phone enters the game, it will notify the headset that it has entered the game mode. In response to the notification of the mobile phone, the headset will enter the game low-latency mode and switch to the low-latency parameters.
  • the mobile phone After entering the game, the mobile phone will switch to the CIS parameters of the game low-latency mode, mainly to reduce the number of retransmissions of the mobile phone's packets, so as to achieve a lower transmission latency; when there is a CIS data stream, CIS is established with the headset, and communication is carried out with the headset based on the CIS parameters in the low-latency mode; when the mobile phone exits the game, the headset is notified to exit the game low-latency mode and update the CIS parameters.
  • this embodiment can take low latency in a gaming scenario as an example. Of course, it can also be other scenarios with low latency requirements, which are not limited to this. Other low latency requirements can also refer to this embodiment, and other methods can be used to enter the low latency mode, and even the user can manually enter the low latency mode. Of course, low latency can also be used as a regular requirement without special entry. The actual needs can be adjusted according to the actual needs of the product, and it is not a limitation on other embodiments of this application.
  • the delay of the entire link from the audio source device to the audio playback device may include: Audio Processing Time, air transmission delay, and decoding and playback delay (Presentation Delay) of the audio playback end (such as sink devices such as headphones). It can also be described as the delay of the audio source device, the delay in air transmission, and the delay of the audio playback device.
  • the presentation delay may refer to the delay from the synchronization reference time to the final sound of the headphones. This process can be calculated from the Sync point of the left and right ear packages, and may include the decoding of audio data, as well as the loss of subsequent sound effect processing and other paths. In LE Audio and other related standards, the default configuration of the Spec presentation delay is 40ms.
  • Transport Latency mainly refers to the air transmission delay. Taking mobile phones and TWS headphones as examples, it can include the time from the mobile phone Bluetooth chip side getting the data packet to the final headset Bluetooth chip side receiving the packet and reaching the synchronization reference time (synchronization reference time, referred to as sync). Transport Latency will be affected by the configuration of the number of retransmissions and parameters such as packet size/frame length. The value of the parameter will be different in different business scenarios.
  • a mobile phone is used as an audio source device and is currently connected to a pair of TWS headphones (audio playback device).
  • a CIS is built for both the mobile phone and the dual headphones.
  • the mobile phone sends a packet of data pk1 on the first CIS channel CIS_1, and synchronously sends a packet of data pk2 on the second CIS channel CIS_2.
  • the pk1 and pk2 data are basically the same, and the main difference is that the left and right ear channels are different. Due to the time difference between the normal reception of data by the headphone end of different CIS channels, such as pk1 on CIS_1, the mobile phone sends the first packet pk1.
  • the headphone end does not normally feedback ACK (ACK is used to indicate that the headset has correctly received the pk1 data packet), but replies NACK (NACK is used to indicate that the headset has not correctly received the pk1 data packet, which means that the mobile phone needs to retransmit).
  • ACK is used to indicate that the headset has correctly received the pk1 data packet
  • NACK is used to indicate that the headset has not correctly received the pk1 data packet, which means that the mobile phone needs to retransmit.
  • the mobile phone After the mobile phone resends a packet of data pk1, the headphone end replies ACK normally; and for pk2 on CIS_2, the mobile phone sends it once and the headphone end replies ACK normally, so that the left and right ears receive the corresponding pk There is a difference in the receive time. If the left and right ears perform their respective playback logic based on the time when the packet is received, it is bound to cause the left and right ears to be out of sync.
  • the relevant standards set a service data unit synchronization reference time (Service Data Unit synchronization reference time, which can be referred to as SDU Sync).
  • SDU Sync Service Data Unit synchronization reference time
  • This time can be determined according to the maximum transport latency set by the mobile phone. This time represents the latest time point when the headset effectively receives the packet data. If the headset receives the packet data after this time point, the packet data also needs to be discarded due to timeout.
  • the receive time of pk1 and pk2 received by the left and right ears is different, the timestamps of pk1 and pk2 are the same, that is, the playback timestamp of the packet data is determined according to the synchronization reference time. This avoids the problem of asynchronous playback of the left and right ears due to the difference in receive time.
  • a data processing architecture of a Bluetooth audio playback device is provided, and Bluetooth technologies such as LE Audio can be applied.
  • the Bluetooth module of the Bluetooth audio playback device receives the data stream (such as the CIS data stream)
  • the audio data in the data packet in the data stream (which can be understood as valid data) can be stored in the Bluetooth buffer.
  • the audio module of the Bluetooth audio playback device will obtain data from the Bluetooth buffer (generally one frame of data) for decoding and store it in the decoder buffer, and then perform digital-to-analog conversion through the digital-to-analog converter DAC, and further play the analog signal through the speaker.
  • the Bluetooth chip of the audio playback device After the Bluetooth chip of the audio playback device receives the data sent by the Bluetooth audio source device through the transmission channel such as CIS, it will add a corresponding timestamp field to each frame of data according to the synchronization reference time.
  • the timestamp field is used to identify the synchronization start point of the frame data.
  • each frame of data also has a corresponding playback order.
  • the difference between the timestamps of two adjacent frames of data is the frame length of one frame of data.
  • the frame length (frame-duration) is mainly 10ms and 7.5ms, which represents the length of time that each frame of data can be played, so the timestamp difference between adjacent frames is generally 10ms/7.5ms.
  • the data processing of the audio playback device can be divided into three parts.
  • the first part includes a data receiving end, which is used to receive data packets from the sound source device, and after unpacking, the valid data therein (such as the audio data to be decoded) is stored in the communication storage area (such as the Bluetooth buffer area in Figure 6).
  • This part is mainly executed by a communication module, such as a Bluetooth chip.
  • the second part includes a decoding storage end, which obtains data from the above-mentioned communication storage area for decoding and stores the decoded data in the playback storage area. This part is mainly executed by an audio module.
  • the third part includes a playback end, which reads data from the above-mentioned playback storage area for processing (such as digital-to-analog conversion), and then plays it through a speaker. If you want to ensure low latency, continuity, and stability of audio playback, you need to rely on the cooperation of the above-mentioned three parts. This application can also be improved from the settings of the above-mentioned related parts to reduce latency.
  • DAC is a hardware process, which is usually asynchronous with decoding. That is, once DAC is turned on, it will continuously perform digital-to-analog conversion of data and output sound, and this process will be crossed with decoding. Therefore, in order to ensure the smoothness of data playback, the software design can design ping pang buffer (two buffers) or ring buffer (multiple buffers) for processing, of course, other storage types can also be used. Taking the design of ping pang buffer as an example, according to the read and write logic of ping pang buffer, as shown in Figure 7, first, each buffer is used to store one frame of LC3 data, that is, LC3 data with a playback length of 10ms or 7.5ms.
  • DAC moves data from ping buffer via DMA (Direct Memory Access) (reading data)
  • DMA Direct Memory Access
  • reading data data
  • data is written in pang buffer.
  • decoding takes time (usually 1-2ms)
  • the time of decoding and writing buffer will be 1-2ms slower. If a buffer is read and written at the same time, it is easy to cause some data to be lost during DAC moving process. So in this case, when DMA starts to move data from ping buffer, the decoded data will be written to pang buffer. And when DMA starts to move data from pang buffer, the decoded data will be written to ping buffer, so that each DMA can normally get the complete decoded data from buffer.
  • DMA Direct Memory Access
  • the ping buffer when the ping buffer is rendered, there is no sound played because no data has been decoded and placed in the ping buffer. After the ping buffer is played, an interrupt request is generated to trigger the decoding.
  • the data obtained needs to be placed in the ping buffer because the pang buffer is being rendered. If no optimization is performed, a round of ping buffer and pang buffer must be rendered before there is sound output and the user can hear the sound, for example, two frames of data may be delayed.
  • a low-latency playback method is applied to an audio playback device, the audio playback device includes a playback storage area, the playback storage area includes a first storage area and a second storage area, the method comprising: when a playback trigger time Tt arrives, the first storage area in the first storage area is played back.
  • T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, thereby ensuring that the first data can be decoded
  • T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, thereby ensuring that the second data can be decoded
  • T2 is equal to or later than Tt, thereby making it unnecessary to wait for the decoded second data to start playing, and starting the playing in advance
  • the first data starts playing before the second storage area is read for the first time since Tt, thereby ensuring that the first data can be heard by the user earlier, thereby reducing the audio delay, improving the performance of the audio playback device, and improving the user experience
  • the audio playback device also includes a third storage area for storing data to be decoded, the data to be decoded including first data to be decoded and/or second data to be decoded; the method also includes: sequentially receiving a first data packet and a second data packet sent by the sound source device, the first data packet including the first data to be decoded, and the second data packet including the second data to be decoded; storing the first data to be decoded and/or the second data to be decoded in the third storage area.
  • storing the first data in the playback storage area according to the first storage rule includes: storing the first data in the first storage area; storing the second data in the playback storage area according to the second storage rule includes: storing the second data in the second storage area.
  • the playback triggering time Tt is determined according to the timestamp Ts1 corresponding to the first data and the first preset time period; the first preset time period is sufficient to decode and obtain the first data and store the first data in the first storage area.
  • the first preset time period is less than the total time of reading the first storage area and the second storage area; thus, the playback delay can be guaranteed to be less than the total time of reading the first storage area and the second storage area. If the first storage area and the second storage area are both one frame long, the delay can be guaranteed to be less than two frames.
  • T1 is earlier than or equal to Ta, and the time from Ta to Tt is sufficient to decode the first data and store it in the first storage area; thereby ensuring that decoding at T1 can store the first data in the first storage area before Tt arrives, so that there will be no delay in the playback phase after Tt. From the user's perspective, the sound can be heard when Tt arrives.
  • T2 is earlier than or equal to Tb, and the time from Tb to the completion of reading the first data is sufficient to decode the second data and store the second data in the second storage area, so that the second data can be played immediately after the first data is played, ensuring the continuity of data playback.
  • storing the first data in the playback storage area according to the first storage rule includes: dividing the first data into a first portion of data and a second portion of data according to the playback order, the first portion of data is stored in a first area of the first storage area, the second portion of data is stored in a second area of the second storage area, and the first area is adjacent to the second area; storing the second data in the playback storage area according to the second storage rule includes: dividing the second data into a third portion of data and a fourth portion of data according to the playback order, storing the third portion of data in an area of the second storage area except the second area; storing the fourth portion of data in an area of the first storage area except the first area; or
  • the second data is stored in the playback storage area according to the second storage rule, including dividing the second data into a third part of data and a fourth part of data, storing the third part of data in an area of the second storage area except the second area; storing the fourth part of data in a third area of the fourth storage area, the third area is adjacent to the second storage area, and the fourth storage area is a storage area in the playback storage area adjacent to the second storage area.
  • T1 is earlier than or equal to Tc, and the time from Tc to the time of reading the first storage area for storing the first data is sufficient to decode the first data and store the first data according to the first storage rule of this embodiment, so as to ensure that there is sound output when the position for storing the first data is read;
  • T2 is earlier than or equal to Td, and the time from Td to the time of reading the first data is sufficient to decode the second data and store the second data according to the second rule, so as to ensure the continuity of the playback of the second data and the first data;
  • Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and in some embodiments, the second preset time can be less than the total time of reading the first storage area and reading half of the second storage area.
  • the setting of the second preset time ensures that the playback delay is less than the total time of reading the first storage area and the
  • the first data may be equally divided into a first portion of data and a second portion of data, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent;
  • the second data may be equally divided into a third portion of data and a fourth portion of data, the third portion of data is stored in the second half of the second storage area, and the fourth portion of data is adjacent to the first portion of data.
  • the third partial data is stored in the first half of the first storage area, or the fourth partial data is stored in the first half of the fourth storage area, and the third partial data is adjacent to the fourth partial data.
  • storing the first data in the playback storage area according to the first storage rule includes: storing the first data in the second storage area; storing the second data in the playback storage area according to the second storage rule includes: storing the second data in the first storage area; or storing the second data in a fourth storage area, the fourth storage area being a storage area in the playback storage area adjacent to the second storage area. It is understandable that the fourth storage area may be a storage area in the annular storage area.
  • T1 is earlier than or equal to Te, and the time from Te to reading the first storage area is sufficient to decode the first data and store the first data in the second storage area, thereby ensuring the playback of the first data and reducing latency.
  • T2 is less than or equal to Tf, and the time from Tf to the completion of reading the first data is sufficient to decode the second data and store the second data in the first storage area or the fourth storage area, thereby ensuring the continuity of the playback of the first data and the second data.
  • Tt is determined based on the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0 and less than the duration of reading the first storage area, thereby ensuring that the delay of the first data is controlled within the total duration of reading the first storage area and the second storage area.
  • the playback trigger time Tt is equal to the sum of the timestamp Ts1 corresponding to the first data and the duration of the half-frame data.
  • triggering decoding at a first time T1 to obtain first data includes: triggering decoding to obtain first data upon receiving a first data packet.
  • triggering decoding at the second time T2 to obtain second data includes:
  • decoding is triggered to obtain the second data.
  • triggering decoding at the second time T2 to obtain second data includes:
  • decoding is triggered to obtain the second data.
  • Tt is equal to the timestamp Ts1 corresponding to the first data.
  • triggering decoding at a first moment T1 to obtain first data includes: triggering decoding at a play triggering moment Tt to obtain first data.
  • triggering decoding at the second time T2 to obtain second data includes:
  • the method further includes: generating a second interrupt request at a third time T3, decoding the acquired data in response to the second interrupt to obtain third data, and storing the third data in a playback storage area according to a third storage rule;
  • the time interval between the first interrupt request and the second interrupt request is at least the duration of one frame of data.
  • the first storage area is a ping buffer
  • the second storage area is a pong buffer; or, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer.
  • the audio playback device and the audio source device communicate via LE Audio Bluetooth technology.
  • the first data and the second data are both one frame of data; and the first storage area and the second storage area are both sized to store one frame of data.
  • T2 is less than or equal to Td, and the time from Td to the completion of reading the first data is sufficient to decode and obtain the second data and store the second data according to the second storage rule.
  • a low-latency playback method is provided, which is applied to an audio playback device, the audio playback device includes a playback storage area, the playback storage area includes a first storage area and a second storage area, the method includes:
  • the part including reading the data in the playback storage area for playback may include the following parts:
  • the definition of the playback trigger time can refer to the trigger time mentioned in the previous related technology, but in some embodiments, the setting of Tt can be adjusted.
  • the playback trigger time Tt can be determined based on the timestamp Ts1 corresponding to the first data and the first preset time period, where the first preset time period can be greater than or equal to 0. In other words, Tt can be the same as Ts1.
  • the first preset time period is less than the total time to read the first storage area and the second storage area, that is, the guaranteed delay is less than The total duration of the two storage areas; therefore, in some embodiments, Tt can also be adjusted with the change of other parameters, for example, Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and for example, Tt is determined according to the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0, and is less than the duration of reading the first storage area.
  • the inventors have found that the half-frame duration can better meet the audio module decoding a frame of data and storing it in the relevant storage area, so the half-frame duration can be reserved for the first data to be decoded and stored.
  • the time for decoding and storage may be less than half a frame duration, so the first preset time period may also be less than half a frame duration, as long as it can meet the time required to decode a frame of data and store it in the relevant storage area, so that decoding and storage can be completed before Tt arrives.
  • Tt Ts1.
  • it can be achieved by decoding while playing.
  • the playback storage area may correspond to the decoding buffer area of FIG. 6, which is used to store data for playback, so that the DAC can obtain the data for conversion and playback
  • the audio module is reading and playing, no sound is actually emitted, and the user cannot hear it. Therefore, in order to reduce the delay, other parameters need to be adjusted in this case, such as adjusting the decoding time, which will be described in detail later.
  • the above-mentioned first preset position can be the starting position of the first storage area, that is, when the playback trigger time Tt arrives, the first storage area is read for playback.
  • some can play the sound when Tt arrives, and in some embodiments, it may be necessary to read other positions of the first storage area before the sound can be played, such as reading the middle position, and some even read the second storage area. Because when Tt arrives, some storage areas in the first storage area may have no valid data, so even if the playback time render_time is running, that is, reading and playing, the user cannot hear the sound.
  • Tt time to trigger playback
  • data will be read from the playback storage area according to the reading rules for playback, such as reading from the ping buffer to the pang buffer and looping back to the ping buffer for the next round of reading and playback.
  • the reading and playback of the playback storage area will not be stopped. Therefore, it is necessary to ensure the timeliness of data collection, decoding and storage to ensure the continuity of playback. Otherwise, there may be freezes, silence, etc. because there is no data available for playback in the playback storage area.
  • the decoding storage end may include a portion that triggers decoding and stores the content in a playback storage area, for example, the following portions:
  • S802 Trigger decoding at a first moment T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule.
  • the first data may be the first frame data to be played, such as the first frame audio data in playing music.
  • the first storage area and the second storage area may be adjacent storage areas, or the render may be played at a uniform speed from the first storage area to the second storage area.
  • the first storage area may be a ping-pang buffer in a ping-pang buffer
  • the second storage area may be a pong buffer in a ping-pang buffer
  • the first storage area and the second storage area are two adjacent buffer areas in a ring buffer, for example, the first storage area is the first storage area of the ring storage area.
  • T1 may be equal to or later than the time Tr1 at which the audio playback device receives the first data
  • Tr1 may refer to the time at which the communication module of the audio playback device receives the data packet carrying the first data, thereby ensuring that decoding can be triggered at time T1 to obtain the first data.
  • Triggering decoding can be understood as notifying the audio module to obtain the data to be decoded for decoding operations, etc.
  • the time T1 is earlier than the time when the first storage area is read for the first time since the time Tt, so there is no need to wait for the first storage area to be read before triggering the decoding to obtain the first data.
  • T1 is greater than or equal to the reception time Tr1 of the first data. Tr1 can be understood as the time when the first data is actually received. If the first data is sent from the sound source device to the audio playback device in the form of a first data packet, Tr1 can be the time when the audio playback device receives the first data packet.
  • the audio playback device may further include a third storage area (also referred to as a communication storage area), which can be used to store valid data to be decoded (for example, audio data for playback), and then The audio module can obtain data from the third storage area frame by frame for decoding.
  • a third storage area also referred to as a communication storage area
  • the method after receiving the first data packet sent by the sound source device, the method also includes: storing the first data to be decoded in the first data packet in the third storage area, so that the audio module can obtain and decode the data before playing it.
  • the encoded first data can also be directly decoded and stored in the playback storage area without first storing it in the third storage area.
  • T1 is any time from Tr1 to the first time the second preset position of the playback storage area is played, and the time from the second preset position to the first storage area is sufficient to decode and store the first data in the second storage area.
  • T1 can be equal to Tr1, or T1 can be equal to the time when the second preset position is played for the first time, or T1 can be any time between the two, which can be set according to actual needs.
  • T1 can be greater than Tt, for example, T1 is any time from the time when half of the first storage area is read from the time Tt to the time when the second preset position is read, and the time from the second preset position to the first storage area is sufficient to decode and store the first data in the second storage area.
  • T1 can be the time when the first storage area is read, or the time when the middle position of the first storage area is read, or the time when the second preset position is read, or other moments in between. Because, according to the analysis of the inventor, it is sufficient to decode and store the first data as long as the time from the time T1 to the time when the first data is read to the starting position for storing the first data is sufficient, that is, it is sufficient to ensure that the first data can be read and played when the starting position for storing the first data is read.
  • the half-frame data duration can basically guarantee the decoding, storage and other system overheads of one frame of data, so it can also be set to trigger the decoding data when the half position of the first storage area is read for the first time since time Tt to obtain one frame of data (for example, the first data) and store it in the second storage area. Therefore, when the second storage area is read, the user can hear the audio corresponding to the first data, so that the delay is controlled within one frame of data and the continuity of the playback is guaranteed.
  • the first data can be stored in the first storage area according to the first storage rule; in some embodiments, the first data can be stored in the second storage area according to the first storage rule; in some embodiments, the first data can also be divided into at least two parts, which can be stored in the first storage area and the second storage area respectively according to the first storage rule. In order to ensure the continuity of playback, the continuity of data playback must also be ensured when stored in different storage areas.
  • the first data is divided into the first part of data and the second part of data according to the playback order, the first part of data is stored in the first area of the first storage area, the first area is close to the second storage area, the second part of data is stored in the second area of the second storage area, the second area is close to the first storage area, the first part of data is adjacent to the second part of data, and it can also be understood that the first area is adjacent to the second area, so as to ensure that the first data can be played continuously.
  • the first part of data is stored in the second half of the first storage area
  • the second part of data is stored in the first half of the second storage area
  • the first part of data is adjacent to the second part of data.
  • the first data can be divided into two parts, the above-mentioned first area can correspond to the second half of the first storage area, and the second area can correspond to the first half of the second storage area.
  • the first data may also be unequally divided, and there is no restriction on this.
  • the first part of the data may be more than the second part of the data. In this way, when the first part of the data is stored in the first storage area, it can be stored closer to the starting playback position, so that it can be read and played earlier.
  • the time required to decode and store the first data should be estimated to ensure that the first data has been stored when it is played from the starting position of the first storage area to the starting storage position of the first data, so as to reduce the delay as much as possible.
  • the first storage rule may be different in different embodiments.
  • the first data is a frame of data; the first storage area and the second storage area are both sized to store a frame of data.
  • each buffer (such as the first storage area and the second storage area) stores a frame of LC3 data.
  • the first data, the second data, and subsequent data are decoded with a data length of one frame.
  • a frame of data can be sent from a sound source device to an audio playback device through a data packet, or sent to an audio playback device through multiple data packets, or multiple frames of data can be sent in one data packet.
  • a frame of data can be compressed and transmitted through a data packet. Other compression and transmission methods may be used in other wireless communication protocols.
  • S803 Trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule.
  • the second data can be data adjacent to the first data.
  • the first data and the second data can both be one frame of data length, for example, the second data is the next frame of data of the first data. Therefore, T1 is earlier than T2, that is, the decoding is triggered first.
  • the first data is read, and then the decoding is triggered to obtain the second data.
  • the setting of T2 also needs to take into account the reception of the second data.
  • the decoding can be triggered to obtain the second data.
  • T2 is the moment when the first storage area is read for the first time since the moment Tt. For example, when the first storage area is read, the data is obtained from the third storage area for decoding to obtain the second data.
  • the specific moment may have a certain fluctuation range and all belong to the protection scope of this application.
  • the audio playback device further includes a third storage area; the method further includes: receiving a second data packet sent by the audio source device, the second data packet including encoded second data; storing the encoded second data in the third storage area.
  • the third storage area can be a buffer area of the Bluetooth module, which is used to store the data to be decoded received by the Bluetooth module.
  • the second data packet may include the second data to be decoded, wherein the size of the second data is one frame.
  • the data when the third preset position of the first storage area is read, the data is obtained from the third storage area for decoding to obtain the second data.
  • the third preset position is located between the middle position of the first storage area and the end position of the first storage area, and the duration of playing from the third preset position to the end position of the first storage area is sufficient to decode and store the second data according to the second storage rule. It can be understood that in some embodiments, the third preset position is located between the middle position of the first storage area and the end position of the first storage area, which can include the case where the third preset position is the middle position of the first storage area.
  • the third preset position is set at the middle position of the first storage area, which can meet the requirement that the duration of playing from the third preset position to the end position of the first storage area is sufficient to decode and store the second data according to the second storage rule, such as storing the second data in the second storage area.
  • the decoding time of the second data can be calculated more finely, so as to set the third preset position accordingly to ensure the continuity of the playback.
  • the second data is stored in the second storage area, so that when it is played to the second storage area, the second data has been decoded and placed in the second storage area.
  • a first interrupt request may be generated at the second time T2, and in response to the first interrupt request, data is acquired from the third storage area and decoded to obtain second data.
  • the second preset position and the third preset position can be the same position.
  • the second data needs to be stored for reading and playing.
  • the second data can be stored in the first storage area, such as the case of the ping-pong storage area; in some embodiments, the audio playback device also includes a fourth storage area.
  • the second data can also be stored in the fourth storage area.
  • the fourth storage area can be a storage area adjacent to the second storage area, such as two adjacent buffers.
  • the second data can also be stored in part or in whole in the second storage area.
  • the second data can be divided into a third part of data and a fourth part of data.
  • the third part of data can be stored in the area of the second storage area except the aforementioned second area; the fourth part of data can be stored in the area of the first storage area except the aforementioned first area.
  • the first area is the second half of the first storage area and the second area is the first half of the second storage area
  • the third part of data can be stored in the second half of the second storage area
  • the fourth part of data can be stored in the first half of the first storage area, so as to ensure the continuity of the playback of the second data and the first data, as well as the continuity of the playback of the second data itself.
  • the audio playback device further includes a fourth storage area, which is adjacent to the second storage area; the second data can be divided into a third portion of data and a fourth portion of data, and the third portion of data is stored in an area of the second storage area other than the second area; the fourth portion of data is stored in a third area of the fourth storage area, and the third portion of data and the fourth portion of data are adjacent, which can also be understood as the third area being adjacent to the second area, thereby ensuring the continuity of the second data playback.
  • a circular storage area such as a circular buffer
  • other parts can also be implemented based on some of the previous embodiments.
  • a receiving end is also included.
  • a data packet sent by the sound source device is received through a radio transceiver module (such as a Bluetooth module), and is stored in the aforementioned communication storage area after unpacking, thereby obtaining valid data such as the first data to be decoded and/or the second data to be decoded waiting for decoding.
  • Information such as the reception time of the relevant data packet may also be related to the settings of the subsequent decoding storage and playback parts, as described in the description of the relevant embodiments for details.
  • T1 is equal to or later than the time Tr1 at which the audio playback device receives the first data
  • T2 is equal to or later than the time Tr2 at which the audio playback device receives the second data
  • T2 is equal to or later than Tt
  • the first data is received for the first time since Tt. Playback starts before the second storage area is read, thereby ensuring low-latency playback and playback continuity.
  • T1 is earlier than T2
  • Tt is earlier than or equal to T2
  • the setting of T2 ensures that the audio playback device has received the second data sent by the sound source device at T2, thereby ensuring that the second data can be decoded while reducing audio delay and improving user experience.
  • Tt is earlier than or equal to T2, which can trigger decoding earlier to obtain the second data. Playing and decoding combined with the setting of storage rules can reduce delay while ensuring the continuity of playback.
  • the duration from T1 to T2 is sufficient to decode and store the first data according to the first storage rule. However, the interval of subsequent interrupt requests for triggering decoding can be controlled to at least one frame of data duration.
  • the frame length of the second data is one frame, which is encoded and sent to the audio playback device by the sound source device through the second data packet.
  • the difference between the timestamps corresponding to two adjacent frames of data is a frame duration, such as the length of a frame of data.
  • the duration from the timestamp Ts1 corresponding to the first data to T2 needs to be controlled to be greater than or equal to the length of a frame of data.
  • the interval between two subsequent interrupt requests can also be controlled to be at least one frame of data length to ensure data reception.
  • the above-mentioned embodiments or the combination of the technical features of the embodiments can enable the first data to be heard by the user earlier during playback, thereby reducing playback delay.
  • first data and the second data in the above embodiments can be obtained by receiving a data packet sent by the sound source device, the first data or the second data can be divided into multiple data packets for transmission, or the first data can be transmitted by the first data packet and the second data can be transmitted by the second data packet, and there is no limitation on this.
  • the order between S800-S803 is only for example, and can be executed in other orders without conflict, and some can even be executed in parallel, for example, the relevant parts of the aforementioned playback end and the relevant parts of the storage end may be parallel, and in different embodiments, the settings of each moment are different, so the order may also be different, but there is a connection between the two, for example, the determination of Tt in S800 and the setting of T1 in S802 can be related to the first data received from the sound source device, and the specific relationship is described in the previous or subsequent parts, which will not be repeated here; it can be understood that the above different embodiments and their technical features can be partially or completely combined to achieve the effect of reducing delay without conflict.
  • the method may further include:
  • S804 Generate a second interrupt request at a third moment T3, and in response to the second interrupt request, obtain data from a third storage area for decoding to obtain third data, wherein the third storage area is used to store one or more of the first data to be decoded, the second data to be decoded, and the third data to be decoded; the time interval between the first interrupt request and the second interrupt request is at least the duration of one frame of data.
  • the intervals between subsequent adjacent interrupt requests are at least as long as one frame of data, thereby ensuring the reception of data and ensuring that there is data for decoding.
  • S805 Store the third data in the playback storage area according to the third storage rule.
  • the third storage rule can be stored in the ping pang buffer in a manner that refers to the first storage rule. In the case of a circular buffer, there may be differences between the first storage rule and the second storage rule. If the circular loop position is not reached, the storage will continue. Otherwise, the storage can be similar to the ping pang buffer and referred to the first storage rule.
  • Embodiment A provides a method for low-latency playback, which can apply wireless communication technologies such as LE Audio Bluetooth technology, and adjust the interrupt request timing, etc., so that the delay can be controlled within half a frame.
  • the method includes:
  • S900 Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
  • the audio source device can establish a CIS channel with the audio playback device through LE Audio Bluetooth technology to transmit the first data packet.
  • the first data packet After receiving the first data packet, it will be unpacked to extract valid data (such as the first data to be decoded), and then the first data to be decoded will be stored in a third storage area (such as a Bluetooth cache area) to wait for decoding and playback.
  • the first data is decoded in advance, so the first data to be decoded may not be stored in the third storage area, but directly decoded to obtain the first data.
  • S901 Obtain a timestamp Ts1 corresponding to the first data, and use the sum of Ts1 and the duration of the half-frame data as a playback triggering time Tt.
  • the timestamp Ts1 corresponding to the first data can be determined according to the synchronization reference time.
  • the synchronization reference time can be the SDU synchronization reference time specified in the relevant standard, which is determined according to the maximum transmission latency set by the audio source device.
  • the specific determination method can refer to the relevant description of the LE Audio Bluetooth protocol.
  • Other communication protocols may have similar time parameters for synchronous playback reference, which can be unrestricted.
  • Ts1 can be the synchronization reference time (corresponding to the SDU synchronization reference time in LE Audio Bluetooth technology), so Tt can be equal to the sum of the synchronization reference time and the half-frame duration.
  • the half-frame duration can generally reserve decoding and other system time overheads. That is to say, the half-frame duration can stably ensure that the first data is decoded and stored according to the first storage rule for reading and playback.
  • S902 trigger decoding upon receiving a first data packet to obtain first data; store the first data in a first storage area.
  • the present embodiment does not need to wait until the playback time render_time is completed and the first storage area generates a preset interrupt request to trigger decoding to obtain the first data, but triggers decoding to obtain the first data when the first data packet is received, wherein the moment of receiving the first data packet can be Tr1, which is regarded as the actual receiving time of the first data packet.
  • Tr1 the moment of receiving the first data packet
  • it can be understood as notifying the audio module to obtain data for decoding as soon as possible after receiving the first data packet.
  • the unpacked first data to be decoded does not need to be stored in the aforementioned third storage area, but can be directly decoded and stored in the playback storage area; it is also possible to store the first data to be decoded in the third storage area after unpacking when the first data packet is received, and notify the audio module to obtain the first data to be decoded from the third storage area for decoding.
  • the playback trigger time Tt in S901 is increased by half a frame, this half frame is sufficient for decoding to obtain and store the first data, so the first data can be directly stored in the first storage area, so there is no need to worry about the first storage area having no valid data to play when Tt arrives. Therefore, the delay on the playback device side can be shortened to half a frame.
  • Tt is set to arrive half a frame later than the timestamp Ts1 corresponding to the first data, the first data has been stored in the first storage area when Tt arrives, so the first data can be played at Tt so that the user can hear the sound earlier.
  • reading and playing begins when the Tt moment arrives.
  • DMA will continue to move data in the playback storage area according to preset rules for playback.
  • the ping pang buffer as an example, it can read and play from the ping buffer to the pang buffer, and then return to the ping buffer to continue a new round of reading and playing.
  • a preset interrupt request is generated at a certain position to trigger the decoding of the next frame of data
  • DMA will continue to move data from the playback storage area. Therefore, decoding and playback can be considered to be parallel. If decoding and storage are not timely, DMA may have no data to move, resulting in the inability to output audio and causing sound jams.
  • S904 Receive a second data packet sent by the audio source device, where the second data packet includes encoded second data; and store the encoded second data in a third storage area.
  • the second data to be decoded (i.e., encoded) is first obtained by unpacking, and the second data to be decoded is stored in a third storage area.
  • the third storage area (such as a Bluetooth cache area) can be used to store valid data after unpacking, so that the audio module can obtain data frames therefrom for decoding.
  • S904 may be executed after S900, and may be executed in parallel with decoding and playing of the first data, such as in parallel with S901, S902 or S903.
  • S905 When the third preset position of the first storage area is read, trigger the acquisition of data from the third storage area for decoding to obtain second data; and store the second data in the second storage area.
  • the third preset position can be located between the middle position of the first storage area and the end position of the first storage area, and the duration of playback from the third preset position to the end position of the first storage area must be sufficient to decode and store the second data according to the second storage rule, so as to ensure that there is second data to play when playing to the second storage area.
  • T2 when T2 arrives, it may be when the middle position of the first storage area is read, that is, when half of the first data is played, a first interrupt request, such as dma_irq, is generated.
  • the audio module of the audio playback device reads the second data to be decoded (such as a frame of data length) from the third storage area to decode and obtain the second data.
  • the reason why the first interrupt request is generated after half of the first data is played is that the inventor has found through research that the playing time of the remaining half of the data is sufficient for decoding and storing the second data, and Tt delays half a frame and then plays the first data for half a frame, which is a total of one frame.
  • the time from the third preset position to the end position of the first storage area may be less than half the playback time of the first storage area. Therefore, when the second data decoding and storage are satisfied, the distance from the third preset position to the end position of the first storage area can be further shortened.
  • the second data is stored in the second storage area, so that the second storage area can continue to be read after the first storage area is read, thereby ensuring the continuity of playback.
  • the audio playback device will continue to read data from the playback storage area and play. It can be seen that the receiving end, the decoding storage end, and the playback end can be parallel, but at the same time, the continuity of data operation between the three must be guaranteed to ensure the continuity of playback. For example, relevant data can only be decoded and stored after it is received, and then it can be further played. If a problem occurs in a certain link, it may cause discontinuity of playback. This embodiment can further reduce the delay on the basis of ensuring the continuity of playback.
  • the second interrupt request is set by setting the interval of one frame between the first interrupt request and the second interrupt request, that is, the second interrupt request is set in the middle position of the second storage area (such as pang buffer), so that when reading and playing to the middle position of the second storage area, the decoding is triggered to obtain the third data.
  • the third data can be stored in the ping buffer because the first data in the ping buffer has been played at this time, so it can be used to store the third data.
  • the third data can be stored in the fourth buffer, so as to continue to read and play the render.
  • the interrupt request interval still maintains the length of one frame of data to ensure packet reception, and guarantees the synchronization between decoding and playback consumption, so that the first data can be played earlier and the subsequent data can be played continuously, reducing the delay (half-frame delay) and improving the stability of playback.
  • example A is illustrated by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
  • S1000 The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
  • the headset stores the first data in the ping buffer
  • the headset stores the third data in the ping buffer.
  • the sound source device (such as a mobile phone) sends the first data packet, the second data packet and the third data packet to the audio playback device (such as headphones) in sequence.
  • the valid data in the above data packets: the first data, the second data and the third data can all be one frame of data. After the audio playback device receives the first data packet, the audio playback device will continue to receive the second data packet, the third data packet and other subsequent data packets from the sound source device.
  • the valid data after the relevant data packets are unpacked can be stored in the communication storage area (i.e., the third storage area, such as the Bluetooth buffer), and the above valid data is decoded to obtain the corresponding first data, second data or third data.
  • the first data to be decoded may also not be stored in the communication storage area, but directly decoded, so as to be decoded and stored earlier in advance.
  • the size of the ping buffer and the pang buffer is also set to a frame of data length.
  • Tt is set to Ts1+ half-frame duration corresponding to the first data.
  • the half-frame duration is mainly reserved for decoding and other system time overheads; the delayed half-frame is used to decode and store the first data in the first storage area (such as ping buffer), so that when Tt arrives, it can be directly read from the first storage area.
  • the first data is read from the storage area for playback.
  • the first data is transferred from the ping buffer through DMA and sent to the DAC for digital-to-analog conversion and played out, so that the delay of the first data playback is controlled to half a frame.
  • the time set by Tt is Ts1+half-frame duration corresponding to the first data
  • the difference between the timestamps corresponding to the adjacent first data and the second data is a frame period frame_duration, that is, the length of a frame of data.
  • the second data for example, carried by the second data packet
  • the audio playback device when playing to the middle position of the first storage area (such as ping buffer) (playing half-frame duration), the second data (for example, carried by the second data packet) is generally also received by the audio playback device.
  • the first interrupt request is generated to ensure the reception of the second data, to ensure that the trigger decoding of the next frame of data can obtain the second data, and at the same time, the half-frame duration of the second half of the first storage area is used to ensure that the second data is decoded and stored in the second storage area, so that when playing to the pang buffer, there is second data that can be played out.
  • This method reduces the delay (only half-frame delay) and ensures the continuity of playback. It should be noted that the receiving time of the second data must be earlier than or equal to the timestamp Ts2 corresponding to the second data, otherwise the second data is discarded. If the second data audio playback device does not receive it normally, PLC packet supplement processing can be performed. Therefore, the playback delay of embodiment A can be controlled within half a frame of data, which is significantly improved compared to the two-frame delay.
  • Embodiment B provides a low-latency playback method, which can use wireless communication methods such as LE Audio Bluetooth technology to transmit data, and can control the delay to half a frame by modifying the storage position and other methods.
  • the method includes:
  • S1100 Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
  • the audio source device can establish a CIS channel through LE Audio Bluetooth technology to transmit the first data packet.
  • it will be unpacked to extract valid data (such as the first data to be decoded), and then the first data to be decoded will be stored in a third storage area (such as a Bluetooth cache area) to wait for decoding and playback.
  • the first data is decoded in advance, so the first data to be decoded may not be stored in the third storage area, but directly decoded to obtain the first data.
  • S1101 Obtain a timestamp Ts1 corresponding to the first data, and use Ts1 as Tt; when Tt arrives, read and play from a first preset position in the first storage area.
  • the timestamp Ts1 corresponding to the first data can be determined according to the synchronization reference time.
  • the synchronization reference time can be the SDU synchronization reference time specified in the relevant standards, which is determined according to the maximum transmission delay transport latency set by the audio source device.
  • the specific determination method can refer to the relevant description of the LE Audio Bluetooth protocol.
  • Other communication protocols may have similar time parameters for synchronous playback reference, which can be unrestricted.
  • Ts1 can be the synchronization reference time (corresponding to SDU synchronization reference time in LE Audio Bluetooth technology), so Tt can be equal to SDU synchronization reference time.
  • Tt can be set to Ts1.
  • S1102 Trigger decoding upon receiving a first data packet to obtain first data.
  • the present embodiment does not need to generate an interrupt request when the playback time render_time has completed the first storage area to trigger decoding to obtain the first data, but triggers decoding to obtain the first data when the first data packet is received, wherein the moment Tr1 of receiving the first data packet can be regarded as the actual receiving time of the first data packet, which can be understood here as notifying the audio module to obtain data for decoding as soon as possible after receiving the first data packet.
  • T1 Tr1.
  • the audio module can directly decode the first data to be decoded after unpacking, or it can first store the first data to be decoded in the communication storage area (such as Bluetooth buffer) and wait for the audio module to read and decode.
  • S1103 Divide the first data into a first part of data and a second part of data in a playback order, wherein the first part of data is stored in a first area of a first storage area, the first area is close to the second storage area, the second part of data is stored in a second area of the second storage area, the second area is close to the first storage area, and the first part of data is adjacent to the second part of data.
  • first storage area and the second storage area are two adjacent storage areas, so the first data can be placed separately in the two storage areas, and the first part of the data is further stored in the first storage area near the second storage area, so that the first data can be decoded and stored by playing the front part of the first storage area.
  • first part of the data is adjacent to the second part of the data, indicating that the first part of the data and the second part of the data are to be continuous when playing, for example, including the adjacent parts of two adjacent buffers.
  • the first portion of data is stored in the second half of the first storage area
  • the second portion of data is stored in the first half of the second storage area
  • the first portion of data and the second portion of data are adjacent. That is, the first data is evenly divided into two parts, one half is placed in the second half of the first storage area, and the other half is placed in the first half of the second storage area.
  • the first data may be unequally divided into two parts, for example, the first half may exceed the second half of the first storage area, that is, a part of the data is stored in the first half of the first storage area.
  • the first half may exceed the second half of the first storage area, that is, a part of the data is stored in the first half of the first storage area.
  • S1104 After reading the first storage area, trigger the acquisition of data from the third storage area for decoding to obtain second data.
  • T2 is when the first storage area is read.
  • a first interrupt request is generated at time T2, and data is obtained from the third storage area in response to the first interrupt request for decoding to obtain the second data.
  • the third storage area can refer to the previous description.
  • the timestamps corresponding to two adjacent frames of data differ by one frame duration. Therefore, when the first storage area is read, the second data is generally received by the audio playback device.
  • S1105 Divide the second data into a third part of data and a fourth part of data according to the playback order, store the third part of data in an area of the second storage area except the second area; store the fourth part of data in an area of the first storage area except the first area.
  • the first storage area, the second storage area or the fourth storage area in this embodiment can be set to the size of one frame of data.
  • This solution can be applied to the ping-pang buffer.
  • the ping buffer and the pang buffer will be read and played in a loop. Therefore, the storage method of this embodiment can ensure low latency and continuity of data playback.
  • the second data is divided equally into a third portion of data and a fourth portion of data in sequence, the third portion of data is stored in the second half of the second storage area, and the fourth portion of data is stored in the first half of the first storage area.
  • S1105 can be replaced by: dividing the second data into a third portion of data and a fourth portion of data, storing the third portion of data in an area of the second storage area other than the second area; storing the fourth portion of data in a third area of the fourth storage area, and the third portion of data and the fourth portion of data are adjacent.
  • the above low-latency playback method also includes:
  • S1106 Generate a second interrupt request at a third time T3, and obtain data from the third storage area in response to the second interrupt request and decode to obtain third data.
  • the third storage area can be used to store one or more of the first data to be decoded, the second data to be decoded, and the third data to be decoded; other valid data to be decoded can also be stored.
  • the interval between two subsequent adjacent interrupt requests needs to maintain the duration of at least one frame of data to ensure packet reception.
  • the T3 time is when the second storage area is read, or it can be when the first storage area is started to be read, or it can be when the fourth storage area is started to be read.
  • S1107 Sequentially divide the third data into a fifth part of data and a sixth part of data, and store them according to a third storage rule.
  • the fifth part of the third data can be stored in the second half of the ping buffer, and the sixth part of the third data can be stored in the first part of the pang buffer.
  • Ring buffers, etc. can be stored according to relevant rules, which will not be described in detail.
  • the data in the playback storage area can be continuously read and played, for example, the data in the playback storage area can be moved by DMA, and then input to the speaker for playback after conversion by DAC. It can be seen that playback and decoding storage can be parallel. In order to ensure the continuity and low latency of playback, it is necessary to reasonably set the decoding timing and playback timing. The timing when the code obtains the first data and the way of storing the first data can reduce the delay, and further, the continuity of subsequent playback can be guaranteed by reasonably setting the interrupt request.
  • example B is described by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
  • S1200 The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
  • the headset divides the first data into a first part of data and a second part of data according to a playback order, the first part of data is stored in the second half of the ping buffer, the second part of data is stored in the first half of the pang buffer, and the first part of data is adjacent to the second part of data;
  • the headset divides the second data into a third part of data and a fourth part of data in order, stores the third part of data in the second half of the pang buffer, and stores the fourth part of data in the first half of the ping buffer;
  • the headset divides the third data into the fifth part of data and the sixth part of data in sequence, and stores the fifth part of data in the second half of the ping buffer and stores the sixth part of data in the first half of the pang buffer.
  • the headset does not need to adjust the logic design of the interrupt compared with the related example of embodiment A, and only needs to modify the storage logic of the decoded data in the ping pang buffer.
  • the headset receives the first data packet seq1 (first packet)
  • the headset does not wait for the first storage area to be played before decoding, but notifies the audio module to decode to obtain the first data at the reception time Tr1 of the first data, and at the same time, the first data is split into two half-frame data according to the playback order, the first half-frame data is placed in the second half of the ping buffer, and the second half-frame data is placed in the first half of the pang buffer, that is, the ping pang buffer places each half-frame data of the first data.
  • Tt (trigger time) is set to the timestamp Ts1 corresponding to the first data.
  • the DMA starts to play (render) to the half-frame position of the ping buffer
  • the first data can start to play, so that the playback delay of the first data is the delay of half a frame.
  • the system will generate a preset first interrupt request, and the interrupt request interval is at least equal to the frame period frame_duration.
  • the audio module receives the interrupt request, it will start to get a frame of data from the third storage area (Bluetooth buffer) to decode and obtain the second data, and split the second data into two half-frames of data.
  • the first half-frame of data is placed in the second half of the pang buffer, and the second half-frame of data is placed in the first half of the ping buffer.
  • the subsequent process is analogous.
  • Embodiment C provides a low-latency playback method, which can be improved on the basis of embodiment B, and S1102 in embodiment B is modified to: trigger decoding at the playback trigger time Tt to obtain the first data.
  • the other parts can be carried out with reference to the relevant steps of embodiment B, which will not be described in detail here.
  • Embodiment C can also control the delay of the half-frame data length while ensuring the continuity of playback.
  • the following example C is illustrated by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
  • the headset receives the first data packet sent by the mobile phone at time Tr1, unpacks it and stores it in the Bluetooth buffer;
  • the headset divides the first data into a first part of data and a second part of data according to a playback order, the first part of data is stored in the second half of the ping buffer, and the second part of data is stored in the first half of the pang buffer, and the first part of data and the second part of data are adjacent to each other;
  • the headset divides the second data into a third part of data and a fourth part of data in order, stores the third part of data in the second half of the pang buffer, and stores the fourth part of data in the first half of the ping buffer;
  • the headset divides the third data into the fifth part of data and the sixth part of data in sequence, and stores the fifth part of data in the second half of the ping buffer and stores the sixth part of data in the first half of the pang buffer.
  • Embodiment C adjusts the time for triggering decoding to obtain the first data from moment Tr1 to moment Tt.
  • the reason for this adjustment is that, after research by the inventor, it is believed that the duration of half-frame data is sufficient to decode and store the first data. Therefore, triggering decoding from moment Tt to obtain the first data is also sufficient to ensure half-frame delay and continuous playback.
  • the effect is similar to that of Embodiment B, except that the timing of the first interrupt request design is different.
  • a more accurate decoding to storage time can be determined through more precise calculations, so as to further adjust the timing of triggering decoding to obtain the first data or the storage location, and even the delay may be shortened to less than half a frame duration, all of which fall within the scope of protection of the present application.
  • Embodiment D as shown in FIG14 , provides a low-delay playback method capable of controlling the delay of only one frame of data, including:
  • S1400 Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
  • S1400 can refer to S1100.
  • S1401 Obtain a timestamp Ts1 corresponding to the first data, and use Ts1 as Tt; when Tt arrives, read and play from a first preset position in the first storage area.
  • S1402 Trigger decoding upon receiving a first data packet to obtain first data.
  • S1402 can refer to S1102.
  • the second storage area can be the pang buffer of the ping-pang buffer, the second buffer of the ring buffer, or a part of other storage areas, and there is no limitation on this.
  • S1404 After reading the first storage area, trigger the acquisition of data from the third storage area for decoding to obtain second data.
  • S1404 can refer to the relevant description of S1104.
  • the first storage area may be a ping buffer of a ping-pang buffer, or may be the third storage area of a ring buffer.
  • S1405 may be replaced by: storing the second data in the fourth storage area.
  • the fourth storage area may be a storage area adjacent to the second storage area.
  • Embodiment D there may be a third frame of data in Embodiment D.
  • the third data is a frame of data after the second data.
  • the third data can continue to be stored with reference to the first data.
  • Different buffer types may have different storage methods. You can refer to the previous storage rules for storage and playback, which will not be repeated here.
  • the technical features in Embodiment D are applicable to ping-pang buffers and circular buffers when there is no conflict, and can also be applied to other types of storage methods.
  • Embodiment D can satisfy that time T1 is earlier than the time when the first storage area is read for the first time since time Tt, Tt is earlier than or equal to T2, and the setting of T2 ensures that the audio playback device has received the second data sent by the sound source device at time T2.
  • example D is described by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
  • S1500 The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
  • the headset stores the first data in pang buffer
  • the headset stores the second data in the ping buffer
  • the headset can notify the headset audio module to decode the first packet of data at the time Tr1 when the headset receives the first data packet seq1.
  • the headset does not need to wait for the interrupt request dma_irq generated when the first storage area is read. Instead, the first data is triggered to decode and obtain the first data at the time Tr1 of receiving the first data, and the first data is placed in the second storage area, such as pang buffer.
  • the play trigger time Tt is set to the timestamp Ts1 corresponding to the first data, so that the theoretical delay of the first data is a delay of the length of a ping buffer, that is, a frame length of 7.5ms/10ms, because the first data has been placed in the pang buffer in advance, when the pang buffer is played, the headset can start to sound, and at this time, the distance from the headset start point, that is, Tt, is exactly a buffer, such as a frame time.
  • render_time reaches the starting point of the pang buffer, that is, the first interrupt cycle irq_intervel has been experienced, and a preset first interrupt request will be generated at this time, and the audio module starts to get data from the Bluetooth buffer to decode and obtain the second data, and places the second data in the ping buffer.
  • Embodiment E provides a low-delay playback method, which can be improved on the basis of embodiment D, so as to control the delay of one frame of data and ensure the continuity of playback.
  • Tr1 moment for example, when the first data packet is received
  • decoding is triggered to obtain the first data.
  • T1 can also be set in other ways, for example, T1 is any moment from Tr1 to the first playback to the second preset position, and the time from the second preset position to the completion of the playback of the first storage area is sufficient to decode and store the first data in the second storage area.
  • the first data is stored in the second storage area.
  • This embodiment can control the delay in one frame and ensure the continuity of playback.
  • the scheme of embodiment E can be adjusted on the basis of embodiment D, for example, S1402 is replaced by: triggering decoding to obtain the first data at any moment from Tr1 to the first playback to the second preset position.
  • the time from the second preset position to the completion of the playback of the first storage area is sufficient to decode and store the first data in the second storage area.
  • a preset position of the playback storage area is used, such as the first preset position and the second preset position, and a preset moment is also used, such as Ta, Tb, Tc, Td, etc., but their functions are similar, have correspondence when there is no conflict, and can be interchangeable.
  • Embodiments A-E can all satisfy that T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt. It can be seen that by optimizing the settings of Tt, T1, T2, and storage rules, low latency of audio playback can be achieved, while ensuring the continuity of audio playback, thereby improving user experience.
  • the TWS audio playback device may include a first audio playback device and a second audio playback device.
  • the first audio playback device and the second audio playback device can both apply the low-latency playback method of some of the above embodiments.
  • the first audio playback device and the second audio playback device receive data packets sent by the audio source device.
  • the data packets received by the two devices may be the same or different.
  • the first audio playback device receives left channel data
  • the second audio playback device receives right channel data.
  • the left and right channel data corresponding to a frame of data have the same timestamp, thereby ensuring that the first audio playback device and the second audio playback device can play audio synchronously.
  • a low-latency playback method is provided, which is applied to a playback device, the playback device comprising a first audio playback device and a second audio playback device, the first audio playback device and the second audio playback device respectively having a playback storage area described in any of the foregoing embodiments, the first audio playback device and the second audio playback device respectively executing the method described in any of the foregoing embodiments (for specific steps, see the foregoing embodiments, which are not described in detail here) to achieve synchronous playback, wherein first data of the first audio playback device and first data of the second audio playback device have the same timestamp Ts1; second data of the first audio playback device and second data of the second audio playback device have the same timestamp Ts2; Tt is determined according to Ts1, so that the first audio playback device and the second audio playback device can start reading their respective playback storage areas for playback at the same playback triggering time Tt, in addition, the first audio playback device and the
  • the first data of the first audio playback device and the first data of the second audio playback device may be the same. In some embodiments, the first data of the first audio playback device and the first data of the second audio playback device may also be different, for example, one is the left channel and the other is the right channel.
  • the first audio playback device is the left earphone of the TWS headset
  • the second audio playback device is the right earphone of the TWS headset.
  • the timestamp corresponding to each frame of data played by the first audio playback device is the same as the timestamp corresponding to each frame of data played by the second audio playback device, thereby ensuring the synchronous playback of each frame of data by the first audio playback device and the second audio playback device, so that the sound heard by the user remains consistent.
  • Each of the corresponding frames can be understood as a frame of data with the same synchronization reference time sent to the first audio playback device and the second audio playback device respectively.
  • T1 needs to be set earlier than T2, that is, the first data is decoded first, and then the second data is decoded, and T1 is set earlier than the moment when the first storage area is read for the first time since Tt, that is, decoding and storage can be triggered earlier, so that the audio delay can be reduced earlier, and Tt is set earlier than or equal to T2 and T2 is set to ensure that the audio playback device has received the second data sent by the sound source device at T2, that is, there is no need to wait for the second data to be decoded to start playback, avoiding delayed playback and increasing delay, and ensuring that the second data has been received at T2, so as to ensure that the next frame of data can be decoded to obtain the second data, thereby ensuring the continuity of data playback.
  • the present application also provides a low-latency playback device, the low-latency playback device comprising: a playback storage area, the playback storage area comprising a first storage area and a second storage area;
  • a playing module configured to read and play the playing storage area from the first preset position of the first storage area when the playing triggering moment Tt arrives;
  • the audio module is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
  • T1 is equal to or later than the time Tr1 when the first data is received
  • T2 is equal to or later than the time Tr2 when the second data is received
  • T2 is equal to or later than Tt
  • the first data starts to be played before the second storage area is read for the first time since Tt.
  • the device also includes: a communication module, the communication module includes a wireless transceiver and a communication storage area, the wireless transceiver is configured to receive a data packet sent by a sound source device, and the communication storage area is configured to store data to be decoded carried in the data packet, and the data to be decoded includes first data to be decoded and/or second data to be decoded.
  • a communication module includes a wireless transceiver and a communication storage area
  • the wireless transceiver is configured to receive a data packet sent by a sound source device
  • the communication storage area is configured to store data to be decoded carried in the data packet
  • the data to be decoded includes first data to be decoded and/or second data to be decoded.
  • the wireless transceiver is configured to sequentially receive a first data packet and a second data packet sent by a sound source device, wherein the first data packet contains first data to be decoded and the second data packet contains second data to be decoded; and store the first data to be decoded and/or the second data to be decoded in a communication storage area.
  • the audio module is configured to store the first data in a first storage area; and store the second data in a second storage area.
  • the playback triggering time Tt is determined according to the timestamp Ts1 corresponding to the first data and the first preset time period; the first preset time period is sufficient to decode and obtain the first data and store the first data in the first storage area.
  • the first preset time period is less than the total time of reading the first storage area and the second storage area; thus, the playback delay can be guaranteed to be less than the total time of reading the first storage area and the second storage area. If the first storage area and the second storage area are both one frame long, the delay can be guaranteed to be less than two frames.
  • T1 is earlier than or equal to Ta, and the time from Ta to Tt is sufficient to decode the first data and store it in the first storage area; thereby ensuring that decoding at T1 can store the first data in the first storage area before Tt arrives, so that there will be no delay in the playback phase after Tt. From the user's perspective, the sound can be heard when Tt arrives.
  • T2 is earlier than or equal to Tb, and the time from Tb to the completion of reading the first data is sufficient to decode the second data and store the second data in the second storage area, so that the second data can be played immediately after the first data is played, ensuring the continuity of data playback.
  • the audio module is configured to divide the first data into a first portion of data and a second portion of data in a playback order, and store the first portion of data in a first area of the first storage area and the second portion of data in a second area of the second storage area according to a first storage rule, wherein the first area is adjacent to the second area; the audio module is configured to divide the second data into a third portion of data and a fourth portion of data in a playback order, and store the third portion of data in an area of the second storage area excluding the second area according to a second storage rule; and store the fourth portion of data in an area of the second storage area excluding the second area according to a second storage rule.
  • the data is stored in an area other than the first area in the first storage area; or
  • the audio module is configured to divide the second data into a third part of data and a fourth part of data, and store the third part of data in an area of the second storage area except the second area according to the second storage rule; and store the fourth part of data in a third area of the fourth storage area, the third area is adjacent to the second storage area, and the fourth storage area is a storage area in the playback storage area adjacent to the second storage area.
  • T1 is earlier than or equal to Tc, and the time from Tc to the time of reading the first storage area for storing the first data is sufficient to decode the first data and store the first data according to the first storage rule of this embodiment, so as to ensure that there is sound output when the position for storing the first data is read;
  • T2 is earlier than or equal to Td, and the time from Td to the time of reading the first data is sufficient to decode the second data and store the second data according to the second rule, so as to ensure the continuity of the playback of the second data and the first data;
  • Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and in some embodiments, the second preset time can be less than the total time of reading the first storage area and reading half of the second storage area.
  • the setting of the second preset time ensures that the playback delay is less than the total time of reading the first storage area and the
  • the audio playback device is configured to equally divide the first data into a first portion of data and a second portion of data, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent; to equally divide the second data into a third portion of data and a fourth portion of data, the third portion of data is stored in the second half of the second storage area, the fourth portion of data is stored in the first half of the first storage area, or the fourth portion of data is stored in the first half of the fourth storage area, and the third portion of data is adjacent to the fourth portion of data.
  • the audio module stores the first data in the second storage area according to the first storage rule; stores the second data in the first storage area according to the second storage rule; or stores the second data in the fourth storage area, which is a storage area in the playback storage area adjacent to the second storage area.
  • T1 is earlier than or equal to Te, and the time from Te to reading the first storage area is sufficient to decode the first data and store the first data in the second storage area, thereby ensuring the playback of the first data and reducing latency.
  • T2 is less than or equal to Tf, and the time from Tf to the completion of reading the first data is sufficient to decode the second data and store the second data in the first storage area or the fourth storage area, thereby ensuring the continuity of the playback of the first data and the second data.
  • Tt is determined based on the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0 and less than the duration of reading the first storage area, thereby ensuring that the delay of the first data is controlled within the total duration of reading the first storage area and the second storage area.
  • the playback trigger time Tt is equal to the sum of the timestamp Ts1 corresponding to the first data and the duration of the half-frame data.
  • the audio module is configured to trigger decoding to obtain the first data when the communication module receives the first data packet.
  • the audio module is configured to trigger decoding to obtain the second data when the playback module reads a middle position of the first storage area.
  • the audio module is configured to trigger decoding to obtain the second data when the playback module reads the end position of the first storage area.
  • Tt is equal to the timestamp Ts1 corresponding to the first data.
  • the audio module is configured to trigger decoding at a play triggering time Tt to obtain the first data.
  • the audio module is configured to obtain data in response to a first interrupt request generated at a second time T2 to decode and obtain second data.
  • the audio module is configured to, in response to generating a second interrupt request at a third time T3, obtain data for decoding to obtain third data, and store the third data in the playback storage area according to a third storage rule;
  • the time interval between the first interrupt request and the second interrupt request is at least the duration of a frame of data.
  • the first storage area is a ping buffer
  • the second storage area is a pong buffer; or, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer.
  • the audio playback device and the audio source device communicate via LE Audio Bluetooth technology.
  • the first data and the second data are both one frame of data; the first storage area and the second storage area are both for storing one frame of data. the size of.
  • T2 is less than or equal to Td, and the time from Td to the completion of reading the first data is sufficient to decode and obtain the second data and store the second data according to the second storage rule.
  • the above embodiments, implementation methods and related technical features can be combined with each other to correspond to the previous embodiments, such as embodiments A-E, when they do not conflict, and will not be described in detail.
  • the playback delay of the first data such as the first frame data of music
  • the continuity of audio playback can be guaranteed by setting parameters such as T1, T2, storage rules, etc., thereby improving the user experience.
  • the embodiment of the present application provides an audio playback device, comprising: a playback buffer area, the playback buffer area comprising a first buffer area and a second buffer area;
  • the decoding unit is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
  • a playback unit configured to read and play the playback storage area from a first preset position in the first storage area when a playback triggering moment Tt arrives;
  • T1 is equal to or later than the time Tr1 when the audio playback device receives the first data
  • T2 is equal to or later than the time Tr2 when the audio playback device receives the second data
  • T2 is equal to or later than Tt
  • the first data starts to play before the second storage area is read for the first time since Tt.
  • the playback unit includes a digital-to-analog converter DAC and a speaker
  • the digital-to-analog converter is configured to perform digital-to-analog conversion on the data in the playback storage area
  • the speaker is configured to play the data after the digital-to-analog conversion
  • the audio playback device also includes: a communication module, the communication module includes a wireless transceiver and a communication buffer area, the wireless transceiver is configured to receive a data packet sent by the audio source device, and the communication buffer area is configured to store the data to be decoded carried in the data packet, and the data to be decoded includes first data to be decoded and/or second data to be decoded.
  • a communication module includes a wireless transceiver and a communication buffer area
  • the wireless transceiver is configured to receive a data packet sent by the audio source device
  • the communication buffer area is configured to store the data to be decoded carried in the data packet
  • the data to be decoded includes first data to be decoded and/or second data to be decoded.
  • An embodiment of the present application discloses an electronic device, comprising at least one processor, at least one wireless transceiver and at least one memory, wherein the memory stores a computer program, and the computer program is executed by the at least one processor so that the electronic device executes any one of the low-latency playback methods described in the above embodiments.
  • An embodiment of the present application discloses a storage medium storing a computer program, wherein when the computer program is executed by a processor, an audio playback device implements any one of the low-latency playback methods described in the above embodiments.
  • the storage medium can be a disk, an optical disk, a ROM, etc.
  • any reference to memory, storage, database, or other medium may include nonvolatile and/or volatile memory.
  • Suitable nonvolatile memory may include ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or flash memory.
  • Volatile memory may include random access memory (RAM), which is used as external cache memory.
  • RAM can be in many forms, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus DRAM (RDRAM) and direct Rambus dynamic RAM (DRDRAM).
  • the units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
  • each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
  • the above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

Landscapes

  • Health & Medical Sciences (AREA)
  • Otolaryngology (AREA)
  • Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Acoustics & Sound (AREA)
  • Signal Processing (AREA)
  • General Health & Medical Sciences (AREA)
  • Signal Processing For Digital Recording And Reproducing (AREA)

Abstract

The present application relates to a low-delay playing method and apparatus, and an electronic device and a storage medium. The method is applied to an audio playing device with a playing storage area, wherein the playing storage area comprises a first storage area and a second storage area. The method comprises: when a playing trigger moment Tt arrives, reading a playing storage area from a first preset position of a first storage area, and performing playing; triggering decoding at a first moment T1, so as to obtain first data, and storing the first data in a playing storage area according to a first storage rule; and triggering decoding at a second moment T2, so as to obtain second data, and storing the second data in the playing storage area according to a second storage rule, wherein T1 is the same as or later than the time Tr1 of an audio playing device receiving the first data, T2 is the same as or later than the time Tr2 of the audio playing device receiving the second data, T2 is later than Tt, and the first data starts to be played before first reading of a second storage area from Tt.

Description

低延时播放方法、装置、电子设备和存储介质Low-delay playback method, device, electronic device and storage medium
本申请要求于2022年11月18日提交中国专利局、申请号为202211449488.7、申请名称为“低延时播放方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to the Chinese patent application filed with the China Patent Office on November 18, 2022, with application number 202211449488.7 and application name “Low-latency playback method, device, electronic device and storage medium”, the entire contents of which are incorporated by reference in this application.
技术领域Technical Field
本申请涉及音频领域,特别是涉及一种低延时播放方法、装置、电子设备和存储介质。The present application relates to the field of audio, and in particular to a low-latency playback method, device, electronic device and storage medium.
背景技术Background technique
随着无线耳机等无线音频播放设备的广泛应用,特别是蓝牙真无线(TWS,True wireless stereo)技术的发展,与传统有线耳机相比,无线音频技术的播放延时问题更受用户的关注。With the widespread application of wireless audio playback devices such as wireless headphones, especially the development of Bluetooth true wireless (TWS, True wireless stereo) technology, the playback delay problem of wireless audio technology has attracted more attention from users compared to traditional wired headphones.
发明内容Summary of the invention
本申请实施例提供了一种低延时播放方法、装置、电子设备和存储介质。Embodiments of the present application provide a low-latency playback method, device, electronic device, and storage medium.
第一方面,提供一种低延时播放方法,应用于音频播放设备,音频播放设备包括播放存储区,播放存储区包括第一存储区和第二存储区,该方法包括:在播放触发时刻Tt到来时从第一存储区的第一预设位置开始读取播放存储区并播放;在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;其中,T1等于或晚于音频播放设备接收到第一数据的时间Tr1,T2等于或晚于音频播放设备接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次读取完第二存储区前开始播放。In a first aspect, a low-latency playback method is provided, which is applied to an audio playback device, wherein the audio playback device includes a playback storage area, and the playback storage area includes a first storage area and a second storage area. The method includes: when a playback trigger time Tt arrives, the playback storage area is read from a first preset position in the first storage area and played; at a first time T1, decoding is triggered to obtain first data, and the first data is stored in the playback storage area according to a first storage rule; at a second time T2, decoding is triggered to obtain second data, and the second data is stored in the playback storage area according to a second storage rule; wherein T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, and T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt.
第二方面,提供一种低延时的播放方法,应用于音频播放设备,该音频放设备包括第一音频播放设备和第二音频播放设备,第一音频播放设备和第二音频播放设备分别具有如第一方面所述的播放存储区,第一音频播放设备和第二音频播放设备分别执行如第一方面所述的方法以实现同步播放,其中,第一音频播放设备的第一数据和第二音频播放设备的第一数据具有相同的时间戳Ts1;第一音频播放设备的第二数据和第二音频播放设备的第二数据具有相同的时间戳Ts2;Tt根据Ts1确定。In a second aspect, a low-latency playback method is provided, which is applied to an audio playback device, wherein the audio playback device includes a first audio playback device and a second audio playback device, the first audio playback device and the second audio playback device respectively having a playback storage area as described in the first aspect, the first audio playback device and the second audio playback device respectively execute the method as described in the first aspect to achieve synchronous playback, wherein first data of the first audio playback device and first data of the second audio playback device have the same timestamp Ts1; second data of the first audio playback device and second data of the second audio playback device have the same timestamp Ts2; Tt is determined based on Ts1.
第三方面,提供了一种低延时播放装置,该低延时播放装置包括:播放存储区,播放存储区包括第一存储区和第二存储区;In a third aspect, a low-latency playback device is provided, the low-latency playback device comprising: a playback storage area, the playback storage area comprising a first storage area and a second storage area;
播放模块,被配置用于在播放触发时刻Tt到来时从第一存储区的第一预设位置开始读取播放存储区并播放;A playing module, configured to read and play the playing storage area from the first preset position of the first storage area when the playing triggering moment Tt arrives;
音频模块,被配置用于在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;其中,T1等于或晚于接收到第一数据的时间Tr1,T2等于或晚于接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次读取完第二存储区前开始播放。The audio module is configured to trigger decoding at a first moment T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second moment T2 to obtain second data, and store the second data in a playback storage area according to a second storage rule; wherein T1 is equal to or later than the time Tr1 when the first data is received, T2 is equal to or later than the time Tr2 when the second data is received, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time starting from Tt.
第四方面,一种音频播放设备,包括:播放缓存区,播放缓存区包括第一缓存区和第二缓存区;In a fourth aspect, an audio playback device includes: a playback buffer area, the playback buffer area includes a first buffer area and a second buffer area;
解码单元,被配置用于在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;The decoding unit is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
播放单元,被配置用于在播放触发时刻Tt到来时从第一存储区的第一预设位置开始读取播放存储区并播放;A playback unit, configured to read and play the playback storage area from a first preset position in the first storage area when a playback triggering moment Tt arrives;
其中,T1等于或晚于音频播放设备接收到第一数据的时间Tr1,T2等于或晚于音频播放设备接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次读取完第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt.
第五方面,提供了一种电子设备,包括:至少一个处理器、至少一个无线收发器和至少一个存储器,其中存储器存储有计算机程序,计算机程序由电子设备执行如前述方面中任意一项的方法。In a fifth aspect, an electronic device is provided, comprising: at least one processor, at least one wireless transceiver and at least one memory, wherein the memory stores a computer program, and the computer program is executed by the electronic device to perform a method as described in any one of the preceding aspects.
第六方面,提供了一种存储介质,存储有计算机程序,计算机程序被音频播放设备执行时实现如前 述方面中任意一项的方法。In a sixth aspect, a storage medium is provided, which stores a computer program, and when the computer program is executed by an audio playback device, the The method of any one of the above aspects.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
图1A为一些实施例中音频播放设备与音源设备无线通信的示意图;FIG1A is a schematic diagram of wireless communication between an audio playback device and an audio source device in some embodiments;
图1B为一些实施例中手机与TWS耳机的无线通信的示意图;FIG1B is a schematic diagram of wireless communication between a mobile phone and a TWS headset in some embodiments;
图2为一些实施例中切换低延时模式的流程图;FIG2 is a flow chart of switching to a low latency mode in some embodiments;
图3为一些实施例中游戏低延时模式切换流程图;FIG3 is a flowchart of switching a low-latency mode of a game in some embodiments;
图4为一种基于LE Audio蓝牙技术的全链路延时示意图;Figure 4 is a schematic diagram of full-link delay based on LE Audio Bluetooth technology;
图5为一些实施例中手机与TWS耳机之间数据传输示意图;FIG5 is a schematic diagram of data transmission between a mobile phone and a TWS headset in some embodiments;
图6为一些实施例中蓝牙音频播放设备的数据处理架构图;FIG6 is a diagram of a data processing architecture of a Bluetooth audio playback device in some embodiments;
图7为一种pingpang buffer解码存储与播放示意图;Figure 7 is a schematic diagram of pingpang buffer decoding storage and playback;
图8为一些实施例中低延时播放基本流程图;FIG8 is a basic flow chart of low-latency playback in some embodiments;
图9为实施例A中的一种低延时播放流程图;FIG9 is a low-latency playback flow chart in Example A;
图10为实施例A中的一种耳机低延时播放流程图;FIG10 is a flowchart of low-latency playback of headphones in Example A;
图11为实施例B中的一种低延时播放流程图;FIG11 is a low-latency playback flow chart in Example B;
图12为实施例B中的一种耳机低延时播放流程图;FIG12 is a flowchart of low-latency playback of headphones in Example B;
图13实施例C中的一种耳机低延时播放流程图;FIG13 is a flowchart of low-latency headphone playback in Example C;
图14实施例D中的一种低延时播放流程图;FIG14 is a low-latency playback flow chart in Embodiment D;
图15实施例D中的一种耳机低延时播放流程图。FIG15 is a flowchart of low-latency playback of headphones in Example D.
具体实施方式Detailed ways
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
需要说明的是,本申请实施例及附图中的术语“包括”和“具有”以及它们任何变形,意图在于覆盖不排他的包含。例如包含了一系列步骤或单元的过程、方法、系统、产品或设备没有限定于已列出的步骤或单元,而是可选地还包括没有列出的步骤或单元,或可选地还包括对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "including" and "having" and any variations thereof in the embodiments of the present application and the accompanying drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device including a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products or devices.
可以理解,本申请所使用的术语“第一”、“第二”等可在本文中用于描述各种元件,但这些元件不受这些术语限制,没有特别说明的情况下,这些术语仅用于将一个元件与另一个元件区分。本申请所使用的术语“多个”指的是两个及两个以上。本申请所使用的术语“和/或”指的是其中的一种方案,或是其中多种方案的任意组合。It is understood that the terms "first", "second", etc. used in this application can be used in this article to describe various elements, but these elements are not limited by these terms. Without special instructions, these terms are only used to distinguish one element from another element. The term "plurality" used in this application refers to two or more. The term "and/or" used in this application refers to one of the solutions, or any combination of multiple solutions.
随着无线耳机等无线音频播放设备的广泛应用,特别是蓝牙真无线(TWS,True wireless stereo)技术的发展,与传统有线耳机相比,无线音频技术的播放延时问题更受用户的关注,特别是TWS蓝牙耳机玩游戏等场景,声音延迟高一直是手游体验的痛点。With the widespread application of wireless audio playback devices such as wireless headphones, especially the development of Bluetooth true wireless (TWS, True wireless stereo) technology, the playback delay problem of wireless audio technology has attracted more attention from users compared to traditional wired headphones, especially in scenarios such as playing games with TWS Bluetooth headphones, high sound delay has always been a pain point in mobile gaming experience.
如图1A所示,音频播放设备100通过无线链路与音源设备200进行无线通信,音源设备100将音频数据等通过无线链路传输给音频播放设备200进行播放,该无线链路可以基于蓝牙技术。以LE Aduio蓝牙技术为例,LE Audio是蓝牙SIG联盟推的一项新的音频传输技术,给人们带来更低功耗、更低成本、更高质量、以及更低延迟的无线音频服务,区别于传统的经典蓝牙,能够支持LC3(Low Complexity Communications Codec,低功耗音频编解码)等编码的音频数据,使得音频数据的传输能够更好地兼顾功耗、实时性及音质等各方面的问题。如图1B所示,提供了一种应用LE Audio蓝牙技术的TWS耳机与手机组网的场景,左耳机201、右耳机202与手机100之间可以分别建立基于LE Audio的蓝牙传输链路,例如连接同步流(Connected Isochronous Stream,简称CIS),本申请的一些实施例能够在保障左右 耳机同步播放的同时进一步降低音频延时。需要说明的是,本申请可以基于LE Aduio蓝牙技术进行举例,在不冲突的情况下也可以适用于其他无线通信技术。As shown in FIG1A , the audio playback device 100 communicates wirelessly with the sound source device 200 via a wireless link, and the sound source device 100 transmits the audio data to the audio playback device 200 via the wireless link for playback, and the wireless link can be based on Bluetooth technology. Taking LE Aduio Bluetooth technology as an example, LE Audio is a new audio transmission technology promoted by the Bluetooth SIG Alliance, which brings people wireless audio services with lower power consumption, lower cost, higher quality, and lower latency. Different from the traditional classic Bluetooth, it can support audio data encoded by LC3 (Low Complexity Communications Codec, low-power audio codec), so that the transmission of audio data can better balance power consumption, real-time performance, sound quality and other aspects. As shown in FIG1B , a scenario of TWS headphones and mobile phone networking using LE Audio Bluetooth technology is provided. A Bluetooth transmission link based on LE Audio can be established between the left earphone 201, the right earphone 202 and the mobile phone 100, such as a Connected Isochronous Stream (CIS for short). Some embodiments of the present application can ensure that the left and right earphones are connected to each other. The earphones play synchronously while further reducing audio delay. It should be noted that the present application can be exemplified based on LE Aduio Bluetooth technology, and can also be applied to other wireless communication technologies without conflict.
需要说明的,LE audio蓝牙底层发包和经典蓝牙BT不同,底层主要通过ISO通道进行发包,其中基于连接的方式称为连接同步流(Connected Isochronous Stream,简称CIS),基于广播数据的方式成为广播同步流(Broadcast Isochronous Stream,简称BIS)。以基于CIS的方式为例,CIS与传统蓝牙传输方式相比,CIS采用的是同步传输的机制,也就是发送端发包的重传次数是有限制,与BT的无限重传机制有质的区别,这也是CIS能做到更低延时的原因之一。但是在一些特定场景,仍然需要更低的延时来满足用户需求,例如游戏场景。It should be noted that the underlying packet transmission of LE audio Bluetooth is different from that of classic Bluetooth BT. The underlying layer mainly transmits packets through ISO channels. The connection-based method is called Connected Isochronous Stream (CIS for short), and the broadcast data-based method is called Broadcast Isochronous Stream (BIS for short). Taking the CIS-based method as an example, compared with the traditional Bluetooth transmission method, CIS adopts a synchronous transmission mechanism, that is, the number of retransmissions of the packet sent by the sender is limited, which is qualitatively different from the unlimited retransmission mechanism of BT. This is one of the reasons why CIS can achieve lower latency. However, in some specific scenarios, lower latency is still required to meet user needs, such as gaming scenarios.
在一些实施例中,如图2所示,基于LE Audio技术的低延时模式切换的方法,包括:In some embodiments, as shown in FIG2 , a method for switching to a low latency mode based on LE Audio technology includes:
S200:音源设备确定进入预设模式后,通知音频播放设备以使得音频播放设备进入低延时模式;S200: After the audio source device determines to enter the preset mode, it notifies the audio playback device to make the audio playback device enter the low latency mode;
S201:音源设备在预设模式下更新CIS参数,CIS参数包括:数据包的重传次数;S201: The audio source device updates CIS parameters in a preset mode, where the CIS parameters include: the number of retransmissions of a data packet;
S202:音源设备确定退出预设模式时,通知音频播放设备退出低延时模式,并更新CIS参数。S202: When the audio source device determines to exit the preset mode, it notifies the audio playback device to exit the low-latency mode and updates the CIS parameters.
其中,预设模式可以是游戏模式,如图3所示,以手机作为音源设备,耳机作为音频播放设备应用LE Audio蓝牙技术的情况下进行游戏低延时模式切换的流程举例,可见,手机在与耳机保持LE Audio蓝牙连接的情况下,如果手机进入游戏,则会通知耳机当前已进入游戏模式,耳机响应于手机的通知会进入游戏低延时模式,切换成低延时参数。而手机在进入游戏后会切换成游戏低延时模式的CIS参数,主要是降低手机发包的重传次数,以此达到更低的传输时延(transport latency);当有CIS数据流时与耳机建立CIS,并基于低延时模式下的CIS参数与耳机进行通信;当手机退出游戏时,通知耳机退出游戏低延时模式,并更新CIS参数。Among them, the preset mode can be a game mode. As shown in Figure 3, the process of switching the game low-latency mode is taken as an example when the mobile phone is used as the sound source device and the headset is used as the audio playback device and the LE Audio Bluetooth technology is applied. It can be seen that when the mobile phone maintains the LE Audio Bluetooth connection with the headset, if the mobile phone enters the game, it will notify the headset that it has entered the game mode. In response to the notification of the mobile phone, the headset will enter the game low-latency mode and switch to the low-latency parameters. After entering the game, the mobile phone will switch to the CIS parameters of the game low-latency mode, mainly to reduce the number of retransmissions of the mobile phone's packets, so as to achieve a lower transmission latency; when there is a CIS data stream, CIS is established with the headset, and communication is carried out with the headset based on the CIS parameters in the low-latency mode; when the mobile phone exits the game, the headset is notified to exit the game low-latency mode and update the CIS parameters.
需要说明的是,本实施例可以游戏场景下的低延时为例。当然还可以是其他有低延时需求的场景,对此不做限制,其他低延时需求也可以参照该实施例,也可以采用其他方式进入低延时模式,甚至可以用户手动进入低延时模式,当然,也可以将低延时作为一种常规需求,无需特别进入,实际需要可根据产品实际需求去调整,不做为对本申请其他实施例的限制。It should be noted that this embodiment can take low latency in a gaming scenario as an example. Of course, it can also be other scenarios with low latency requirements, which are not limited to this. Other low latency requirements can also refer to this embodiment, and other methods can be used to enter the low latency mode, and even the user can manually enter the low latency mode. Of course, low latency can also be used as a regular requirement without special entry. The actual needs can be adjusted according to the actual needs of the product, and it is not a limitation on other embodiments of this application.
相关技术中,从音源设备到音频播放设备的全链路的延时Total System Delay可以包括:音源设备端(例如手机)的音频处理延时Audio Processing Time、空中传输时延Transport Latency和音频播放端(如耳机等sink设备)的解码及播放时延(Presentation Delay),也可以相应描述为音源设备端的延时、空中传输中的延时以及音频播放设备端的延时,关于presentation delay可以指耳机端从synchronization reference time到最终耳机出声这段过程的时延。这个过程可以从左右耳包的Sync点开始计算,可以包括音频数据的解码,还可以包括后续的音效处理等路径的损耗。在LE Audio等相关标准中Spec默认配置presentation delay是40ms。In related technologies, the delay of the entire link from the audio source device to the audio playback device, Total System Delay, may include: Audio Processing Time, air transmission delay, and decoding and playback delay (Presentation Delay) of the audio playback end (such as sink devices such as headphones). It can also be described as the delay of the audio source device, the delay in air transmission, and the delay of the audio playback device. The presentation delay may refer to the delay from the synchronization reference time to the final sound of the headphones. This process can be calculated from the Sync point of the left and right ear packages, and may include the decoding of audio data, as well as the loss of subsequent sound effect processing and other paths. In LE Audio and other related standards, the default configuration of the Spec presentation delay is 40ms.
针对TWS音频播放设备基于LE Audio蓝牙技术的全链路延时可以参考图4所示。经发明人研究发现,音源端Audio Processing Time,LE Audio蓝牙和经典蓝牙BT的时延差异并不大,这两项技术差异的点主要是空中传输时延(Transport Latency)以及耳机解码及播放时延(Presentation Delay)。其中,Transport Latency主要指空中传输时延,以手机和TWS耳机为例,可以包括手机蓝牙芯片端从拿到这个数据包到最终耳机蓝牙芯片端收到这个包并且到了这个包的同步参考时间(synchronization reference time,简称sync)。Transport Latency会因为重传次数的配置以及包大小/帧长等参数影响,不同业务场景,参数的值会有所不同。For the full-link delay of TWS audio playback devices based on LE Audio Bluetooth technology, please refer to Figure 4. The inventors have found that the delay difference between the audio source Audio Processing Time, LE Audio Bluetooth and classic Bluetooth BT is not large. The main difference between the two technologies is the air transmission delay (Transport Latency) and the headset decoding and playback delay (Presentation Delay). Among them, Transport Latency mainly refers to the air transmission delay. Taking mobile phones and TWS headphones as examples, it can include the time from the mobile phone Bluetooth chip side getting the data packet to the final headset Bluetooth chip side receiving the packet and reaching the synchronization reference time (synchronization reference time, referred to as sync). Transport Latency will be affected by the configuration of the number of retransmissions and parameters such as packet size/frame length. The value of the parameter will be different in different business scenarios.
如图5所示,以手机作为音源设备当前连接了一副TWS耳机(音频播放设备)为例进行说明,并且手机与双耳机都各建了一条CIS,其中手机在第一CIS通路CIS_1上发送一包数据pk1,在第二CIS通路CIS_2上同步发送一包数据pk2,pk1和pk2数据基本相同,主要是左右耳声道有所差异。由于不同CIS通路耳机端正常接收到数据存在时间差异,比如CIS_1上的pk1,手机端发送第一包pk1耳机端没有正常反馈ACK(ACK用于表征耳机正确接收了pk1数据包),而是回复NACK(NACK用于表征耳机没有正确接收pk1数据包,意味着手机需要重传)。而在手机重新发送一包数据pk1后,耳机端正常回复ACK;而CIS_2上的pk2,手机端发送一次耳机端便正常回复ACK了,这样左右耳收到对应pk 的接收时间receive time就存在差异,如果根据收到包的时间去做左右耳各自的播放逻辑,势必会造成左右耳不同步的问题。相关标准为了解决不同CIS链路不同步的问题,设置了一个服务数据单元同步参考时间(Service Data Unit synchronization reference time,可简称SDU Sync)。这个时间可以根据手机设置的最大transport latency决定的,该时间代表耳机最迟有效收到该包数据的时间点,如果超过这个时间点耳机端再收到这包数据,则这包数据由于超时也需要丢弃。虽然左右耳分别收到pk1和pk2的接收时间receive time有差异,但pk1和pk2的时间戳timestamp是一致的,即该包数据的播放时间戳是根据synchronization reference time决定。这样就规避了左右耳因receive time差异而导致的播放不同步问题。As shown in Figure 5, a mobile phone is used as an audio source device and is currently connected to a pair of TWS headphones (audio playback device). A CIS is built for both the mobile phone and the dual headphones. The mobile phone sends a packet of data pk1 on the first CIS channel CIS_1, and synchronously sends a packet of data pk2 on the second CIS channel CIS_2. The pk1 and pk2 data are basically the same, and the main difference is that the left and right ear channels are different. Due to the time difference between the normal reception of data by the headphone end of different CIS channels, such as pk1 on CIS_1, the mobile phone sends the first packet pk1. The headphone end does not normally feedback ACK (ACK is used to indicate that the headset has correctly received the pk1 data packet), but replies NACK (NACK is used to indicate that the headset has not correctly received the pk1 data packet, which means that the mobile phone needs to retransmit). After the mobile phone resends a packet of data pk1, the headphone end replies ACK normally; and for pk2 on CIS_2, the mobile phone sends it once and the headphone end replies ACK normally, so that the left and right ears receive the corresponding pk There is a difference in the receive time. If the left and right ears perform their respective playback logic based on the time when the packet is received, it is bound to cause the left and right ears to be out of sync. In order to solve the problem of asynchrony between different CIS links, the relevant standards set a service data unit synchronization reference time (Service Data Unit synchronization reference time, which can be referred to as SDU Sync). This time can be determined according to the maximum transport latency set by the mobile phone. This time represents the latest time point when the headset effectively receives the packet data. If the headset receives the packet data after this time point, the packet data also needs to be discarded due to timeout. Although the receive time of pk1 and pk2 received by the left and right ears is different, the timestamps of pk1 and pk2 are the same, that is, the playback timestamp of the packet data is determined according to the synchronization reference time. This avoids the problem of asynchronous playback of the left and right ears due to the difference in receive time.
如图6所示,提供一种蓝牙音频播放设备的数据处理架构,可以应用LE Audio等蓝牙技术,蓝牙音频播放设备的蓝牙模块接收到数据流后(例如CIS数据流),可将数据流中数据包内的音频数据(可以理解为有效数据)存储在蓝牙缓存区,蓝牙音频播放设备的音频模块会从蓝牙缓存区中获取数据(一般是获取一帧数据)进行解码并存储在解码器缓存区decoder buffer中,然后通过数模转换器DAC进行数模转换,进一步将模拟信号通过扬声器进行播放。示例的,音频播放设备的蓝牙芯片端通过CIS等传输通道收到蓝牙音源设备发过来的数据后,会根据同步参考时间synchronization reference time给每帧数据加上对应的时间戳timestamp字段,该时间戳字段用于标识该帧数据的同步起播点,同时每帧数据也有对应播放顺序,以LE Audio蓝牙技术为例,相邻两帧数据的时间戳timestamp的差值为一帧数据的帧长,以其使用的LC3编码为例,帧长(frame-duration)主要是10ms以及7.5ms两种,代表每帧数据能播放的时间长度,所以一般相邻帧的timestamp差值为10ms/7.5ms。As shown in FIG6 , a data processing architecture of a Bluetooth audio playback device is provided, and Bluetooth technologies such as LE Audio can be applied. After the Bluetooth module of the Bluetooth audio playback device receives the data stream (such as the CIS data stream), the audio data in the data packet in the data stream (which can be understood as valid data) can be stored in the Bluetooth buffer. The audio module of the Bluetooth audio playback device will obtain data from the Bluetooth buffer (generally one frame of data) for decoding and store it in the decoder buffer, and then perform digital-to-analog conversion through the digital-to-analog converter DAC, and further play the analog signal through the speaker. For example, after the Bluetooth chip of the audio playback device receives the data sent by the Bluetooth audio source device through the transmission channel such as CIS, it will add a corresponding timestamp field to each frame of data according to the synchronization reference time. The timestamp field is used to identify the synchronization start point of the frame data. At the same time, each frame of data also has a corresponding playback order. Taking LE Audio Bluetooth technology as an example, the difference between the timestamps of two adjacent frames of data is the frame length of one frame of data. Taking the LC3 encoding it uses as an example, the frame length (frame-duration) is mainly 10ms and 7.5ms, which represents the length of time that each frame of data can be played, so the timestamp difference between adjacent frames is generally 10ms/7.5ms.
通过上述蓝牙音频播放设备的数据处理架构可知,音频播放设备的数据处理可以分为三个部分,第一部分包括数据的接收端,这部分用于从音源设备接收数据包,并解包后将其中的有效数据(例如待解码的音频数据)存储在通信存储区(如图6中的蓝牙缓存区),这个部分主要依靠通信模块来执行,例如蓝牙芯片。第二部分包括解码存储端,从上述通信存储区中获取数据进行解码并将解码后的数据存储在播放存储区中,该部分主要由音频模块来执行。第三部分包括播放端,从上述播放存储区读取数据进行处理(例如数模转换),然后通过扬声器进行播放。若要保障音频播放的低延时、连续性、稳定性则需要依靠上述三个部分的配合,本申请也可以从上述相关部分的设置中进行改进以降低延时。It can be known from the data processing architecture of the above-mentioned Bluetooth audio playback device that the data processing of the audio playback device can be divided into three parts. The first part includes a data receiving end, which is used to receive data packets from the sound source device, and after unpacking, the valid data therein (such as the audio data to be decoded) is stored in the communication storage area (such as the Bluetooth buffer area in Figure 6). This part is mainly executed by a communication module, such as a Bluetooth chip. The second part includes a decoding storage end, which obtains data from the above-mentioned communication storage area for decoding and stores the decoded data in the playback storage area. This part is mainly executed by an audio module. The third part includes a playback end, which reads data from the above-mentioned playback storage area for processing (such as digital-to-analog conversion), and then plays it through a speaker. If you want to ensure low latency, continuity, and stability of audio playback, you need to rely on the cooperation of the above-mentioned three parts. This application can also be improved from the settings of the above-mentioned related parts to reduce latency.
示例的,DAC是硬件处理,与解码一般是异步进行,即DAC一旦开启后会一直持续不断的进行数据的数模转化并输出声音,而这过程中会与解码交叉。因此为了保证数据播放的流畅性,软件设计上可以设计ping pang buffer(两块buffer)或环形buffer(多块buffer)来处理,当然也可以是其他的存储类型。以ping pang buffer的设计为例,按照ping pang buffer的读写逻辑,如图7所示,首先,每块buffer都是放置一帧LC3数据,即10ms或7.5ms播放长度的LC3数据。当DAC通过DMA(Direct Memory Access,直接存储器访问)从ping buffer进行数据搬运时(读数据时),按照ping-pang buffer的逻辑一般是在pang buffer中可以写数据,从pang buffer中读数据时,在ping buffer中写数据,并且由于解码需要时间(一般1~2ms),既解码写buffer的时间会慢1~2m,如果一个buffer中又读又写也容易导致DAC搬运过程有部分数据丢掉。所以这种情况下,当DMA从ping buffer开始搬数据时,解码后的数据会写入pang buffer。而当DMA从pang buffer开始搬数据时,解码后的数据会写入ping buffer,这样能保证每次DMA都能正常从buffer取到完整的解码数据。因此,按照上述原理,在ping buffer被render时,由于还没有数据解码放置在ping buffer因此无声音播放,在ping buffer播放完后产生中断请求触发解码后获取的数据由于pang buffer正在render因此需要放置在ping buffer中,如果不进行优化,需要render完一轮ping buffer和pang buffer后才能有声音输出,用户才能听到声音,例如可能延迟两帧数据。For example, DAC is a hardware process, which is usually asynchronous with decoding. That is, once DAC is turned on, it will continuously perform digital-to-analog conversion of data and output sound, and this process will be crossed with decoding. Therefore, in order to ensure the smoothness of data playback, the software design can design ping pang buffer (two buffers) or ring buffer (multiple buffers) for processing, of course, other storage types can also be used. Taking the design of ping pang buffer as an example, according to the read and write logic of ping pang buffer, as shown in Figure 7, first, each buffer is used to store one frame of LC3 data, that is, LC3 data with a playback length of 10ms or 7.5ms. When DAC moves data from ping buffer via DMA (Direct Memory Access) (reading data), according to the logic of ping-pang buffer, data can be written in pang buffer. When reading data from pang buffer, data is written in ping buffer. And because decoding takes time (usually 1-2ms), the time of decoding and writing buffer will be 1-2ms slower. If a buffer is read and written at the same time, it is easy to cause some data to be lost during DAC moving process. So in this case, when DMA starts to move data from ping buffer, the decoded data will be written to pang buffer. And when DMA starts to move data from pang buffer, the decoded data will be written to ping buffer, so that each DMA can normally get the complete decoded data from buffer. Therefore, according to the above principle, when the ping buffer is rendered, there is no sound played because no data has been decoded and placed in the ping buffer. After the ping buffer is played, an interrupt request is generated to trigger the decoding. The data obtained needs to be placed in the ping buffer because the pang buffer is being rendered. If no optimization is performed, a round of ping buffer and pang buffer must be rendered before there is sound output and the user can hear the sound, for example, two frames of data may be delayed.
经发明人研究,对于LE audio技术由于蓝牙官方spec参数配置表中,不同的重传次数/帧长/码率等参数变化,只会影响transport latency的大小,并不会影响presentation delay的大小,该值始终配置为固定值,如标准规定的40ms。因此,如果耳机端要降低延时,需要修改音频播放设备的数据处理逻辑,来优化延时。因此本申请提出低延时播放方法,下面结合实施例详细描述。According to the inventor's research, for LE audio technology, due to the Bluetooth official spec parameter configuration table, different retransmission times/frame length/bit rate and other parameter changes will only affect the size of transport latency, and will not affect the size of presentation delay. This value is always configured as a fixed value, such as 40ms as specified in the standard. Therefore, if the headset end wants to reduce the delay, it is necessary to modify the data processing logic of the audio playback device to optimize the delay. Therefore, this application proposes a low-latency playback method, which is described in detail below in conjunction with the embodiments.
在一些实施例中,一种低延时播放方法,应用于音频播放设备,音频播放设备包括播放存储区,播放存储区包括第一存储区和第二存储区,该方法包括:在播放触发时刻Tt到来时从第一存储区的第一 预设位置开始读取播放存储区并播放;在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;其中,T1等于或晚于音频播放设备接收到所述第一数据的时间Tr1,从而确保能够解码得到第一数据;T2等于或晚于音频播放设备接收到第二数据的时间Tr2,从而确保能够解码得到第二数据,T2等于或晚于Tt,从而使得不用等待获得解码后的第二数据才开始播放,提前启动播放;第一数据在自Tt起第一次读取完第二存储区前开始播放,从而保障了第一数据更早能够被用户听到,从而降低音频的延时,提升音频播放设备的性能,提升用户体验。In some embodiments, a low-latency playback method is applied to an audio playback device, the audio playback device includes a playback storage area, the playback storage area includes a first storage area and a second storage area, the method comprising: when a playback trigger time Tt arrives, the first storage area in the first storage area is played back. Start reading the playback storage area and playing from the preset position; trigger decoding at the first moment T1 to obtain the first data, and store the first data in the playback storage area according to the first storage rule; trigger decoding at the second moment T2 to obtain the second data, and store the second data in the playback storage area according to the second storage rule; wherein T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, thereby ensuring that the first data can be decoded; T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, thereby ensuring that the second data can be decoded, and T2 is equal to or later than Tt, thereby making it unnecessary to wait for the decoded second data to start playing, and starting the playing in advance; the first data starts playing before the second storage area is read for the first time since Tt, thereby ensuring that the first data can be heard by the user earlier, thereby reducing the audio delay, improving the performance of the audio playback device, and improving the user experience.
在一些实施例中,音频播放设备还包括第三存储区,用于存放待解码的数据,待解码的数据包括待解码的第一数据和/或待解码的第二数据;该方法还包括:依次接收音源设备发送的第一数据包和第二数据包,第一数据包包含待解码的所述第一数据,所述第二数据包包含待解码的所述第二数据;将待解码的第一数据和/或待解码的第二数据存储至第三存储区。In some embodiments, the audio playback device also includes a third storage area for storing data to be decoded, the data to be decoded including first data to be decoded and/or second data to be decoded; the method also includes: sequentially receiving a first data packet and a second data packet sent by the sound source device, the first data packet including the first data to be decoded, and the second data packet including the second data to be decoded; storing the first data to be decoded and/or the second data to be decoded in the third storage area.
由于存储规则的不同对应Tt、T1、T2等的设置需要对应调整,为此,将按照存储规则的不同进一步说明:Due to the different storage rules, the settings of Tt, T1, T2, etc. need to be adjusted accordingly. Therefore, the following will be further explained according to the different storage rules:
在一些实施例中,将第一数据按照第一存储规则存储至播放存储区,包括:将第一数据存储在第一存储区;将第二数据按照第二存储规则存储至播放存储区,包括:将第二数据存储至第二存储区。In some embodiments, storing the first data in the playback storage area according to the first storage rule includes: storing the first data in the first storage area; storing the second data in the playback storage area according to the second storage rule includes: storing the second data in the second storage area.
在该实施例中,可以理解的,播放触发时刻Tt根据第一数据对应的时间戳Ts1与第一预设时间段确定;所述第一预设时间段足以解码获得第一数据并将所述第一数据存储至所述第一存储区,在一些实施例中,且第一预设时间段小于读取完第一存储区和第二存储区的总时长;从而可以保障播放延时小于读取第一存储区和第二存储区的总时长。如果第一存储区和第二存储区均为一帧时长,则可以保障延时低于两帧。In this embodiment, it can be understood that the playback triggering time Tt is determined according to the timestamp Ts1 corresponding to the first data and the first preset time period; the first preset time period is sufficient to decode and obtain the first data and store the first data in the first storage area. In some embodiments, the first preset time period is less than the total time of reading the first storage area and the second storage area; thus, the playback delay can be guaranteed to be less than the total time of reading the first storage area and the second storage area. If the first storage area and the second storage area are both one frame long, the delay can be guaranteed to be less than two frames.
可以理解的,T1早于或等于Ta,Ta到Tt的时间足以解码得到第一数据并存储至所述第一存储区;从而保障T1时刻进行解码能够在Tt到达之前将第一数据存储至第一存储区,从而在Tt时刻之后的播放阶段不会有延时,从用户角度来说,Tt到达就可以开始听到声音。It can be understood that T1 is earlier than or equal to Ta, and the time from Ta to Tt is sufficient to decode the first data and store it in the first storage area; thereby ensuring that decoding at T1 can store the first data in the first storage area before Tt arrives, so that there will be no delay in the playback phase after Tt. From the user's perspective, the sound can be heard when Tt arrives.
可以理解的,T2早于或等于Tb,Tb到读取完第一数据的时间足以解码得到第二数据并存储第二数据至第二存储区。从而在播完第一数据后可以马上播放第二数据,保障数据播放的连续性。It can be understood that T2 is earlier than or equal to Tb, and the time from Tb to the completion of reading the first data is sufficient to decode the second data and store the second data in the second storage area, so that the second data can be played immediately after the first data is played, ensuring the continuity of data playback.
在一些实施例中,将第一数据按照第一存储规则存储至播放存储区,包括:将第一数据按播放顺序分为第一部分数据和第二部分数据,第一部分数据存储在第一存储区的第一区域,第二部分数据存储在第二存储区的第二区域,第一区域与第二区域相邻;将第二数据按照第二存储规则存储至播放存储区,包括,将第二数据按播放顺序分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第一存储区的除第一区域的区域;或者,In some embodiments, storing the first data in the playback storage area according to the first storage rule includes: dividing the first data into a first portion of data and a second portion of data according to the playback order, the first portion of data is stored in a first area of the first storage area, the second portion of data is stored in a second area of the second storage area, and the first area is adjacent to the second area; storing the second data in the playback storage area according to the second storage rule includes: dividing the second data into a third portion of data and a fourth portion of data according to the playback order, storing the third portion of data in an area of the second storage area except the second area; storing the fourth portion of data in an area of the first storage area except the first area; or
将第二数据按照第二存储规则存储至播放存储区,包括,将第二数据分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第四存储区的第三区域,第三区域和第二存储区相邻,第四存储区是播放存储区中与第二存储区相邻的存储区。The second data is stored in the playback storage area according to the second storage rule, including dividing the second data into a third part of data and a fourth part of data, storing the third part of data in an area of the second storage area except the second area; storing the fourth part of data in a third area of the fourth storage area, the third area is adjacent to the second storage area, and the fourth storage area is a storage area in the playback storage area adjacent to the second storage area.
在该实施例中,可以理解的,T1早于或等于Tc,从Tc到读取至第一存储区用于存储第一数据的位置的时间足以解码得到第一数据且按照该实施例的第一存储规则存储第一数据,从而保障读取到用于存储第一数据的位置时能够有声音输出;T2早于或等于Td,从Td到读取完所述第一数据的时间足以解码得到第二数据并按照第二规则存储第二数据,从而保障第二数据和第一数据播放的连续性;Tt根据第一数据对应的时间戳Ts1与第二预设时间段确定;第二预设时间段大于或等于0,在一些实施例中,且第二预设时间可以小于读取完第一存储区以及读取一半第二存储区的总时长。在一些实施例中,且第二预设时间的设置保障播放延时小于读取第一存储区和第二存储区的总时长即可。也就是说可以根据T2时间的变化而调整。In this embodiment, it can be understood that T1 is earlier than or equal to Tc, and the time from Tc to the time of reading the first storage area for storing the first data is sufficient to decode the first data and store the first data according to the first storage rule of this embodiment, so as to ensure that there is sound output when the position for storing the first data is read; T2 is earlier than or equal to Td, and the time from Td to the time of reading the first data is sufficient to decode the second data and store the second data according to the second rule, so as to ensure the continuity of the playback of the second data and the first data; Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and in some embodiments, the second preset time can be less than the total time of reading the first storage area and reading half of the second storage area. In some embodiments, the setting of the second preset time ensures that the playback delay is less than the total time of reading the first storage area and the second storage area. That is to say, it can be adjusted according to the change of T2 time.
在一些实施例中,第一数据可以被均分为第一部分数据和第二部分数据,第一部分数据存储在第一存储区的后半部分,第二部分数据存储在第二存储区的前半部分,第一部分数据和第二部分数据相邻;第二数据被均分为第三部分数据和第四部分数据,第三部分数据存储在第二存储区的后半部分,第四部 分数据存储在第一存储区的前半部分,或者第四部分数据存储在第四存储区的前半部分,第三部分数据与第四部分数据相邻。In some embodiments, the first data may be equally divided into a first portion of data and a second portion of data, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent; the second data may be equally divided into a third portion of data and a fourth portion of data, the third portion of data is stored in the second half of the second storage area, and the fourth portion of data is adjacent to the first portion of data. The third partial data is stored in the first half of the first storage area, or the fourth partial data is stored in the first half of the fourth storage area, and the third partial data is adjacent to the fourth partial data.
在一些实施例中,将第一数据按照第一存储规则存储至播放存储区,包括:将第一数据存储至第二存储区;将第二数据按照第二存储规则存储至播放存储区,包括,将第二数据存储至第一存储区;或,将第二数据存储至第四存储区,第四存储区是播放存储区中与第二存储区相邻的存储区。可以理解的,第四存储区可以是环形存储区中的一个存储区。In some embodiments, storing the first data in the playback storage area according to the first storage rule includes: storing the first data in the second storage area; storing the second data in the playback storage area according to the second storage rule includes: storing the second data in the first storage area; or storing the second data in a fourth storage area, the fourth storage area being a storage area in the playback storage area adjacent to the second storage area. It is understandable that the fourth storage area may be a storage area in the annular storage area.
在本实施例中,可以理解的,T1早于或等于Te,从Te到读取完第一存储区的时间足以解码得到第一数据并将第一数据存储至第二存储区,从而保障第一数据的播放,并降低延时。In this embodiment, it can be understood that T1 is earlier than or equal to Te, and the time from Te to reading the first storage area is sufficient to decode the first data and store the first data in the second storage area, thereby ensuring the playback of the first data and reducing latency.
可以理解的,T2小于或等于Tf,从Tf到读取完第一数据的时间足以解码得到第二数据并将第二数据存储至第一存储区或第四存储区,从而保障第一数据和第二数据播放的连续性。It can be understood that T2 is less than or equal to Tf, and the time from Tf to the completion of reading the first data is sufficient to decode the second data and store the second data in the first storage area or the fourth storage area, thereby ensuring the continuity of the playback of the first data and the second data.
可以理解的,Tt根据第一数据对应的时间戳Ts1与第三预设时间段确定;第三预设时间段大于或等于0,且小于读取第一存储区的时长,从而保障第一数据的延时控制在读取第一存储区和第二存储区的总时长以内。It can be understood that Tt is determined based on the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0 and less than the duration of reading the first storage area, thereby ensuring that the delay of the first data is controlled within the total duration of reading the first storage area and the second storage area.
在一些实施例中,播放触发时间Tt等于所述第一数据对应的时间戳Ts1与半帧数据的时长之和。In some embodiments, the playback trigger time Tt is equal to the sum of the timestamp Ts1 corresponding to the first data and the duration of the half-frame data.
在一些实施例中,在第一时刻T1触发解码以得到第一数据,包括:在接收到第一数据包时触发解码以得到第一数据。In some embodiments, triggering decoding at a first time T1 to obtain first data includes: triggering decoding to obtain first data upon receiving a first data packet.
在一些实施例中,在第二时刻T2触发解码以得到第二数据,包括:In some embodiments, triggering decoding at the second time T2 to obtain second data includes:
在读取到第一存储区的中间位置时触发解码得到第二数据。When the middle position of the first storage area is read, decoding is triggered to obtain the second data.
在一些实施例中,在第二时刻T2触发解码以得到第二数据,包括:In some embodiments, triggering decoding at the second time T2 to obtain second data includes:
在读取到第一存储区的结束位置时触发解码得到第二数据。When the end position of the first storage area is read, decoding is triggered to obtain the second data.
在一些实施例中,Tt等于第一数据对应的时间戳Ts1。In some embodiments, Tt is equal to the timestamp Ts1 corresponding to the first data.
在一些实施例中,在第一时刻T1触发解码以得到第一数据,包括:在播放触发时刻Tt触发解码以得到第一数据。In some embodiments, triggering decoding at a first moment T1 to obtain first data includes: triggering decoding at a play triggering moment Tt to obtain first data.
在一些实施例中,在第二时刻T2触发解码以得到第二数据,包括:In some embodiments, triggering decoding at the second time T2 to obtain second data includes:
在第二时刻T2生成第一中断请求,响应于第一中断请求获取数据进行解码得到第二数据;Generate a first interrupt request at a second time T2, and obtain data in response to the first interrupt request and decode to obtain second data;
该方法还包括:在第三时刻T3生成第二中断请求,响应于第二中断获取数据进行解码得到第三数据,将第三数据按照第三存储规则存储至播放存储区;The method further includes: generating a second interrupt request at a third time T3, decoding the acquired data in response to the second interrupt to obtain third data, and storing the third data in a playback storage area according to a third storage rule;
第一中断请求到第二中断请求之间的时间间隔至少为一帧数据的时长。The time interval between the first interrupt request and the second interrupt request is at least the duration of one frame of data.
在一些实施例中,第一存储区为乒缓存ping buffer,第二存储区为乓缓存pang buffer;或者,第一存储区和第二存储区是环形缓存中的相邻两个缓存区。In some embodiments, the first storage area is a ping buffer, and the second storage area is a pong buffer; or, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer.
在一些实施例中,音频播放设备和音源设备通过LE Audio蓝牙技术进行通信。In some embodiments, the audio playback device and the audio source device communicate via LE Audio Bluetooth technology.
在一些实施例中,第一数据和第二数据均为一帧数据;第一存储区和第二存储区均为存储一帧数据的大小。In some embodiments, the first data and the second data are both one frame of data; and the first storage area and the second storage area are both sized to store one frame of data.
在一些实施例中,T2小于或等于Td,从Td到读取完第一数据的时间足以解码得到第二数据并按照第二存储规则存储第二数据。In some embodiments, T2 is less than or equal to Td, and the time from Td to the completion of reading the first data is sufficient to decode and obtain the second data and store the second data according to the second storage rule.
下面结合附图做进一步说明:在一些实施例中,如图8所示,提供一种低延时播放的方法,应用于音频播放设备,该音频播放设备包括播放存储区,该播放存储区包括第一存储区和第二存储区,该方法包括:The following is further described in conjunction with the accompanying drawings: In some embodiments, as shown in FIG8, a low-latency playback method is provided, which is applied to an audio playback device, the audio playback device includes a playback storage area, the playback storage area includes a first storage area and a second storage area, the method includes:
在播放端,如包括读取播放存储区中的数据进行播放的部分,如图8所示,可以包括以下部分:At the playback end, for example, the part including reading the data in the playback storage area for playback, as shown in FIG8 , may include the following parts:
S800:确定播放触发时刻Tt;S800: Determine the playback triggering time Tt;
可以理解的,播放触发时刻的定义可参考前面相关技术提到的trigger time,但是在一些实施例中,可以对Tt的设置进行调整。示例的,可以根据第一数据对应的时间戳Ts1与第一预设时间段确定播放触发时间Tt,其中第一预设时间段可以大于或等于0。也就是说,Tt可以与Ts1相同,在一些实施例中,且所述第一预设时间段小于读取完所述第一存储区和所述第二存储区的总时长,也就是说保障延时小于 两个存储区的总时长;因此,在一些实施例中Tt也可以随着其他参数的变化进行调整,例如,Tt根据第一数据对应的时间戳Ts1与第二预设时间段确定;第二预设时间段大于或等于0,又例如Tt根据第一数据对应的时间戳Ts1与第三预设时间段确定;第三预设时间段大于或等于0,且小于读取第一存储区的时长。当应用LE Audio蓝牙技术时,Ts1可以根据第一数据对应的SDU synchronization reference time确定,例如Ts1=SDU synchronization reference time,此时,可以认为第一预设时间段为0。在一些实施例中,第一预设时间段可以为半帧数据时长,即半帧长,进而Tt=Ts1+半帧长。经发明人研究发现,半帧时长能够较好满足音频模块解码一帧数据并存储至相关存储区,因此可以预留半帧时长供第一数据进行解码和存储等。当然在一些实施例中,解码和存储等时间可能小于半帧时长,因此第一预设时间段也可以小于半帧时长,只要能够满足解码一帧数据并存储至相关存储区的时间即可,从而可以在Tt到达前就完成解码和存储。在一些实施例中,Tt=Ts1,这种情况下,可以通过边播放边解码的方式来实现,只是由于还没有数据被存储在播放存储区(播放存储区可以对应前述图6的解码缓存区,用来存放用于播放的数据,供DAC获取进行转换后播放),所以虽然音频模块在读取并播放但实际并没有声音发出,用户是无法听到的,因此,要想降低延时,这种情况下需要调整其他参数,例如调整解码的时间,后面会详细描述。It is understandable that the definition of the playback trigger time can refer to the trigger time mentioned in the previous related technology, but in some embodiments, the setting of Tt can be adjusted. For example, the playback trigger time Tt can be determined based on the timestamp Ts1 corresponding to the first data and the first preset time period, where the first preset time period can be greater than or equal to 0. In other words, Tt can be the same as Ts1. In some embodiments, the first preset time period is less than the total time to read the first storage area and the second storage area, that is, the guaranteed delay is less than The total duration of the two storage areas; therefore, in some embodiments, Tt can also be adjusted with the change of other parameters, for example, Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and for example, Tt is determined according to the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0, and is less than the duration of reading the first storage area. When LE Audio Bluetooth technology is applied, Ts1 can be determined according to the SDU synchronization reference time corresponding to the first data, for example, Ts1 = SDU synchronization reference time, at this time, the first preset time period can be considered to be 0. In some embodiments, the first preset time period can be the duration of half a frame of data, that is, half a frame length, and then Tt = Ts1 + half a frame length. The inventors have found that the half-frame duration can better meet the audio module decoding a frame of data and storing it in the relevant storage area, so the half-frame duration can be reserved for the first data to be decoded and stored. Of course, in some embodiments, the time for decoding and storage may be less than half a frame duration, so the first preset time period may also be less than half a frame duration, as long as it can meet the time required to decode a frame of data and store it in the relevant storage area, so that decoding and storage can be completed before Tt arrives. In some embodiments, Tt = Ts1. In this case, it can be achieved by decoding while playing. However, since no data has been stored in the playback storage area (the playback storage area may correspond to the decoding buffer area of FIG. 6, which is used to store data for playback, so that the DAC can obtain the data for conversion and playback), although the audio module is reading and playing, no sound is actually emitted, and the user cannot hear it. Therefore, in order to reduce the delay, other parameters need to be adjusted in this case, such as adjusting the decoding time, which will be described in detail later.
S801:在Tt时刻到来时从第一存储区的第一预设位置开始读取播放存储区并播放。S801: When the time Tt arrives, the playback storage area is read and played from the first preset position of the first storage area.
可以理解的,上述第一预设位置可以是第一存储区的起始位置,也就是说在播放触发时刻Tt到来时开始读取第一存储区以进行播放,但是需要说明的是,在上述不同的实施例或实施例组合中,有的在Tt到来时就可以播放出声音,有的实施例中可能要读取到第一存储区的其他位置才可以播放出声音,例如读取到中间位置,有的甚至读取到第二存储区,因为当Tt到来时第一存储区中可能有部分存储区没有有效数据,因此即使播放时间render_time在走,即在读取并播放,但用户无法听到声音。It can be understood that the above-mentioned first preset position can be the starting position of the first storage area, that is, when the playback trigger time Tt arrives, the first storage area is read for playback. However, it should be noted that in the above-mentioned different embodiments or combinations of embodiments, some can play the sound when Tt arrives, and in some embodiments, it may be necessary to read other positions of the first storage area before the sound can be played, such as reading the middle position, and some even read the second storage area. Because when Tt arrives, some storage areas in the first storage area may have no valid data, so even if the playback time render_time is running, that is, reading and playing, the user cannot hear the sound.
需要说明的是,一旦Tt达到以触发播放,则会在播放存储区中按照读取规则去读取数据进行播放,例如从ping buffer向pang buffer读取并循环回到ping buffer进行下一轮读取播放。即使中间生成中断请求触发解码也会不停止对播放存储区的读取和播放,因此需要保障收数据、解码及存储的及时性,才能保障播放的连续性,否则可能因为播放存储区没有数据可用于播放而出现卡顿、无声等情况。It should be noted that once Tt is reached to trigger playback, data will be read from the playback storage area according to the reading rules for playback, such as reading from the ping buffer to the pang buffer and looping back to the ping buffer for the next round of reading and playback. Even if an interrupt request is generated in the middle to trigger decoding, the reading and playback of the playback storage area will not be stopped. Therefore, it is necessary to ensure the timeliness of data collection, decoding and storage to ensure the continuity of playback. Otherwise, there may be freezes, silence, etc. because there is no data available for playback in the playback storage area.
如图8所示,对于解码存储端,可包括触发解码并存储至播放存储区的部分,例如包括以下部分:As shown in FIG8 , the decoding storage end may include a portion that triggers decoding and stores the content in a playback storage area, for example, the following portions:
S802:在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区。S802: Trigger decoding at a first moment T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule.
需要说明的是,在一些实施例中,上述第一数据可以是需要播放的第一帧数据,例如播放音乐中的第一帧音频数据。可以理解的,第一存储区和第二存储区可以是相邻的存储区,或者说可以从第一存储区向第二存储区匀速的播放render,示例的,第一存储区可以为乒乓缓存(ping-pang buffer)中的乒缓存ping buffer,第二存储区可以为乒乓缓存(ping-pang buffer)中的乓缓存pang buffer;在一些实施例中,第一存储区和第二存储区是环形缓存中的相邻两个缓存区,例如第一存储区是环形存储区的第一个存储区。当然,还可能有其他类型的存储类型也适用,在此不做限制。It should be noted that, in some embodiments, the first data may be the first frame data to be played, such as the first frame audio data in playing music. It is understandable that the first storage area and the second storage area may be adjacent storage areas, or the render may be played at a uniform speed from the first storage area to the second storage area. For example, the first storage area may be a ping-pang buffer in a ping-pang buffer, and the second storage area may be a pong buffer in a ping-pang buffer; in some embodiments, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer, for example, the first storage area is the first storage area of the ring storage area. Of course, there may be other types of storage types that are also applicable, which are not limited here.
在一些实施例中,T1可以等于或晚于音频播放设备接收到所述第一数据的时间Tr1,Tr1可以指音频播放设备的通信模块接收到携带有第一数据的数据包的时间,从而保障在T1时刻能够触发解码以得到第一数据。触发解码可以理解为通知音频模块获取待解码的数据进行解码操作等。In some embodiments, T1 may be equal to or later than the time Tr1 at which the audio playback device receives the first data, and Tr1 may refer to the time at which the communication module of the audio playback device receives the data packet carrying the first data, thereby ensuring that decoding can be triggered at time T1 to obtain the first data. Triggering decoding can be understood as notifying the audio module to obtain the data to be decoded for decoding operations, etc.
在一些实施例中,T1时刻早于自Tt时刻起第一次读完第一存储区的时刻,因而不用等待读完第一存储区再触发解码获得第一数据,更早的获得第一数据有利于更早的进行播放出声以降低延时。此外,考虑到保障数据的接收,在一些实施例中,T1大于或等于第一数据的接收时刻Tr1,该Tr1可以理解为第一数据实际接收的时刻,如果第一数据由第一数据包的形式从音源设备发送给音频播放设备,则Tr1可以为音频播放设备接收到第一数据包的时间。在一些实施例中,如果Tr1超出第一数据对应的synchronization reference time(例如LE Audio标准中规定的SDU synchronization reference time),因超时,则设置丢弃这包数据从而保障播放的同步性。进一步的,在一些实施例中,T1=Tr1,也就是说在接收到第一数据包时触发解码以得到第一数据。在一些实施例中,音频播放设备还可以包括第三存储区(也可以称为通信存储区),该存储区可以用来存放待解码的有效数据(例如用于播放的音频数据),然后 可以由音频模块来一帧一帧的从第三存储区中获取数据进行解码。例如,在接收音源设备发送的第一数据包后,该方法还包括:将第一数据包中待解码的第一数据存储在第三存储区,从而可以让音频模块获取并解码等处理后进行播放。此外,在T1=Tr1的情况下,也可以直接对编码后的第一数据进行解码并存储至播放存储区,而无需先存至第三存储区。当然,也可以先存储到第三存储区后立刻进行读取并解码后存储至播放存储区。In some embodiments, the time T1 is earlier than the time when the first storage area is read for the first time since the time Tt, so there is no need to wait for the first storage area to be read before triggering the decoding to obtain the first data. The earlier the first data is obtained, the earlier the sound can be played out to reduce the delay. In addition, in order to ensure the reception of data, in some embodiments, T1 is greater than or equal to the reception time Tr1 of the first data. Tr1 can be understood as the time when the first data is actually received. If the first data is sent from the sound source device to the audio playback device in the form of a first data packet, Tr1 can be the time when the audio playback device receives the first data packet. In some embodiments, if Tr1 exceeds the synchronization reference time corresponding to the first data (for example, the SDU synchronization reference time specified in the LE Audio standard), the packet of data is discarded due to timeout to ensure the synchronization of playback. Further, in some embodiments, T1=Tr1, that is, decoding is triggered to obtain the first data when the first data packet is received. In some embodiments, the audio playback device may further include a third storage area (also referred to as a communication storage area), which can be used to store valid data to be decoded (for example, audio data for playback), and then The audio module can obtain data from the third storage area frame by frame for decoding. For example, after receiving the first data packet sent by the sound source device, the method also includes: storing the first data to be decoded in the first data packet in the third storage area, so that the audio module can obtain and decode the data before playing it. In addition, in the case of T1=Tr1, the encoded first data can also be directly decoded and stored in the playback storage area without first storing it in the third storage area. Of course, it is also possible to store it in the third storage area first, then read it immediately, decode it, and store it in the playback storage area.
在一些实施例中,T1为自Tr1至第一次播放到所述播放存储区的第二预设位置之间的任意时刻,从第二预设位置到播放完第一存储区的时间足以解码并存储第一数据至第二存储区。也就说是说,T1可以等于Tr1,或者T1可以等于首次播放到第二预设位置的时刻,T1也可以是二者之间的任一时刻,可以根据实际需要设置。T1可以大于Tt,例如,T1为自Tt时刻起读完一半第一存储区的时刻到读完第二预设位置之间的任意时刻,从第二预设位置到播放完第一存储区的时间足以解码并存储第一数据至第二存储区。需要说明的,T1可以是读取到第一存储区的时刻,也可以是读取到第一存储区中间位置的时刻,也可以是读取到第二预设位置的时刻,还可以是中间的其他时刻。因为,经发明人分析认为,只要保障从T1时刻到读取到第一数据存放的起始位置的时间足以解码并存储第一数据即可,也就是保障在读取到用于存放第一数据的起始位置时有第一数据可以被读取播放即可。经过发明人的研究进一步发现,在第一存储区和第二存储区的长度为一帧数据,第一数据、第二数据的长度为一帧时,半帧数据时长基本可以较好的保障一帧数据的解码、存储以及其他系统开销,从而也可以设置自Tt时刻开始第一次读取到第一存储区一半位置时触发解码数据以得到一帧数据(例如第一数据)并将其存储至第二存储区。从而在读取到第二存储区时就可以使得用户听到第一数据对应的音频,使得延时控制在一帧数据,并保障播放的连续性。In some embodiments, T1 is any time from Tr1 to the first time the second preset position of the playback storage area is played, and the time from the second preset position to the first storage area is sufficient to decode and store the first data in the second storage area. In other words, T1 can be equal to Tr1, or T1 can be equal to the time when the second preset position is played for the first time, or T1 can be any time between the two, which can be set according to actual needs. T1 can be greater than Tt, for example, T1 is any time from the time when half of the first storage area is read from the time Tt to the time when the second preset position is read, and the time from the second preset position to the first storage area is sufficient to decode and store the first data in the second storage area. It should be noted that T1 can be the time when the first storage area is read, or the time when the middle position of the first storage area is read, or the time when the second preset position is read, or other moments in between. Because, according to the analysis of the inventor, it is sufficient to decode and store the first data as long as the time from the time T1 to the time when the first data is read to the starting position for storing the first data is sufficient, that is, it is sufficient to ensure that the first data can be read and played when the starting position for storing the first data is read. The inventors have further discovered through research that when the length of the first storage area and the second storage area is one frame of data, and the length of the first data and the second data is one frame, the half-frame data duration can basically guarantee the decoding, storage and other system overheads of one frame of data, so it can also be set to trigger the decoding data when the half position of the first storage area is read for the first time since time Tt to obtain one frame of data (for example, the first data) and store it in the second storage area. Therefore, when the second storage area is read, the user can hear the audio corresponding to the first data, so that the delay is controlled within one frame of data and the continuity of the playback is guaranteed.
可以理解的,在第一时刻T1触发解码以得到第一数据后,在一些实施例中,按照第一存储规则可以将第一数据存储至第一存储区;在一些实施例中,按照第一存储规则可以将第一数据存储至第二存储区;在一些实施例中,还可以将第一数据划分成至少两个部分,按照第一存储规则可以分别存储至第一存储区和第二存储区中,为保障播放的连续性,存储在不同存储区域时也要保障数据播放的连续性。示例的,在一些实施例中,将第一数据按播放顺序分为第一部分数据和第二部分数据,第一部分数据存储在第一存储区的第一区域,第一区域靠近第二存储区,第二部分数据存储在第二存储区的第二区域,第二区域靠近第一存储区,第一部分数据与第二部分数据相邻,也可以理解为第一区域与第二区域相邻,从而保障第一数据能够被连续的播放。示例的,第一部分数据存储在第一存储区的后半部分,第二部分数据存储在第二存储区的前半部分,第一部分数据和第二部分数据相邻。可见,可以将第一数据平分为两部分,上述第一区域可对应第一存储区的后半部分,第二区域可对应第二存储区的前半部分。当然第一数据也可以是不均分的,对此不做限制,不均分的情况下,第一部分数据可能多余第二部分数据,这样可以使得将第一部分数据存储在第一存储区时,可以存储的更靠近起始播放位置,从而可以更早的被读取播放,但需要注意的是,要估算解码并存储第一数据所需的时间,从而保障从第一存储区的起始位置播放至第一数据的起始存储位置时,第一数据已经被存放好,这样可以尽可能的降低延时。It can be understood that after the decoding is triggered at the first moment T1 to obtain the first data, in some embodiments, the first data can be stored in the first storage area according to the first storage rule; in some embodiments, the first data can be stored in the second storage area according to the first storage rule; in some embodiments, the first data can also be divided into at least two parts, which can be stored in the first storage area and the second storage area respectively according to the first storage rule. In order to ensure the continuity of playback, the continuity of data playback must also be ensured when stored in different storage areas. For example, in some embodiments, the first data is divided into the first part of data and the second part of data according to the playback order, the first part of data is stored in the first area of the first storage area, the first area is close to the second storage area, the second part of data is stored in the second area of the second storage area, the second area is close to the first storage area, the first part of data is adjacent to the second part of data, and it can also be understood that the first area is adjacent to the second area, so as to ensure that the first data can be played continuously. For example, the first part of data is stored in the second half of the first storage area, the second part of data is stored in the first half of the second storage area, and the first part of data is adjacent to the second part of data. It can be seen that the first data can be divided into two parts, the above-mentioned first area can correspond to the second half of the first storage area, and the second area can correspond to the first half of the second storage area. Of course, the first data may also be unequally divided, and there is no restriction on this. In the case of unequal division, the first part of the data may be more than the second part of the data. In this way, when the first part of the data is stored in the first storage area, it can be stored closer to the starting playback position, so that it can be read and played earlier. However, it should be noted that the time required to decode and store the first data should be estimated to ensure that the first data has been stored when it is played from the starting position of the first storage area to the starting storage position of the first data, so as to reduce the delay as much as possible.
可以理解的,第一存储规则在不同实施例中可能存在差异,为了达到降低延时的效果,还需要结合Tt或T1等的设置来实现,具体可以参考后面的实施例。It is understandable that the first storage rule may be different in different embodiments. In order to achieve the effect of reducing the delay, it is also necessary to combine the settings of Tt or T1, etc., and refer to the following embodiments for details.
在一些实施例中,第一数据为一帧数据;第一存储区和第二存储区均为存储一帧数据的大小。特别是应用于LE Audio蓝牙技术中,每块buffer(例如第一存储区、第二存储区)放置一帧LC3数据。在一些实施例中,第一数据、第二数据以及后续数据均以一帧的数据长度进行解码。当然,一帧数据可以是音源设备通过一个数据包发送给音频播放设备的,也可以是通过多个数据包发送给音频播放设备的,还可以是一个数据包发送多帧数据的情况。如果应用LE Audio蓝牙技术,则可以是一帧数据被压缩后通过一个数据包传输。在其他无线通信协议中可能采用其他的压缩和传输方式。In some embodiments, the first data is a frame of data; the first storage area and the second storage area are both sized to store a frame of data. In particular, when applied to LE Audio Bluetooth technology, each buffer (such as the first storage area and the second storage area) stores a frame of LC3 data. In some embodiments, the first data, the second data, and subsequent data are decoded with a data length of one frame. Of course, a frame of data can be sent from a sound source device to an audio playback device through a data packet, or sent to an audio playback device through multiple data packets, or multiple frames of data can be sent in one data packet. If LE Audio Bluetooth technology is applied, a frame of data can be compressed and transmitted through a data packet. Other compression and transmission methods may be used in other wireless communication protocols.
S803:在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区。S803: Trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule.
可以理解的,第二数据可以是与第一数据相邻的数据,示例的,第一数据和第二数据可以都是一帧数据长度,例如第二数据是第一数据的下一帧数据。因此,T1是早于T2的,也就是说先触发解码得到 第一数据,后触发解码得到第二数据,此外,T2的设置还需要考虑到第二数据的接收情况,至少要在音频播放设备接收到音源设备发送的第二数据对应的数据包的情况下,才能够触发解码以得到第二数据。在一些实施例中,T2为自Tt时刻起第一次读完第一存储区的时刻,例如,在读取完第一存储区时触发从第三存储区获取数据进行解码以得到第二数据。具体的时刻可以有一定的波动范围都属于本申请的保护范围。It can be understood that the second data can be data adjacent to the first data. For example, the first data and the second data can both be one frame of data length, for example, the second data is the next frame of data of the first data. Therefore, T1 is earlier than T2, that is, the decoding is triggered first. The first data is read, and then the decoding is triggered to obtain the second data. In addition, the setting of T2 also needs to take into account the reception of the second data. At least when the audio playback device receives the data packet corresponding to the second data sent by the sound source device, the decoding can be triggered to obtain the second data. In some embodiments, T2 is the moment when the first storage area is read for the first time since the moment Tt. For example, when the first storage area is read, the data is obtained from the third storage area for decoding to obtain the second data. The specific moment may have a certain fluctuation range and all belong to the protection scope of this application.
在一些实施例中,音频播放设备还包括第三存储区;该方法还包括:接收音源设备发送的第二数据包,第二数据包包含编码后的第二数据;将编码后的第二数据存储至第三存储区。可以理解的,第三存储区可以是蓝牙模块的缓存区,用来存储蓝牙模块接收到的待解码数据。此外,第二数据包可能包括待解码的第二数据,其中第二数据大小为一帧。In some embodiments, the audio playback device further includes a third storage area; the method further includes: receiving a second data packet sent by the audio source device, the second data packet including encoded second data; storing the encoded second data in the third storage area. It can be understood that the third storage area can be a buffer area of the Bluetooth module, which is used to store the data to be decoded received by the Bluetooth module. In addition, the second data packet may include the second data to be decoded, wherein the size of the second data is one frame.
在一些实施例中,在读取到第一存储区的第三预设位置时触发从第三存储区获取数据进行解码得到第二数据,可选的,第三预设位置位于第一存储区的中间位置至第一存储区的结束位置之间,且从第三预设位置播放到所述第一存储区的结束位置的时长足以解码并按照第二存储规则存储所述第二数据。可以理解的,在一些实施例中,第三预设位置位于第一存储区的中间位置至第一存储区的结束位置之间,可以包括第三预设位置为第一存储区的中间位置的情况,对于LE Audio蓝牙技术等应用场景,第三预设位置设置在第一存储区的中间位置,可以满足从第三预设位置播放到第一存储区的结束位置的时长要足以解码并按照第二存储规则存储第二数据,例如将第二数据存储在第二存储区,当然,还可以更精细化的计算上述第二数据的解码等时间,从而对应设置第三预设位置,保障播放的连续性。在一些实施例中,将所述第二数据存储至所述第二存储区,这样在播放到第二存储区时,第二数据已经被解码并放入了第二存储区,也就是说上述方法可以保障第一数据和第二数据的连续性,又降低了延时,例如可以控制为半帧延时。在一些实施例中,可以在第二时刻T2生成第一中断请求,响应于第一中断请求从第三存储区获取数据进行解码得到第二数据。In some embodiments, when the third preset position of the first storage area is read, the data is obtained from the third storage area for decoding to obtain the second data. Optionally, the third preset position is located between the middle position of the first storage area and the end position of the first storage area, and the duration of playing from the third preset position to the end position of the first storage area is sufficient to decode and store the second data according to the second storage rule. It can be understood that in some embodiments, the third preset position is located between the middle position of the first storage area and the end position of the first storage area, which can include the case where the third preset position is the middle position of the first storage area. For application scenarios such as LE Audio Bluetooth technology, the third preset position is set at the middle position of the first storage area, which can meet the requirement that the duration of playing from the third preset position to the end position of the first storage area is sufficient to decode and store the second data according to the second storage rule, such as storing the second data in the second storage area. Of course, the decoding time of the second data can be calculated more finely, so as to set the third preset position accordingly to ensure the continuity of the playback. In some embodiments, the second data is stored in the second storage area, so that when it is played to the second storage area, the second data has been decoded and placed in the second storage area. That is to say, the above method can ensure the continuity of the first data and the second data, and reduce the delay, for example, it can be controlled to be a half-frame delay. In some embodiments, a first interrupt request may be generated at the second time T2, and in response to the first interrupt request, data is acquired from the third storage area and decoded to obtain second data.
可以理解的,当第一数据和第二数据的数据量大小相同时,第二预设位置和第三预设位置可以是同一个位置。It can be understood that when the data amounts of the first data and the second data are the same, the second preset position and the third preset position can be the same position.
需要说明的,在解码得到第二数据后需将第二数据进行存储以供读取播放。在一些实施例中,按照第二存储规则,可以将第二数据存储在第一存储区,例如乒乓存储区的情况;在一些实施例中,音频播放设备还包括第四存储区,按照第二存储规则,也可以将第二数据存储在第四存储区,这种情况下,主要针对环状的缓存区,第四存储区可以是与第二存储区相邻的存储区,例如是两块相邻的buffer。在一些实施例中,还可以按照第二存储规则,将第二数据部分或全部存储在第二存储区。以乒乓存储区为例,在一些实施例中,可以将第二数据分为第三部分数据和第四部分数据,按照第二存储规则,可以将第三部分数据存储在第二存储区的除前述第二区域的区域;将第四部分数据存储在第一存储区的除前述第一区域的区域。当第一区域为第一存储区的后半段,第二区域为第二存储区的前半段时,则可以将第三部分数据存储在第二存储区的后半段,第四部分数据存储在第一存储区的前半段,从而保障第二数据与第一数据播放上的连续性,以及第二数据本身播放上的连续性。在环形存储区的情况下,在一些实施例中,音频播放设备还包括第四存储区,第四存储区与第二存储区相邻;可以将第二数据分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第四存储区的第三区域,第三部分数据和第四部分数据相邻,也可以理解为,第三区域与第二区域相邻,从而保障第二数据播放的连续性。环形存储区(例如环形buffer)的情况下,其他部分也可在前面的一些实施例基础上实现。It should be noted that after the second data is decoded, the second data needs to be stored for reading and playing. In some embodiments, according to the second storage rule, the second data can be stored in the first storage area, such as the case of the ping-pong storage area; in some embodiments, the audio playback device also includes a fourth storage area. According to the second storage rule, the second data can also be stored in the fourth storage area. In this case, mainly for the annular buffer area, the fourth storage area can be a storage area adjacent to the second storage area, such as two adjacent buffers. In some embodiments, according to the second storage rule, the second data can also be stored in part or in whole in the second storage area. Taking the ping-pong storage area as an example, in some embodiments, the second data can be divided into a third part of data and a fourth part of data. According to the second storage rule, the third part of data can be stored in the area of the second storage area except the aforementioned second area; the fourth part of data can be stored in the area of the first storage area except the aforementioned first area. When the first area is the second half of the first storage area and the second area is the first half of the second storage area, the third part of data can be stored in the second half of the second storage area, and the fourth part of data can be stored in the first half of the first storage area, so as to ensure the continuity of the playback of the second data and the first data, as well as the continuity of the playback of the second data itself. In the case of a circular storage area, in some embodiments, the audio playback device further includes a fourth storage area, which is adjacent to the second storage area; the second data can be divided into a third portion of data and a fourth portion of data, and the third portion of data is stored in an area of the second storage area other than the second area; the fourth portion of data is stored in a third area of the fourth storage area, and the third portion of data and the fourth portion of data are adjacent, which can also be understood as the third area being adjacent to the second area, thereby ensuring the continuity of the second data playback. In the case of a circular storage area (such as a circular buffer), other parts can also be implemented based on some of the previous embodiments.
本申请的一些实施例中,如前所述,除上述解码存储端和播放端之外还包括接收端,在接收部分,通过无线电收发模块等(如蓝牙模块)接收音源设备发送的数据包,解包后存储在前述通信存储区,从而得到如待解码的第一数据和/或待解码的第二数据等待解码的有效数据。相关数据包的接收时间等信息也可能与后续解码存储和播放部分的设置相关,详见相关实施例的描述。In some embodiments of the present application, as mentioned above, in addition to the above-mentioned decoding storage end and playback end, a receiving end is also included. In the receiving part, a data packet sent by the sound source device is received through a radio transceiver module (such as a Bluetooth module), and is stored in the aforementioned communication storage area after unpacking, thereby obtaining valid data such as the first data to be decoded and/or the second data to be decoded waiting for decoding. Information such as the reception time of the relevant data packet may also be related to the settings of the subsequent decoding storage and playback parts, as described in the description of the relevant embodiments for details.
可以理解的,在本申请的一些实施例中,T1等于或晚于音频播放设备接收到第一数据的时间Tr1,T2等于或晚于音频播放设备接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次 读取完第二存储区前开始播放。从而可以保障低延时播放,并且播放的连续性。It can be understood that in some embodiments of the present application, T1 is equal to or later than the time Tr1 at which the audio playback device receives the first data, T2 is equal to or later than the time Tr2 at which the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data is received for the first time since Tt. Playback starts before the second storage area is read, thereby ensuring low-latency playback and playback continuity.
在一些实施例中,T1早于T2,Tt早于或等于T2且T2的设置保障在T2时刻音频播放设备已接收到音源设备发送的第二数据,从而在保障有第二数据可以被解码的同时,可以降低音频延迟,提升用户体验。Tt早于或等于T2,可以使得更早的触发解码得到第二数据,边播边解码再结合存储规则的设置,可以降低延时的同时,保障播放的连续性。在一些实施例中,T1至T2的时长足以解码得到并按照第一存储规则存储第一数据。但后续的触发解码的中断请求的间隔可以控制在至少一帧数据时长。在一些实施例中,以LE Audio蓝牙技术的应用为例,第二数据的帧长为一帧,被编码后由音源设备通过第二数据包发送给音频播放设备,一般来说,相邻两帧数据对应的时间戳time stamp差值为一个frame duration如一帧数据的长度,为保障第二数据的接收,从第一数据对应的时间戳Ts1到T2的时长需要控制在大于或等于一帧数据长度。此外,后续的两次中断请求的间隔时长也可以控制为至少一帧数据长度来保障收数据。In some embodiments, T1 is earlier than T2, Tt is earlier than or equal to T2, and the setting of T2 ensures that the audio playback device has received the second data sent by the sound source device at T2, thereby ensuring that the second data can be decoded while reducing audio delay and improving user experience. Tt is earlier than or equal to T2, which can trigger decoding earlier to obtain the second data. Playing and decoding combined with the setting of storage rules can reduce delay while ensuring the continuity of playback. In some embodiments, the duration from T1 to T2 is sufficient to decode and store the first data according to the first storage rule. However, the interval of subsequent interrupt requests for triggering decoding can be controlled to at least one frame of data duration. In some embodiments, taking the application of LE Audio Bluetooth technology as an example, the frame length of the second data is one frame, which is encoded and sent to the audio playback device by the sound source device through the second data packet. Generally speaking, the difference between the timestamps corresponding to two adjacent frames of data is a frame duration, such as the length of a frame of data. To ensure the reception of the second data, the duration from the timestamp Ts1 corresponding to the first data to T2 needs to be controlled to be greater than or equal to the length of a frame of data. In addition, the interval between two subsequent interrupt requests can also be controlled to be at least one frame of data length to ensure data reception.
上述实施例或者实施例技术特征的组合可以使得第一数据在播放时能够更早被用户听到,从而降低了播放延时。The above-mentioned embodiments or the combination of the technical features of the embodiments can enable the first data to be heard by the user earlier during playback, thereby reducing playback delay.
需要说明的是,上述实施例中的第一数据和第二数据可以是通过接收音源设备发送的数据包得到的,第一数据或第二数据可以被分成多个数据包发送,也可以是第一数据由第一数据包发送,第二数据由第二数据包发送,对此不做限制。此外,S800-S803之间的顺序仅为举例,在不冲突的情况下可以按其他顺序执行,甚至有一些还可以并行,例如前述的播放端的相关部分和存储端的相关部分可能是并行的,并且不同的实施例中,各时刻的设置存在差异,因此顺序也可能存在差异,但二者之间又有着联系,例如S800中Tt的确定以及S802中T1时刻的设置可以与接收到音源设备发送的第一数据有关,具体关系前面或者后续部分有相关描述,此处不再赘述;可以理解的,上述不同的实施例及其技术特征在不冲突的情况下可以部分或全部组合达到降低延时的效果。It should be noted that the first data and the second data in the above embodiments can be obtained by receiving a data packet sent by the sound source device, the first data or the second data can be divided into multiple data packets for transmission, or the first data can be transmitted by the first data packet and the second data can be transmitted by the second data packet, and there is no limitation on this. In addition, the order between S800-S803 is only for example, and can be executed in other orders without conflict, and some can even be executed in parallel, for example, the relevant parts of the aforementioned playback end and the relevant parts of the storage end may be parallel, and in different embodiments, the settings of each moment are different, so the order may also be different, but there is a connection between the two, for example, the determination of Tt in S800 and the setting of T1 in S802 can be related to the first data received from the sound source device, and the specific relationship is described in the previous or subsequent parts, which will not be repeated here; it can be understood that the above different embodiments and their technical features can be partially or completely combined to achieve the effect of reducing delay without conflict.
在一些实施例中,在上述实施例或技术特征的部分或全部组合的基础上,该方法还可以包括:In some embodiments, based on a combination of part or all of the above embodiments or technical features, the method may further include:
S804:在第三时刻T3生成第二中断请求,响应于所述第二中断请求从第三存储区获取数据进行解码得到第三数据,第三存储区用于存放待解码的第一数据、待解码的第二数据和待解码的第三数据中的一种或多种;第一中断请求到第二中断请求之间的时间间隔至少为一帧数据的时长。S804: Generate a second interrupt request at a third moment T3, and in response to the second interrupt request, obtain data from a third storage area for decoding to obtain third data, wherein the third storage area is used to store one or more of the first data to be decoded, the second data to be decoded, and the third data to be decoded; the time interval between the first interrupt request and the second interrupt request is at least the duration of one frame of data.
可以理解的,除了T1至T2的间隔外,后续相邻的中断请求间隔至少为一帧数据的时长,从而保障数据的接收,确保有数据用于解码。It can be understood that, except for the interval from T1 to T2, the intervals between subsequent adjacent interrupt requests are at least as long as one frame of data, thereby ensuring the reception of data and ensuring that there is data for decoding.
S805:将第三数据按照第三存储规则存储至播放存储区。S805: Store the third data in the playback storage area according to the third storage rule.
可以理解的,第三存储规则可以在ping pang buffer中可以参照第一存储规则的方式进行存储,在环形buffer的情况下,则与第一存储规则和第二存储规则可能存在差异,如果没有到环形的循环位置时,则继续往后存,否则也可以类似与ping pang buffer参照第一存储规则进行存储。It can be understood that the third storage rule can be stored in the ping pang buffer in a manner that refers to the first storage rule. In the case of a circular buffer, there may be differences between the first storage rule and the second storage rule. If the circular loop position is not reached, the storage will continue. Otherwise, the storage can be similar to the ping pang buffer and referred to the first storage rule.
需要说明的是,上述步骤的顺序并不限定,甚至可以是并行存在的,例如一边播放的同时,一边解码并存储,而对于播放buffer而言,一边数据读取出进行播放,另一边往播放buffer中存储数据,存储和播放保持平衡,从而保障音频播放的连续性和稳定性等。It should be noted that the order of the above steps is not limited, and they can even exist in parallel. For example, while playing, decoding and storing are performed at the same time. For the playback buffer, data is read out for playback while data is stored in the playback buffer. Storage and playback are balanced to ensure the continuity and stability of audio playback.
下面将对上述实施例及其技术特征的一些组合进行举例:The following are some examples of combinations of the above embodiments and their technical features:
实施例A,如图9所示,提供一种低延播放的方法,可以应用LE Audio蓝牙技术等无线通信技术,通过调整中断请求时机等,从而可将延时控制在半帧,该方法包括:Embodiment A, as shown in FIG9 , provides a method for low-latency playback, which can apply wireless communication technologies such as LE Audio Bluetooth technology, and adjust the interrupt request timing, etc., so that the delay can be controlled within half a frame. The method includes:
S900:接收音源设备发送的第一数据包,该第一数据包包括待解码的第一数据。S900: Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
可以理解的,以应用LE Audio技术为例,音源设备可以通过LE Audio蓝牙技术与音频播放设备建立CIS通道传输该第一数据包。一般来说,接收到第一数据包后会进行解包提取有效数据(例如待解码的第一数据),然后将待解码的第一数据存储在第三存储区(例如蓝牙缓存区)中,以等待解码并播放,在该实施例中,为了降低延时,提前对第一数据进行解码,因此也可以不将待解码的第一数据存储在第三存储区,而是直接解码得到第一数据。It can be understood that, taking the application of LE Audio technology as an example, the audio source device can establish a CIS channel with the audio playback device through LE Audio Bluetooth technology to transmit the first data packet. Generally speaking, after receiving the first data packet, it will be unpacked to extract valid data (such as the first data to be decoded), and then the first data to be decoded will be stored in a third storage area (such as a Bluetooth cache area) to wait for decoding and playback. In this embodiment, in order to reduce the delay, the first data is decoded in advance, so the first data to be decoded may not be stored in the third storage area, but directly decoded to obtain the first data.
S901:获取第一数据对应的时间戳Ts1,将Ts1与半帧数据的时长之和作为播放触发时刻Tt。 S901: Obtain a timestamp Ts1 corresponding to the first data, and use the sum of Ts1 and the duration of the half-frame data as a playback triggering time Tt.
可以理解的,该第一数据对应的时间戳Ts1可以根据同步参考时间synchronization reference time确定的,以LE Audio蓝牙技术为例,synchronization reference time可以是相关标准中规定的SDU synchronization reference time,其根据音源设备设置的最大传输延时transport latency决定,具体确定方法可以参考LE Audio蓝牙协议的相关描述,在其他通信协议中可能具有类似用于同步播放参考的时间参数,可以不做限制。在该实施例中,Ts1可以是synchronization reference time(LE Audio蓝牙技术中对应为SDU synchronization reference time),因此Tt可以等于synchronization reference time与半帧时长之和,之所以增加半帧时长是因为经发明人研究发现,半帧时长一般能够较好的给解码以及其他系统时间开销做预留,也就是说半帧时长能够较稳定的保障解码得到第一数据并将其按照第一存储规则进行存储以供读取和播放。It can be understood that the timestamp Ts1 corresponding to the first data can be determined according to the synchronization reference time. Taking LE Audio Bluetooth technology as an example, the synchronization reference time can be the SDU synchronization reference time specified in the relevant standard, which is determined according to the maximum transmission latency set by the audio source device. The specific determination method can refer to the relevant description of the LE Audio Bluetooth protocol. Other communication protocols may have similar time parameters for synchronous playback reference, which can be unrestricted. In this embodiment, Ts1 can be the synchronization reference time (corresponding to the SDU synchronization reference time in LE Audio Bluetooth technology), so Tt can be equal to the sum of the synchronization reference time and the half-frame duration. The reason for increasing the half-frame duration is that the inventor has found that the half-frame duration can generally reserve decoding and other system time overheads. That is to say, the half-frame duration can stably ensure that the first data is decoded and stored according to the first storage rule for reading and playback.
S902:在接收到第一数据包时触发解码以得到第一数据;将第一数据存储在第一存储区。S902: trigger decoding upon receiving a first data packet to obtain first data; store the first data in a first storage area.
可以理解的,为了降低延时,本实施例不用等到播放时间render_time走完第一存储区产生预设中断请求才触发解码以获得第一数据,而是在接收到第一数据包时就触发解码以得到第一数据,其中,接收到第一数据包的时刻可以为Tr1,视为第一数据包的实际接收时间,这里可以理解为在接收到第一数据包后尽快通知音频模块获取数据进行解码,这种情况下可以不用将解包的待解码第一数据存储在前述的第三存储区,而是直接解码后存储在播放存储区中;也可以在接收到第一数据包时解包后将待解码的第一数据存储在第三存储区,并通知音频模块从第三存储区获取待解码的第一数据进行解码。It can be understood that in order to reduce the delay, the present embodiment does not need to wait until the playback time render_time is completed and the first storage area generates a preset interrupt request to trigger decoding to obtain the first data, but triggers decoding to obtain the first data when the first data packet is received, wherein the moment of receiving the first data packet can be Tr1, which is regarded as the actual receiving time of the first data packet. Here, it can be understood as notifying the audio module to obtain data for decoding as soon as possible after receiving the first data packet. In this case, the unpacked first data to be decoded does not need to be stored in the aforementioned third storage area, but can be directly decoded and stored in the playback storage area; it is also possible to store the first data to be decoded in the third storage area after unpacking when the first data packet is received, and notify the audio module to obtain the first data to be decoded from the third storage area for decoding.
可以理解的,由于S901中的播放触发时间Tt多加了半帧时长,这半帧时长足以供解码得到第一数据并存储,因此可以直接将第一数据存储在第一存储区中,这样也不用当心Tt到达时第一存储区没有有效数据播放。因此,播放设备端的延时可缩短到半帧时长。It is understandable that, since the playback trigger time Tt in S901 is increased by half a frame, this half frame is sufficient for decoding to obtain and store the first data, so the first data can be directly stored in the first storage area, so there is no need to worry about the first storage area having no valid data to play when Tt arrives. Therefore, the delay on the playback device side can be shortened to half a frame.
需要说明的是,上述S901和S901的执行顺序可以没有限制,例如可以并行处理。It should be noted that there is no restriction on the execution order of the above S901 and S902 , for example, they can be processed in parallel.
S903:在Tt到达时从第一存储区的第一预设位置开始读取并播放。S903: When Tt arrives, start reading and playing from the first preset position in the first storage area.
可以理解的,由于设置Tt相比第一数据对应的时间戳Ts1延迟了半帧到达,因此在Tt到达时第一数据已被存储至第一存储区,从而Tt时刻就可以播放第一数据使得用户能够更早的听到声音。It is understandable that since Tt is set to arrive half a frame later than the timestamp Ts1 corresponding to the first data, the first data has been stored in the first storage area when Tt arrives, so the first data can be played at Tt so that the user can hear the sound earlier.
需要说明的是,在Tt时刻到达时开始读取并播放,例如DMA会持续在播放存储区中按照预设规则搬运数据用于播放,以ping pang buffer为例可以从ping buffer向pang buffer进行读取和播放,再返回到ping buffer继续新一轮的读取和播放。读取到某个位置产生预设中断请求触发解码下一帧数据,但DMA仍会继续从播放存储区搬运数据,因此解码和播放可以认为是并行的,如果解码、存储不及时可能会导致DMA等没有数据可搬,从而导致无法输出音频导致声音卡顿。It should be noted that reading and playing begins when the Tt moment arrives. For example, DMA will continue to move data in the playback storage area according to preset rules for playback. Taking the ping pang buffer as an example, it can read and play from the ping buffer to the pang buffer, and then return to the ping buffer to continue a new round of reading and playing. When a preset interrupt request is generated at a certain position to trigger the decoding of the next frame of data, DMA will continue to move data from the playback storage area. Therefore, decoding and playback can be considered to be parallel. If decoding and storage are not timely, DMA may have no data to move, resulting in the inability to output audio and causing sound jams.
S904:接收音源设备发送的第二数据包,第二数据包包含编码后的第二数据;将编码后的第二数据存储至第三存储区。S904: Receive a second data packet sent by the audio source device, where the second data packet includes encoded second data; and store the encoded second data in a third storage area.
可以理解的,接收到第二数据包后先通过解包获得待解码(即编码后)的第二数据,将待解码的第二数据存储在第三存储区,该第三存储区(例如蓝牙缓存区)可以用于存放解包后的有效数据的存储区,以供音频模块从中获取数据帧进行解码。It can be understood that after receiving the second data packet, the second data to be decoded (i.e., encoded) is first obtained by unpacking, and the second data to be decoded is stored in a third storage area. The third storage area (such as a Bluetooth cache area) can be used to store valid data after unpacking, so that the audio module can obtain data frames therefrom for decoding.
需要说明的是,S904可以在S900后执行,可以与第一数据的解码、播放等并行,如与S901、S902或S903等并行。It should be noted that S904 may be executed after S900, and may be executed in parallel with decoding and playing of the first data, such as in parallel with S901, S902 or S903.
S905:在读取到第一存储区的第三预设位置时触发从第三存储区获取数据进行解码得到第二数据;将第二数据存储至第二存储区。S905: When the third preset position of the first storage area is read, trigger the acquisition of data from the third storage area for decoding to obtain second data; and store the second data in the second storage area.
需要说明的是,第三预设位置可以位于第一存储区的中间位置至第一存储区的结束位置之间,且要满足从第三预设位置播放到第一存储区的结束位置的时长足以解码并按照第二存储规则存储第二数据,这样才能保障播放到第二存储区时有第二数据供播放。It should be noted that the third preset position can be located between the middle position of the first storage area and the end position of the first storage area, and the duration of playback from the third preset position to the end position of the first storage area must be sufficient to decode and store the second data according to the second storage rule, so as to ensure that there is second data to play when playing to the second storage area.
可以理解的,T2到达时可以是在读取到第一存储区的中间位置时,即播放完一半第一数据时,生成一个第一中断请求,例如dma_irq,响应于该第一中断请求音频播放设备的音频模块从第三存储区读取待解码的第二数据(例如一帧数据长度)进行解码得到第二数据。之所以设置播放一半第一数据后生成第一中断请求,是因为经发明人研究发现剩余一半数据的播放时长足以供解码并存储第二数据,且 Tt延迟半帧时长后再加上第一数据播放了半帧时长,总共一帧时长,在一些情况下,足以接收到音源设备发送的第二数据,例如应用LE Audio技术的情况下。示例的,从第三预设位置播放到第一存储区的结束位置的时间也可能少于半个第一存储区的播放时长,因此在满足第二数据解码和存储的情况下,也可以进一步缩小第三预设位置到第一存储区结束位置的距离。It is understandable that when T2 arrives, it may be when the middle position of the first storage area is read, that is, when half of the first data is played, a first interrupt request, such as dma_irq, is generated. In response to the first interrupt request, the audio module of the audio playback device reads the second data to be decoded (such as a frame of data length) from the third storage area to decode and obtain the second data. The reason why the first interrupt request is generated after half of the first data is played is that the inventor has found through research that the playing time of the remaining half of the data is sufficient for decoding and storing the second data, and Tt delays half a frame and then plays the first data for half a frame, which is a total of one frame. In some cases, it is enough to receive the second data sent by the sound source device, such as when LE Audio technology is applied. For example, the time from the third preset position to the end position of the first storage area may be less than half the playback time of the first storage area. Therefore, when the second data decoding and storage are satisfied, the distance from the third preset position to the end position of the first storage area can be further shortened.
可以理解的,解码得到第二数据后将第二数据存储至第二存储区,从而在读取完第一存储区后可以继续读取第二存储区,保障播放的连续性。It can be understood that after the second data is obtained by decoding, the second data is stored in the second storage area, so that the second storage area can continue to be read after the first storage area is read, thereby ensuring the continuity of playback.
需要说明的是,S905在进行的过程中音频播放设备仍然会持续从播放存储区读取数据并播放。可见接收端、解码存储端、播放端可以是并行的,但同时要保障三者之间数据运转的连续性才能够保障播放的连续性,例如在接收到相关数据后才能供解码和存储才能进一步被播放,如果某一个环节出现问题可能会引起播放的不连续,本实施例,可以在保障播放连续性的基础上进一步降低延时。It should be noted that, during S905, the audio playback device will continue to read data from the playback storage area and play. It can be seen that the receiving end, the decoding storage end, and the playback end can be parallel, but at the same time, the continuity of data operation between the three must be guaranteed to ensure the continuity of playback. For example, relevant data can only be decoded and stored after it is received, and then it can be further played. If a problem occurs in a certain link, it may cause discontinuity of playback. This embodiment can further reduce the delay on the basis of ensuring the continuity of playback.
进一步的,在实施例A的前述方案的基础上,针对第三数据如第三帧数据,通过设置第一中断请求与第二中断请求之间间隔一帧时长的方式设置第二中断请求,也就是说在第二存储区(例如pang buffer)的中间位置设置第二中断请求,从而在读取播放到第二存储区的中间位置时,触发解码得到第三数据,以ping pang buffer为例,第三数据可以存储在ping buffer中因为此时ping buffer中的第一数据已经被播放,因此可用于存储第三数据。以环形buffer为例,则可以将第三数据存储在第四buffer中,从而继续完后读取播放render。后续以此类推,中断请求间隔还是保持一帧数据的长度以保证收包,并保障了解码以及播放消耗之间的同步,使得第一数据能够更早播放后续数据能够连续播放,降低了延时(半帧延时)并提升了播放的稳定性。Further, based on the aforementioned scheme of Example A, for the third data such as the third frame data, the second interrupt request is set by setting the interval of one frame between the first interrupt request and the second interrupt request, that is, the second interrupt request is set in the middle position of the second storage area (such as pang buffer), so that when reading and playing to the middle position of the second storage area, the decoding is triggered to obtain the third data. Taking the ping pang buffer as an example, the third data can be stored in the ping buffer because the first data in the ping buffer has been played at this time, so it can be used to store the third data. Taking the ring buffer as an example, the third data can be stored in the fourth buffer, so as to continue to read and play the render. By analogy, the interrupt request interval still maintains the length of one frame of data to ensure packet reception, and guarantees the synchronization between decoding and playback consumption, so that the first data can be played earlier and the subsequent data can be played continuously, reducing the delay (half-frame delay) and improving the stability of playback.
下面结合图10以蓝牙耳机为音频播放设备,手机为音源设备,采用ping-pang buffer以及应用LE Audio蓝牙技术对实施例A进行举例说明:In conjunction with FIG10 , the following example A is illustrated by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
S1000:耳机在Tr1时刻接收到手机发送的第一数据包,并触发对其中的数据进行解码以得到第一数据;S1000: The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
S1001:耳机将第一数据存储在ping buffer中;S1001: The headset stores the first data in the ping buffer;
S1002:耳机在播放触发时间到达Tt时,从ping buffer的起始位置开始读取播放,其中播放触发时间等于第一数据对应的时间戳Ts1+半帧时长;S1002: When the playback trigger time reaches Tt, the headset starts reading and playing from the start position of the ping buffer, where the playback trigger time is equal to the timestamp Ts1 corresponding to the first data + half frame duration;
S1003:耳机在播放到ping buffer的一半位置时,生成第一中断请求,以触发解码数据得到第二数据;S1003: When the earphone plays to the half position of the ping buffer, a first interrupt request is generated to trigger decoding data to obtain second data;
S1004:耳机将第二数据存储在pang buffer中;S1004: The headset stores the second data in the pang buffer;
S1005:耳机在播放到pang buffer的中间位置时,生成第二中断请求,以触发解码数据得到第三数据;S1005: When the earphone plays to the middle position of the pang buffer, a second interrupt request is generated to trigger decoding of the data to obtain the third data;
S1006:耳机将第三数据存储在ping buffer中。S1006: The headset stores the third data in the ping buffer.
可以理解的,在实施例A中,音源设备(例如手机)依次向音频播放设备(例如耳机)发送第一数据包、第二数据包和第三数据包,上述数据包中的有效数据:第一数据、第二数据和第三数据可以均为一帧数据,音频播放设备接收到第一数据包后,音频播放设备会继续从音源设备接收第二数据包、第三数据包等后续数据包。相关数据包被解包后的有效数据(例如待解码的第一数据、待解码的第二数据和/或待解码的第三数据)可以存放在通信存储区(即第三存储区,例如蓝牙buffer),上述有效数据被解码后得到对应的第一数据、第二数据或第三数据。其中待解码的第一数据也可以不存储在通信存储区,而是直接被解码,从而提前解码更早存储。第一数据对应的时间戳Ts1和第二数据对应的时间戳Ts2之间间隔一帧数据,Ts2与第三数据对应的时间戳Ts3之间间隔一帧数据,ping buffer和pang buffer的大小也设置为一帧数据长度。It can be understood that in embodiment A, the sound source device (such as a mobile phone) sends the first data packet, the second data packet and the third data packet to the audio playback device (such as headphones) in sequence. The valid data in the above data packets: the first data, the second data and the third data can all be one frame of data. After the audio playback device receives the first data packet, the audio playback device will continue to receive the second data packet, the third data packet and other subsequent data packets from the sound source device. The valid data after the relevant data packets are unpacked (such as the first data to be decoded, the second data to be decoded and/or the third data to be decoded) can be stored in the communication storage area (i.e., the third storage area, such as the Bluetooth buffer), and the above valid data is decoded to obtain the corresponding first data, second data or third data. The first data to be decoded may also not be stored in the communication storage area, but directly decoded, so as to be decoded and stored earlier in advance. There is a frame of data between the timestamp Ts1 corresponding to the first data and the timestamp Ts2 corresponding to the second data, and there is a frame of data between Ts2 and the timestamp Ts3 corresponding to the third data. The size of the ping buffer and the pang buffer is also set to a frame of data length.
通过上述方式在接收到第一数据包时就触发解码以获得第一数据,从而不用去等待播完第一存储区生成中断请求dma_irq时再去解码,为了避免DMA搬数据与解码存储过程相冲突,将Tt设置为第一数据对应的Ts1+半帧的时长,该半帧时长主要就是给解码以及其他系统时间开销做预留;利用延迟的半帧来实现解码并存储第一数据至第一存储区(例如ping buffer),从而当Tt时刻到达时可以直接从第一存 储区中读取到第一数据进行播放,例如,当Tt到达时,通过DMA开始从ping buffer搬运第一数据并送到DAC数模转换并播放出声,使得第一数据播放的延时控制为半帧。进一步的,由于Tt设置的时间是第一数据对应的Ts1+半帧时长,而相邻的第一数据和第二数据对应的时间戳差值为一个帧周期frame_duration即一帧数据的长度。这样,在播放至第一存储区(如ping buffer)的中间位置(播放半帧时长)时,第二数据(例如由第二数据包承载)一般也被音频播放设备也收到了,此时生成第一中断请求,保障了第二数据的接收,保障触发解码下一帧数据能够得到第二数据,同时利用播放第一存储区后半部分的半帧时长来保障解码得到第二数据并存储至第二存储区,从而使得播放到pang buffer时有第二数据可以播放出声,该方法降低了延时(仅半帧延时)并保障了播放的连续性。需要说明的是,第二数据的接收时间要早于或等于第二数据对应的时间戳Ts2,否则第二数据被丢弃。如果第二数据音频播放设备并没有正常收到,可以进行PLC补包处理等。因此实施例A的播放延时可以控制在半帧数据,相比两帧延时有了明显提升。By the above method, decoding is triggered to obtain the first data when the first data packet is received, so there is no need to wait for the first storage area to generate an interrupt request dma_irq after broadcasting. In order to avoid the conflict between DMA data movement and decoding and storage process, Tt is set to Ts1+ half-frame duration corresponding to the first data. The half-frame duration is mainly reserved for decoding and other system time overheads; the delayed half-frame is used to decode and store the first data in the first storage area (such as ping buffer), so that when Tt arrives, it can be directly read from the first storage area. The first data is read from the storage area for playback. For example, when Tt arrives, the first data is transferred from the ping buffer through DMA and sent to the DAC for digital-to-analog conversion and played out, so that the delay of the first data playback is controlled to half a frame. Further, since the time set by Tt is Ts1+half-frame duration corresponding to the first data, and the difference between the timestamps corresponding to the adjacent first data and the second data is a frame period frame_duration, that is, the length of a frame of data. In this way, when playing to the middle position of the first storage area (such as ping buffer) (playing half-frame duration), the second data (for example, carried by the second data packet) is generally also received by the audio playback device. At this time, the first interrupt request is generated to ensure the reception of the second data, to ensure that the trigger decoding of the next frame of data can obtain the second data, and at the same time, the half-frame duration of the second half of the first storage area is used to ensure that the second data is decoded and stored in the second storage area, so that when playing to the pang buffer, there is second data that can be played out. This method reduces the delay (only half-frame delay) and ensures the continuity of playback. It should be noted that the receiving time of the second data must be earlier than or equal to the timestamp Ts2 corresponding to the second data, otherwise the second data is discarded. If the second data audio playback device does not receive it normally, PLC packet supplement processing can be performed. Therefore, the playback delay of embodiment A can be controlled within half a frame of data, which is significantly improved compared to the two-frame delay.
实施例B,如图11所示,提供一种低延时播放方法,可以应用LE Audio蓝牙技术等无线通信方式进行数据传输,通过修改存放位置等方式,可将延时控制在半帧,该方法包括:Embodiment B, as shown in FIG11 , provides a low-latency playback method, which can use wireless communication methods such as LE Audio Bluetooth technology to transmit data, and can control the delay to half a frame by modifying the storage position and other methods. The method includes:
S1100:接收音源设备发送的第一数据包,该第一数据包包括待解码的第一数据。S1100: Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
示例的,音源设备可以通过LE Audio蓝牙技术建立CIS通道传输该第一数据包。一般来说,接收到第一数据包后会进行解包提取有效数据(例如待解码的第一数据),然后将待解码的第一数据存储在第三存储区(例如蓝牙缓存区)中,以等待解码并播放,在该实施例中,为了降低延时,提前对第一数据进行解码,因此也可以不将待解码的第一数据存储在第三存储区,而是直接解码得到第一数据。For example, the audio source device can establish a CIS channel through LE Audio Bluetooth technology to transmit the first data packet. Generally speaking, after receiving the first data packet, it will be unpacked to extract valid data (such as the first data to be decoded), and then the first data to be decoded will be stored in a third storage area (such as a Bluetooth cache area) to wait for decoding and playback. In this embodiment, in order to reduce latency, the first data is decoded in advance, so the first data to be decoded may not be stored in the third storage area, but directly decoded to obtain the first data.
S1101:获取第一数据对应的时间戳Ts1,将Ts1作为Tt;在Tt到达时从第一存储区的第一预设位置开始读取并播放。S1101: Obtain a timestamp Ts1 corresponding to the first data, and use Ts1 as Tt; when Tt arrives, read and play from a first preset position in the first storage area.
可以理解的,该第一数据对应的时间戳Ts1可以根据同步参考时间synchronization reference time确定的,以LE Audio蓝牙技术为例,synchronization reference time可以是相关标准中规定的SDU synchronization reference time,其根据音源设备设置的最大传输延时transport latency决定,具体确定方法可以参考LE Audio蓝牙协议的相关描述,在其他通信协议中可能具有类似用于同步播放参考的时间参数,可以不做限制。在该实施例中,Ts1可以是synchronization reference time(LE Audio蓝牙技术中对应为SDU synchronization reference time),因此Tt可以等于SDU synchronization reference time。实施例B中,Tt可以设置成Ts1。It can be understood that the timestamp Ts1 corresponding to the first data can be determined according to the synchronization reference time. Taking LE Audio Bluetooth technology as an example, the synchronization reference time can be the SDU synchronization reference time specified in the relevant standards, which is determined according to the maximum transmission delay transport latency set by the audio source device. The specific determination method can refer to the relevant description of the LE Audio Bluetooth protocol. Other communication protocols may have similar time parameters for synchronous playback reference, which can be unrestricted. In this embodiment, Ts1 can be the synchronization reference time (corresponding to SDU synchronization reference time in LE Audio Bluetooth technology), so Tt can be equal to SDU synchronization reference time. In embodiment B, Tt can be set to Ts1.
需要说明的是,在Tt到达时从第一存储区的第一预设位置开始读取并播放的相关说明可以参考其他实施例中的描述,例如S903,在此不再赘述。It should be noted that, for the related instructions of reading and playing from the first preset position of the first storage area when Tt arrives, reference may be made to the description in other embodiments, such as S903, and will not be repeated here.
S1102:在接收到第一数据包时触发解码以得到第一数据。S1102: Trigger decoding upon receiving a first data packet to obtain first data.
可以理解的,为了降低延时,本实施例不用得到播放时间render_time走完第一存储区时产生中断请求才触发解码以获得第一数据,而是在接收到第一数据包时就触发解码以得到第一数据,其中,接收到第一数据包的时刻Tr1,可视为第一数据包的实际接收时间,这里可以理解为在接收到第一数据包后尽快通知音频模块获取数据进行解码。也就是说,T1=Tr1。音频模块可以直接对解包后的待解码的第一数据进行解码,也可以先将待解码的第一数据存储在通信存储区(例如蓝牙buffer)中等待音频模块读取后解码。It can be understood that in order to reduce the delay, the present embodiment does not need to generate an interrupt request when the playback time render_time has completed the first storage area to trigger decoding to obtain the first data, but triggers decoding to obtain the first data when the first data packet is received, wherein the moment Tr1 of receiving the first data packet can be regarded as the actual receiving time of the first data packet, which can be understood here as notifying the audio module to obtain data for decoding as soon as possible after receiving the first data packet. In other words, T1 = Tr1. The audio module can directly decode the first data to be decoded after unpacking, or it can first store the first data to be decoded in the communication storage area (such as Bluetooth buffer) and wait for the audio module to read and decode.
S1103:将第一数据按播放顺序分为第一部分数据和第二部分数据,第一部分数据存储在第一存储区的第一区域,第一区域靠近第二存储区,第二部分数据存储在第二存储区的第二区域,第二区域靠近第一存储区,第一部分数据与第二部分数据相邻。S1103: Divide the first data into a first part of data and a second part of data in a playback order, wherein the first part of data is stored in a first area of a first storage area, the first area is close to the second storage area, the second part of data is stored in a second area of the second storage area, the second area is close to the first storage area, and the first part of data is adjacent to the second part of data.
可以理解的,第一存储区和第二存储区为相邻的两个存储区,因此可以将第一数据分开放置在两个存储区中,进一步的将第一部分数据存放在第一存储区靠近第二存储区的位置,从而通过播放第一存储区前面部分的时间来供解码和存储第一数据,需要说明的是,上述“靠近”以及“前面部分”是相对的,并不一定是以中间为分界。此外,第一部分数据与第二部分数据相邻表明第一部分数据和第二部分数据在播放的时候是要连续的,例如包括两个相邻buffer的相邻部分。 It can be understood that the first storage area and the second storage area are two adjacent storage areas, so the first data can be placed separately in the two storage areas, and the first part of the data is further stored in the first storage area near the second storage area, so that the first data can be decoded and stored by playing the front part of the first storage area. It should be noted that the above "close to" and "front part" are relative, and are not necessarily divided by the middle. In addition, the first part of the data is adjacent to the second part of the data, indicating that the first part of the data and the second part of the data are to be continuous when playing, for example, including the adjacent parts of two adjacent buffers.
在一些实施例中,第一部分数据存储在第一存储区的后半部分,所述第二部分数据存储在第二存储区的前半部分,所述第一部分数据和所述第二部分数据相邻。也就是说第一数据被均分成两部分,一半放在第一存储区的后半部分,另一半放在第二存储区的前半部分。In some embodiments, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent. That is, the first data is evenly divided into two parts, one half is placed in the second half of the first storage area, and the other half is placed in the first half of the second storage area.
在一些实施例中,第一数据可以是不均分为两部分,例如前半部分可以超出第一存储区的后半部分,即有一部分数据存储在第一存储区的前半部分,理论上只要满足从T1到播放至第一部分数据的起始存储位置的时间足以解码并存储第一数据即可。In some embodiments, the first data may be unequally divided into two parts, for example, the first half may exceed the second half of the first storage area, that is, a part of the data is stored in the first half of the first storage area. In theory, as long as the time from T1 to the starting storage position of the first part of the data is played back, it can be sufficient to decode and store the first data.
S1104:在读取完第一存储区时触发从第三存储区获取数据进行解码以得到第二数据。S1104: After reading the first storage area, trigger the acquisition of data from the third storage area for decoding to obtain second data.
可以理解的,T2为在读取完第一存储区时,在一些实施例中,在T2时刻生成第一中断请求,响应于第一中断请求从第三存储区获取数据进行解码得到第二数据。第三存储区可以参考前面的描述。在对第二数据解码前,一般要保障第二数据对应的第二数据包被音频播放设备接收,该实施例中,在应用LE Audio蓝牙相关技术时,两帧相邻数据之间对应的时间戳相差一帧时长,因此,在读取完第一存储区时第二数据一般已被音频播放设备接收。It can be understood that T2 is when the first storage area is read. In some embodiments, a first interrupt request is generated at time T2, and data is obtained from the third storage area in response to the first interrupt request for decoding to obtain the second data. The third storage area can refer to the previous description. Before decoding the second data, it is generally necessary to ensure that the second data packet corresponding to the second data is received by the audio playback device. In this embodiment, when applying LE Audio Bluetooth related technology, the timestamps corresponding to two adjacent frames of data differ by one frame duration. Therefore, when the first storage area is read, the second data is generally received by the audio playback device.
S1105:将第二数据按播放顺序分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第一存储区的除第一区域的区域。S1105: Divide the second data into a third part of data and a fourth part of data according to the playback order, store the third part of data in an area of the second storage area except the second area; store the fourth part of data in an area of the first storage area except the first area.
可以理解的,本实施例中的第一存储区、第二存储区或者第四存储区都可以设置为一帧数据的大小。这个方案可以适用于ping-pang buffer,为保障数据播放的连续性,会在ping buffer和pang buffer中循环读取播放,因此采用该实施例的存储方式,可以保障数据播放的低延时和连续性。It is understandable that the first storage area, the second storage area or the fourth storage area in this embodiment can be set to the size of one frame of data. This solution can be applied to the ping-pang buffer. To ensure the continuity of data playback, the ping buffer and the pang buffer will be read and played in a loop. Therefore, the storage method of this embodiment can ensure low latency and continuity of data playback.
在一些实施例中,将第二数据按顺序均分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的后半部分;将第四部分数据存储在第一存储区的前半部分。In some embodiments, the second data is divided equally into a third portion of data and a fourth portion of data in sequence, the third portion of data is stored in the second half of the second storage area, and the fourth portion of data is stored in the first half of the first storage area.
在一些实施例中,适用于环形缓存区,则S1105可以替换为:将第二数据分为第三部分数据和第四部分数据,将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第四存储区的第三区域,第三部分数据和第四部分数据相邻。In some embodiments, which are applicable to a circular buffer area, S1105 can be replaced by: dividing the second data into a third portion of data and a fourth portion of data, storing the third portion of data in an area of the second storage area other than the second area; storing the fourth portion of data in a third area of the fourth storage area, and the third portion of data and the fourth portion of data are adjacent.
可以理解的,在环形buffer中不只有第一存储区和第二存储区,例如还有与第二存储区相邻的第四存储区,因此第二数据可以放置在第二存储区的剩余部分,以及第四存储区的前面部分区域。这样能够保障从第二存储区读取到第四存储区的过程中保障第一数据及第二数据播放的连续性。需要说明的是,应用于环形存储区时,在不冲突的情况下,本实施例中的其他步骤可以与ping-pang存储区相同,不再赘述。It is understandable that there are not only the first storage area and the second storage area in the circular buffer, for example, there is also a fourth storage area adjacent to the second storage area, so the second data can be placed in the remaining part of the second storage area and the front part of the fourth storage area. In this way, the continuity of the playback of the first data and the second data can be guaranteed in the process of reading from the second storage area to the fourth storage area. It should be noted that when applied to the circular storage area, in the absence of conflict, the other steps in this embodiment can be the same as those in the ping-pang storage area, and will not be repeated.
在上述部分的基础上,还可能有第三数据、第四数据等后续的数据,根据存储区类型的不同后续数据的解码和存储可以参照前面数据的规则,例如第一数据、第二数据等。示例的,上述低延时播放方法还包括:On the basis of the above part, there may be subsequent data such as third data and fourth data. The decoding and storage of subsequent data according to different storage area types can refer to the rules of previous data, such as first data and second data. For example, the above low-latency playback method also includes:
S1106:在第三时刻T3生成第二中断请求,响应于第二中断请求从第三存储区获取数据进行解码得到第三数据。S1106: Generate a second interrupt request at a third time T3, and obtain data from the third storage area in response to the second interrupt request and decode to obtain third data.
可以理解的,所述第三存储区可以用于存放待解码的第一数据、待解码的第二数据和待解码的第三数据中的一种或多种;还可以存放其他待解码的有效数据。为保障各帧数据的接收,在一些实施例中,需要设置第一中断请求到第二中断请求之间的时间间隔至少为一帧数据的时长。在一些实施例中,在后续的两次相邻中断请求的间隔均需要保持至少一帧数据的时长来保障收包。在一些实施例中,T3时刻为读取完第二存储区时,或者可以为开始读取第一存储区时或可以是开始读取第四存储区时。It is understandable that the third storage area can be used to store one or more of the first data to be decoded, the second data to be decoded, and the third data to be decoded; other valid data to be decoded can also be stored. To ensure the reception of each frame of data, in some embodiments, it is necessary to set the time interval between the first interrupt request and the second interrupt request to at least the duration of one frame of data. In some embodiments, the interval between two subsequent adjacent interrupt requests needs to maintain the duration of at least one frame of data to ensure packet reception. In some embodiments, the T3 time is when the second storage area is read, or it can be when the first storage area is started to be read, or it can be when the fourth storage area is started to be read.
S1107:将第三数据按顺序分为第五部分数据和第六部分数据,并根据第三存储规则进行存储。S1107: Sequentially divide the third data into a fifth part of data and a sixth part of data, and store them according to a third storage rule.
可以理解的,对于不同的存储类型有不同的存储规则,例如ping-pang buffer,第三数据的第五部分数据可以存储在ping buffer的后半部分,第三数据的第六部分可以存储在pang buffer的前一部分。环形buffer等可以按照相关规则存储,不再赘述。It is understandable that different storage types have different storage rules. For example, in a ping-pang buffer, the fifth part of the third data can be stored in the second half of the ping buffer, and the sixth part of the third data can be stored in the first part of the pang buffer. Ring buffers, etc. can be stored according to relevant rules, which will not be described in detail.
需要说明的是,在解码和存储的过程中,播放存储区的数据可以被持续的读取并播放,例如通过DMA搬运播放存储区中的数据,通过DAC转换后输入扬声器进行播放。可见,播放和解码存储可以是并行的,为了保障播放的连续性及低延时,需要合理的设置解码时机和播放时机。该实施例通过调整解 码得到第一数据的时机以及存储第一数据的方式来降低延时,进一步,通过合理的设置中断请求来保障后续播放的连续性。It should be noted that during the decoding and storage process, the data in the playback storage area can be continuously read and played, for example, the data in the playback storage area can be moved by DMA, and then input to the speaker for playback after conversion by DAC. It can be seen that playback and decoding storage can be parallel. In order to ensure the continuity and low latency of playback, it is necessary to reasonably set the decoding timing and playback timing. The timing when the code obtains the first data and the way of storing the first data can reduce the delay, and further, the continuity of subsequent playback can be guaranteed by reasonably setting the interrupt request.
下面结合图12以蓝牙耳机为音频播放设备,手机为音源设备,采用ping-pang buffer以及应用LE Audio蓝牙技术对实施例B进行举例说明:In conjunction with FIG12 , the following example B is described by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
S1200:耳机在Tr1时刻接收到手机发送的第一数据包,并触发对其中的数据进行解码以得到第一数据;S1200: The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
S1201:耳机在播放触发时间到达Tt时,从ping buffer的起始位置开始读取播放,其中播放触发时间Tt等于第一数据对应的时间戳Ts1;S1201: When the playback trigger time reaches Tt, the earphone starts reading and playing from the start position of the ping buffer, where the playback trigger time Tt is equal to the timestamp Ts1 corresponding to the first data;
S1202:耳机将第一数据按播放顺序分为第一部分数据和第二部分数据,第一部分数据存储在ping buffer的后半部分,所述第二部分数据存储在pang buffer的前半部分,所述第一部分数据和所述第二部分数据相邻;S1202: The headset divides the first data into a first part of data and a second part of data according to a playback order, the first part of data is stored in the second half of the ping buffer, the second part of data is stored in the first half of the pang buffer, and the first part of data is adjacent to the second part of data;
S1203:耳机在读取完ping buffer时(也可以理解为开始读取pang buffer时)触发从蓝牙buffer获取数据进行解码以得到第二数据;S1203: When the headset finishes reading the ping buffer (it can also be understood as starting to read the pang buffer), it triggers to obtain data from the Bluetooth buffer for decoding to obtain the second data;
S1204:耳机将第二数据按顺序均分为第三部分数据和第四部分数据,将第三部分数据存储在pang buffer的后半部分;将第四部分数据存储在ping buffer的前半部分;S1204: the headset divides the second data into a third part of data and a fourth part of data in order, stores the third part of data in the second half of the pang buffer, and stores the fourth part of data in the first half of the ping buffer;
S1205:耳机在播放完pang buffer(或者说在开始播放ping buffer)时,生成第二中断请求,以触发解码第三数据包得到第三数据;S1205: When the earphone finishes playing the pang buffer (or starts playing the ping buffer), the earphone generates a second interrupt request to trigger decoding of the third data packet to obtain the third data;
S1206:耳机将第三数据按顺序均分为第五部分数据和第六部分数据,并将第五部分数据存储在ping buffer的后半部分,将第六部分数据存储在pang buffer的前半部分。S1206: The headset divides the third data into the fifth part of data and the sixth part of data in sequence, and stores the fifth part of data in the second half of the ping buffer and stores the sixth part of data in the first half of the pang buffer.
可以理解的,实施例B的上述举例与实施例A的相关举例相比不需要调整中断的逻辑设计,只需要修改解码后的数据在ping pang buffer的存储逻辑。在耳机收到第一数据包seq1(首包)的时间,耳机不是等待播放完第一存储区再去解码,而是在第一数据的接收时间Tr1便通知音频模块进行解码以得到第一数据,同时将第一数据按播放顺序拆成两个半帧数据,前半帧数据放置到ping buffer的后半段,后半帧数据放置到pang buffer的前半段,即ping pang buffer放置第一数据的各半帧数据。且将Tt(trigger time)设置为第一数据对应的时间戳Ts1,当通过DMA开始播放(render)到ping buffer的半帧位置时,第一数据便可以开始播放,从而第一数据的播放时延为半帧的延时。随后,当DMA render到达pang buffer起始点时,系统会产生一个预设的第一中断请求,中断请求间隔至少等于帧周期frame_duration。当音频模块收到该中断请求时,会开始从第三存储区(蓝牙buffer)取一帧数据进行解码得到第二数据,并将第二数据拆成两个半帧数据,前半帧数据放置到pang buffer的后半段,后半帧数据放置到ping buffer的前半段。后续流程以此类推。通过这种方式设计,可以使得每帧数据从对应时间戳time_stamp到最终播放出声点,时延稳定地控制在半帧时长。It can be understood that the above example of embodiment B does not need to adjust the logic design of the interrupt compared with the related example of embodiment A, and only needs to modify the storage logic of the decoded data in the ping pang buffer. When the headset receives the first data packet seq1 (first packet), the headset does not wait for the first storage area to be played before decoding, but notifies the audio module to decode to obtain the first data at the reception time Tr1 of the first data, and at the same time, the first data is split into two half-frame data according to the playback order, the first half-frame data is placed in the second half of the ping buffer, and the second half-frame data is placed in the first half of the pang buffer, that is, the ping pang buffer places each half-frame data of the first data. And Tt (trigger time) is set to the timestamp Ts1 corresponding to the first data. When the DMA starts to play (render) to the half-frame position of the ping buffer, the first data can start to play, so that the playback delay of the first data is the delay of half a frame. Subsequently, when the DMA render reaches the starting point of the pang buffer, the system will generate a preset first interrupt request, and the interrupt request interval is at least equal to the frame period frame_duration. When the audio module receives the interrupt request, it will start to get a frame of data from the third storage area (Bluetooth buffer) to decode and obtain the second data, and split the second data into two half-frames of data. The first half-frame of data is placed in the second half of the pang buffer, and the second half-frame of data is placed in the first half of the ping buffer. The subsequent process is analogous. By designing in this way, the delay of each frame of data from the corresponding timestamp time_stamp to the final playback sound point can be stably controlled within the half-frame duration.
实施例C、提供一种低延时播放方法,该方法可以在实施例B的基础上进行改进,将实施例B中的S1102修改成:在播放触发时刻Tt触发解码以得到所述第一数据。其他部分参考实施例B的相关步骤进行即可,在此不做赘述。实施例C也可以控制半帧数据时长的延时,同时保障播放的连续性。Embodiment C provides a low-latency playback method, which can be improved on the basis of embodiment B, and S1102 in embodiment B is modified to: trigger decoding at the playback trigger time Tt to obtain the first data. The other parts can be carried out with reference to the relevant steps of embodiment B, which will not be described in detail here. Embodiment C can also control the delay of the half-frame data length while ensuring the continuity of playback.
下面结合图13以蓝牙耳机为音频播放设备,手机为音源设备,采用ping-pang buffer以及应用LE Audio蓝牙技术对实施例C进行举例说明:In conjunction with FIG13 , the following example C is illustrated by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
S1300:耳机在Tr1时刻接收到手机发送的第一数据包,解包后存储至蓝牙buffer;S1300: The headset receives the first data packet sent by the mobile phone at time Tr1, unpacks it and stores it in the Bluetooth buffer;
S1301:耳机在Tt时刻到达时开始读取ping buffer并播放,并且触发从蓝牙buffer中读取数据解码得到第一数据,Tt等于第一数据对应的时间戳Ts1;S1301: When the earphone reaches the time Tt, it starts to read the ping buffer and play, and triggers the decoding of data from the Bluetooth buffer to obtain the first data, where Tt is equal to the timestamp Ts1 corresponding to the first data;
S1302:耳机将第一数据按播放顺序分为第一部分数据和第二部分数据,第一部分数据存储在ping buffer的后半部分,第二部分数据存储在pang buffer的前半部分,第一部分数据和第二部分数据相邻;S1302: The headset divides the first data into a first part of data and a second part of data according to a playback order, the first part of data is stored in the second half of the ping buffer, and the second part of data is stored in the first half of the pang buffer, and the first part of data and the second part of data are adjacent to each other;
S1303:耳机在读取完ping buffer时触发从蓝牙buffer获取数据进行解码以得到第二数据;S1303: When the earphone finishes reading the ping buffer, it triggers to obtain data from the Bluetooth buffer for decoding to obtain the second data;
S1304:耳机将第二数据按顺序均分为第三部分数据和第四部分数据,将第三部分数据存储在pang buffer的后半部分;将第四部分数据存储在ping buffer的前半部分; S1304: the headset divides the second data into a third part of data and a fourth part of data in order, stores the third part of data in the second half of the pang buffer, and stores the fourth part of data in the first half of the ping buffer;
S1305:耳机在播放完pang buffer(或者说在开始播放ping buffer)时,生成第二中断请求,以触发从蓝牙buffer获取数据进行解码以得到第三数据;S1305: When the headset finishes playing the pang buffer (or starts playing the ping buffer), the headset generates a second interrupt request to trigger the acquisition of data from the Bluetooth buffer for decoding to obtain third data;
S1306:耳机将第三数据按顺序均分为第五部分数据和第六部分数据,并将第五部分数据存储在ping buffer的后半部分,将第六部分数据存储在pang buffer的前半部分。S1306: The headset divides the third data into the fifth part of data and the sixth part of data in sequence, and stores the fifth part of data in the second half of the ping buffer and stores the sixth part of data in the first half of the pang buffer.
可以理解的,实施例C与实施例B相比,将触发解码已得到第一数据的时间从Tr1时刻调整到Tt时刻,之所以可以这样调整,是因为经过发明人研究,认为半帧数据的时长足以解码并存储第一数据,因此从Tt时刻开始触发解码以得到第一数据也足以保障半帧延时及连续播放,效果和实施例B类似,只是首次中断请求设计的时机不同,当然也可以通过更精确的计算确定一个更准确的解码到存储的时间,从而可以进一步调整触发解码得到第一数据的时机或存储的位置,甚至可能将延时缩短到小于半帧时长的情况,均属于本申请的保护范围。It can be understood that, compared with Embodiment B, Embodiment C adjusts the time for triggering decoding to obtain the first data from moment Tr1 to moment Tt. The reason for this adjustment is that, after research by the inventor, it is believed that the duration of half-frame data is sufficient to decode and store the first data. Therefore, triggering decoding from moment Tt to obtain the first data is also sufficient to ensure half-frame delay and continuous playback. The effect is similar to that of Embodiment B, except that the timing of the first interrupt request design is different. Of course, a more accurate decoding to storage time can be determined through more precise calculations, so as to further adjust the timing of triggering decoding to obtain the first data or the storage location, and even the delay may be shortened to less than half a frame duration, all of which fall within the scope of protection of the present application.
实施例D,如图14所示,提供一种低延时播放方法,能够控制仅延时一帧数据时长,包括:Embodiment D, as shown in FIG14 , provides a low-delay playback method capable of controlling the delay of only one frame of data, including:
S1400:接收音源设备发送的第一数据包,该第一数据包包括待解码的第一数据。S1400: Receive a first data packet sent by a sound source device, where the first data packet includes first data to be decoded.
可以理解的,对S1400的说明可以参考S1100。It can be understood that the description of S1400 can refer to S1100.
S1401:获取第一数据对应的时间戳Ts1,将Ts1作为Tt;在Tt到达时从第一存储区的第一预设位置开始读取并播放。S1401: Obtain a timestamp Ts1 corresponding to the first data, and use Ts1 as Tt; when Tt arrives, read and play from a first preset position in the first storage area.
可以理解的,对S1401的说明可以参考S1101。It can be understood that the description of S1401 can refer to S1101.
S1402:在接收到第一数据包时触发解码以得到第一数据。S1402: Trigger decoding upon receiving a first data packet to obtain first data.
可以理解的,对S1402说明可以参考S1102。It can be understood that the description of S1402 can refer to S1102.
S1403:将第一数据存储至第二存储区。S1403: Store the first data in the second storage area.
可以理解的,第二存储区可以是ping-pang buffer的pang buffer,也可以是环形buffer的第二个buffer,还可以是其他存储区中的一部分,对此不做限制。It can be understood that the second storage area can be the pang buffer of the ping-pang buffer, the second buffer of the ring buffer, or a part of other storage areas, and there is no limitation on this.
S1404:在读取完第一存储区时触发从第三存储区获取数据进行解码以得到第二数据。S1404: After reading the first storage area, trigger the acquisition of data from the third storage area for decoding to obtain second data.
可以理解的,S1404可以参考S1104的相关描述。It can be understood that S1404 can refer to the relevant description of S1104.
S1405:将第二数据存储在第一存储区。S1405: Store the second data in the first storage area.
可以理解的,第一存储区可以是ping-pang buffer的ping buffer,也可以是环形buffer的第三个存储区,在应用于环形存储区时,S1405可以替换为:将第二数据存储在第四存储区。示例的,针对环状的缓存区,第四存储区可以是与第二存储区相邻的存储区。It is understandable that the first storage area may be a ping buffer of a ping-pang buffer, or may be the third storage area of a ring buffer. When applied to the ring storage area, S1405 may be replaced by: storing the second data in the fourth storage area. For example, for the ring-shaped buffer area, the fourth storage area may be a storage area adjacent to the second storage area.
需要说明的是,实施例D中还可能有第三帧数据,例如第三数据为第二数据的后面一帧数据,该第三数据可以参考第一数据的情况继续进行存储,不同的缓存区类型可能会有不同的存储方式,参照前面的存储规则进行存储和播放即可,在此不再赘述。实施例D中的技术特征在不冲突的情况下适用于ping-pang buffer也适用于环形buffer,还可以适用于其他类型的存储方式。实施例D可以满足T1时刻早于自Tt时刻起第一次读完第一存储区的时刻,Tt早于或等于T2且T2的设置保障在T2时刻音频播放设备已接收到音源设备发送的第二数据。It should be noted that there may be a third frame of data in Embodiment D. For example, the third data is a frame of data after the second data. The third data can continue to be stored with reference to the first data. Different buffer types may have different storage methods. You can refer to the previous storage rules for storage and playback, which will not be repeated here. The technical features in Embodiment D are applicable to ping-pang buffers and circular buffers when there is no conflict, and can also be applied to other types of storage methods. Embodiment D can satisfy that time T1 is earlier than the time when the first storage area is read for the first time since time Tt, Tt is earlier than or equal to T2, and the setting of T2 ensures that the audio playback device has received the second data sent by the sound source device at time T2.
下面结合图15以蓝牙耳机为音频播放设备,手机为音源设备,采用ping-pang buffer以及应用LE Audio蓝牙技术对实施例D进行举例说明:In conjunction with FIG15 , the following example D is described by taking a Bluetooth headset as an audio playback device, a mobile phone as an audio source device, using a ping-pang buffer, and applying LE Audio Bluetooth technology:
S1500:耳机在Tr1时刻接收到手机发送的第一数据包,并触发对其中的数据进行解码以得到第一数据;S1500: The headset receives a first data packet sent by the mobile phone at time Tr1, and triggers decoding of the data therein to obtain first data;
S1501:耳机在播放触发时间到达Tt时,从ping buffer的起始位置开始读取播放,其中播放触发时间Tt等于第一数据对应的时间戳Ts1;S1501: When the playback trigger time reaches Tt, the headset starts reading and playing from the start position of the ping buffer, where the playback trigger time Tt is equal to the timestamp Ts1 corresponding to the first data;
S1502:耳机将第一数据存储至pang buffer;S1502: The headset stores the first data in pang buffer;
S1503:耳机在读取完ping buffer时触发从蓝牙buffer获取数据进行解码以得到第二数据;S1503: When the earphone finishes reading the ping buffer, it triggers to obtain data from the Bluetooth buffer for decoding to obtain the second data;
S1504:耳机将第二数据存储在ping buffer;S1504: The headset stores the second data in the ping buffer;
S1505:耳机在播放完pang buffer(或者说在开始播放ping buffer)时,生成第二中断请求,以触发解码第三数据包得到第三数据; S1505: When the earphone finishes playing the pang buffer (or starts playing the ping buffer), the earphone generates a second interrupt request to trigger decoding of the third data packet to obtain third data;
S1506:耳机将第三数据存储在pang buffer。S1506: The earphone stores the third data in the pang buffer.
可以用理解的,实施例D中,可以在耳机收到第一数据包seq1的时间Tr1便通知耳机音频模块进行第一包数据的解码,耳机不用去等待读取完第一存储区时产生的中断请求dma_irq,而是第一数据的接收时刻Tr1就触发解码得到第一数据,同时将第一数据放置到第二存储区,例如pang buffer。并且将播放触发时间Tt设置为第一数据对应的时间戳Ts1,这样第一数据的理论延时便为一个ping buffer长度的时延,即帧长7.5ms/10ms,因为第一数据已经被提前放到pang buffer,当播放到pang buffer时,耳机便能开始出声,而此时距离耳机起播点,即Tt,正好是一块buffer,如一帧的时间。当render_time走到pang buffer起始点时,即经历了第一个中断周期irq_intervel,此时会产生预设的第一中断请求,音频模块开始从蓝牙buffer取数据进行解码得到第二数据,并将第二数据放置到ping buffer中。It can be understood that in embodiment D, the headset can notify the headset audio module to decode the first packet of data at the time Tr1 when the headset receives the first data packet seq1. The headset does not need to wait for the interrupt request dma_irq generated when the first storage area is read. Instead, the first data is triggered to decode and obtain the first data at the time Tr1 of receiving the first data, and the first data is placed in the second storage area, such as pang buffer. And the play trigger time Tt is set to the timestamp Ts1 corresponding to the first data, so that the theoretical delay of the first data is a delay of the length of a ping buffer, that is, a frame length of 7.5ms/10ms, because the first data has been placed in the pang buffer in advance, when the pang buffer is played, the headset can start to sound, and at this time, the distance from the headset start point, that is, Tt, is exactly a buffer, such as a frame time. When render_time reaches the starting point of the pang buffer, that is, the first interrupt cycle irq_intervel has been experienced, and a preset first interrupt request will be generated at this time, and the audio module starts to get data from the Bluetooth buffer to decode and obtain the second data, and places the second data in the ping buffer.
实施例E,提供一种低延时播放方法,可以在实施例D的基础上进行改进,从而控制在一帧数据时长的延时,并保障播放的连续性。实施例D中在接收到音源设备发送的第一数据时(即Tr1时刻,例如接收到第一数据包时)就触发解码以得到第一数据,经发明人分析认为,T1的设置还可以有其他方式,例如,T1为自Tr1至第一次播放到第二预设位置之间的任意时刻,从所述第二预设位置到播放完所述第一存储区的时间足以解码并存储所述第一数据至所述第二存储区。也就是说,只要保障从T1至第一数据的起始存储位置的时间间隔足以触发解码获得第一数据并将其存储在上述位置即可,例如将第一数据存储在第二存储区。该实施例可以控制在一帧延时,并且保障播放的连续性。实施例E的方案可以在实施例D的基础上进行调整,例如将S1402替换为:在自Tr1至第一次播放到第二预设位置之间的任意时刻触发解码以得到第一数据。其中,第二预设位置到播放完所述第一存储区的时间足以解码并存储第一数据至第二存储区。其他参考步骤可参考实施例D,不再赘述。Embodiment E provides a low-delay playback method, which can be improved on the basis of embodiment D, so as to control the delay of one frame of data and ensure the continuity of playback. In embodiment D, when the first data sent by the sound source device is received (i.e., Tr1 moment, for example, when the first data packet is received), decoding is triggered to obtain the first data. According to the analysis of the inventor, T1 can also be set in other ways, for example, T1 is any moment from Tr1 to the first playback to the second preset position, and the time from the second preset position to the completion of the playback of the first storage area is sufficient to decode and store the first data in the second storage area. In other words, as long as the time interval from T1 to the starting storage position of the first data is sufficient to trigger decoding to obtain the first data and store it in the above position, for example, the first data is stored in the second storage area. This embodiment can control the delay in one frame and ensure the continuity of playback. The scheme of embodiment E can be adjusted on the basis of embodiment D, for example, S1402 is replaced by: triggering decoding to obtain the first data at any moment from Tr1 to the first playback to the second preset position. Among them, the time from the second preset position to the completion of the playback of the first storage area is sufficient to decode and store the first data in the second storage area. For other reference steps, please refer to Example D and will not be repeated here.
可以理解的,在不同的实施例中,对于T1和T2范围的描述时,用到了播放存储区的某个预设位置,例如第一预设位置,第二预设位置,也用到了某个预设的时刻,例如Ta、Tb、Tc、Td等,但其作用是类似的,在不冲突的情况下具有对应性,可以互换。It can be understood that in different embodiments, when describing the ranges of T1 and T2, a preset position of the playback storage area is used, such as the first preset position and the second preset position, and a preset moment is also used, such as Ta, Tb, Tc, Td, etc., but their functions are similar, have correspondence when there is no conflict, and can be interchangeable.
需要说明的是,上述实施例中的技术特征在不冲突的情况下适用于ping-pang buffer也适用于环形buffer,还可以适用于其他类型的存储方式。实施例A-E均可以满足T1等于或晚于所述音频播放设备接收到第一数据的时间Tr1,T2等于或晚于音频播放设备接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自所述Tt起第一次读取完所述第二存储区前开始播放。可见通过对,Tt、T1、T2、存储规则的优化设置可以实现音频播放的低延时,同时保障音频播放的连续性,从而提升用户体验。It should be noted that the technical features in the above embodiments are applicable to ping-pang buffers and ring buffers when there is no conflict, and can also be applied to other types of storage methods. Embodiments A-E can all satisfy that T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt. It can be seen that by optimizing the settings of Tt, T1, T2, and storage rules, low latency of audio playback can be achieved, while ensuring the continuity of audio playback, thereby improving user experience.
上述一些实施例还可以适用于TWS音频播放设备,例如TWS耳机、TWS音箱等,TWS音频播放设备可包括第一音频播放设备和第二音频播放设备,该第一音频播放设备和第二音频播放设备均可适用上述一些实施例的低延时播放方法,第一音频播放设备和第二音频播放设备接收音源设备发送的数据包,两个设备接收到的数据包数据可以相同也可以不同,例如第一音频播放设备接收的是左声道数据,第二音频播放设备接收的是右声道数据,一帧数据对应的左右声道数据具有相同的时间戳,从而可以保障第一音频播放设备和第二音频播放设备可以同步播放音频。Some of the above embodiments can also be applied to TWS audio playback devices, such as TWS headphones, TWS speakers, etc. The TWS audio playback device may include a first audio playback device and a second audio playback device. The first audio playback device and the second audio playback device can both apply the low-latency playback method of some of the above embodiments. The first audio playback device and the second audio playback device receive data packets sent by the audio source device. The data packets received by the two devices may be the same or different. For example, the first audio playback device receives left channel data, and the second audio playback device receives right channel data. The left and right channel data corresponding to a frame of data have the same timestamp, thereby ensuring that the first audio playback device and the second audio playback device can play audio synchronously.
在一些实施例中,提供一种低延时的播放方法,应用于播放设备,该播放设备包括第一音频播放设备和第二音频播放设备,第一音频播放设备和第二音频播放设备分别具有前述任一实施例所描述的播放存储区,第一音频播放设备和第二音频播放设备分别执行前述任一实施例所描述的方法(具体步骤参见前述实施例,在此不做赘述)以实现同步播放,其中,第一音频播放设备的第一数据和第二音频播放设备的第一数据具有相同的时间戳Ts1;第一音频播放设备的第二数据和第二音频播放设备的第二数据具有相同的时间戳Ts2;Tt根据Ts1确定,从而第一音频播放设备和第二音频播放设备可以在相同的播放触发时刻Tt开始读取各自的播放存储区进行播放,此外,第一音频播放设备和第二音频播放设备设置的T1时刻也相同,从而保障二者可以同步进行解码得到第一数据,此外二者具有相同的Ts2,从而可以保障各自的第二数据也可以同步播放,例如,其中某个播放设备由于播放出错导致第二数据的播放时间超过了Ts2则考虑不播放该第二数据,以保障播放的同步性。In some embodiments, a low-latency playback method is provided, which is applied to a playback device, the playback device comprising a first audio playback device and a second audio playback device, the first audio playback device and the second audio playback device respectively having a playback storage area described in any of the foregoing embodiments, the first audio playback device and the second audio playback device respectively executing the method described in any of the foregoing embodiments (for specific steps, see the foregoing embodiments, which are not described in detail here) to achieve synchronous playback, wherein first data of the first audio playback device and first data of the second audio playback device have the same timestamp Ts1; second data of the first audio playback device and second data of the second audio playback device have the same timestamp Ts2; Tt is determined according to Ts1, so that the first audio playback device and the second audio playback device can start reading their respective playback storage areas for playback at the same playback triggering time Tt, in addition, the first audio playback device and the second audio playback device are set to the same time T1, so that the two can be decoded synchronously to obtain the first data, and in addition, the two have the same Ts2, so that the respective second data can also be played synchronously, for example, if the playback time of the second data of a certain playback device exceeds Ts2 due to a playback error, the second data is not played to ensure the synchronization of playback.
在一些实施例中,第一音频播放设备的第一数据和第二音频播放设备的第一数据可以相同,在另一 些实施例中,第一音频播放设备的第一数据和第二音频播放设备的第一数据也可以不相同,例如一个是左声道一个是右声道,示例的,第一音频播放设备为TWS耳机的左耳机,第二音频播放设备的为TWS耳机的右耳机。In some embodiments, the first data of the first audio playback device and the first data of the second audio playback device may be the same. In some embodiments, the first data of the first audio playback device and the first data of the second audio playback device may also be different, for example, one is the left channel and the other is the right channel. For example, the first audio playback device is the left earphone of the TWS headset, and the second audio playback device is the right earphone of the TWS headset.
在一些实施例中,第一音频播放设备播放的每一帧数据对应的时间戳与第二音频播放设备播放相应的每一帧数据对应的时间戳相同,从而可以保障第一音频播放设备和第二音频播放设备每一帧数据的同步播放,使得用户听到声音保持一致性。上述相应的每一帧可以理解为分别发送给第一音频播放设备和第二音频播放设备的具有相同的同步参考时间的一帧数据。In some embodiments, the timestamp corresponding to each frame of data played by the first audio playback device is the same as the timestamp corresponding to each frame of data played by the second audio playback device, thereby ensuring the synchronous playback of each frame of data by the first audio playback device and the second audio playback device, so that the sound heard by the user remains consistent. Each of the corresponding frames can be understood as a frame of data with the same synchronization reference time sent to the first audio playback device and the second audio playback device respectively.
可以理解的,为了保障低延时及播放的连续性,需要设置T1早于T2,也就是说先解码第一数据,再解码第二数据,且设置T1时刻早于自Tt时刻起第一次读完第一存储区的时刻,也就是说可以更早的触发解码和存储从而更早的播放出声降低了音频延时,且设置Tt早于或等于T2且T2的设置要保障在T2时刻音频播放设备已接收到音源设备发送的第二数据,也就是说不用等第二数据解码就可以开始播放,避免延后播放增加延时,而保障T2时刻第二数据已接收到,从而保障有下一帧数据可以解码得到第二数据,保障了数据播放的连续性。It can be understood that in order to ensure low latency and continuity of playback, T1 needs to be set earlier than T2, that is, the first data is decoded first, and then the second data is decoded, and T1 is set earlier than the moment when the first storage area is read for the first time since Tt, that is, decoding and storage can be triggered earlier, so that the audio delay can be reduced earlier, and Tt is set earlier than or equal to T2 and T2 is set to ensure that the audio playback device has received the second data sent by the sound source device at T2, that is, there is no need to wait for the second data to be decoded to start playback, avoiding delayed playback and increasing delay, and ensuring that the second data has been received at T2, so as to ensure that the next frame of data can be decoded to obtain the second data, thereby ensuring the continuity of data playback.
本申请还提供一种低延时播放装置,该低延时播放装置包括:播放存储区,该播放存储区包括第一存储区和第二存储区;The present application also provides a low-latency playback device, the low-latency playback device comprising: a playback storage area, the playback storage area comprising a first storage area and a second storage area;
播放模块,被配置用于在播放触发时刻Tt到来时从第一存储区的第一预设位置开始读取播放存储区并播放;A playing module, configured to read and play the playing storage area from the first preset position of the first storage area when the playing triggering moment Tt arrives;
音频模块,被配置用于在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;The audio module is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
其中,T1等于或晚于接收到第一数据的时间Tr1,T2等于或晚于接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次读取完第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the first data is received, T2 is equal to or later than the time Tr2 when the second data is received, T2 is equal to or later than Tt, and the first data starts to be played before the second storage area is read for the first time since Tt.
在一些实施例中,该装置还包括:通信模块,该通信模块包括无线收发器和通信存储区,无线收发器被配置用于接收音源设备发送的数据包,通信存储区被配置用于存放数据包中携带的待解码的数据,待解码的数据包括待解码的第一数据和/或待解码的第二数据。In some embodiments, the device also includes: a communication module, the communication module includes a wireless transceiver and a communication storage area, the wireless transceiver is configured to receive a data packet sent by a sound source device, and the communication storage area is configured to store data to be decoded carried in the data packet, and the data to be decoded includes first data to be decoded and/or second data to be decoded.
在一些实施例中,无线收发器被配置用于依次接收音源设备发送的第一数据包和第二数据包,第一数据包包含待解码的第一数据,第二数据包包含待解码的第二数据;将待解码的第一数据和/或待解码的第二数据存储至通信存储区。In some embodiments, the wireless transceiver is configured to sequentially receive a first data packet and a second data packet sent by a sound source device, wherein the first data packet contains first data to be decoded and the second data packet contains second data to be decoded; and store the first data to be decoded and/or the second data to be decoded in a communication storage area.
在一些实施例中,音频模块被配置用于将第一数据存储在第一存储区;将第二数据存储至第二存储区。In some embodiments, the audio module is configured to store the first data in a first storage area; and store the second data in a second storage area.
在该实施例中,可以理解的,播放触发时刻Tt根据第一数据对应的时间戳Ts1与第一预设时间段确定;所述第一预设时间段足以解码获得第一数据并将所述第一数据存储至所述第一存储区,在一些实施例中,且第一预设时间段小于读取完第一存储区和第二存储区的总时长;从而可以保障播放延时小于读取第一存储区和第二存储区的总时长。如果第一存储区和第二存储区均为一帧时长,则可以保障延时低于两帧。In this embodiment, it can be understood that the playback triggering time Tt is determined according to the timestamp Ts1 corresponding to the first data and the first preset time period; the first preset time period is sufficient to decode and obtain the first data and store the first data in the first storage area. In some embodiments, the first preset time period is less than the total time of reading the first storage area and the second storage area; thus, the playback delay can be guaranteed to be less than the total time of reading the first storage area and the second storage area. If the first storage area and the second storage area are both one frame long, the delay can be guaranteed to be less than two frames.
可以理解的,T1早于或等于Ta,Ta到Tt的时间足以解码得到第一数据并存储至所述第一存储区;从而保障T1时刻进行解码能够在Tt到达之前将第一数据存储至第一存储区,从而在Tt时刻之后的播放阶段不会有延时,从用户角度来说,Tt到达就可以开始听到声音。It can be understood that T1 is earlier than or equal to Ta, and the time from Ta to Tt is sufficient to decode the first data and store it in the first storage area; thereby ensuring that decoding at T1 can store the first data in the first storage area before Tt arrives, so that there will be no delay in the playback phase after Tt. From the user's perspective, the sound can be heard when Tt arrives.
可以理解的,T2早于或等于Tb,Tb到读取完第一数据的时间足以解码得到第二数据并存储第二数据至第二存储区。从而在播完第一数据后可以马上播放第二数据,保障数据播放的连续性。It can be understood that T2 is earlier than or equal to Tb, and the time from Tb to the completion of reading the first data is sufficient to decode the second data and store the second data in the second storage area, so that the second data can be played immediately after the first data is played, ensuring the continuity of data playback.
在一些实施例中,音频模块被配置用于将第一数据按播放顺序分为第一部分数据和第二部分数据,按照第一存储规则将第一部分数据存储在第一存储区的第一区域,第二部分数据存储在第二存储区的第二区域,第一区域与第二区域相邻;音频模块被配置用于将第二数据按播放顺序分为第三部分数据和第四部分数据,按照第二存储规则将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数 据存储在第一存储区的除第一区域的区域;或者,In some embodiments, the audio module is configured to divide the first data into a first portion of data and a second portion of data in a playback order, and store the first portion of data in a first area of the first storage area and the second portion of data in a second area of the second storage area according to a first storage rule, wherein the first area is adjacent to the second area; the audio module is configured to divide the second data into a third portion of data and a fourth portion of data in a playback order, and store the third portion of data in an area of the second storage area excluding the second area according to a second storage rule; and store the fourth portion of data in an area of the second storage area excluding the second area according to a second storage rule. The data is stored in an area other than the first area in the first storage area; or
音频模块被配置用于将第二数据分为第三部分数据和第四部分数据,按照第二存储规则将第三部分数据存储在第二存储区的除第二区域的区域;将第四部分数据存储在第四存储区的第三区域,第三区域和第二存储区相邻,第四存储区是播放存储区中与第二存储区相邻的存储区。The audio module is configured to divide the second data into a third part of data and a fourth part of data, and store the third part of data in an area of the second storage area except the second area according to the second storage rule; and store the fourth part of data in a third area of the fourth storage area, the third area is adjacent to the second storage area, and the fourth storage area is a storage area in the playback storage area adjacent to the second storage area.
在该实施例中,可以理解的,T1早于或等于Tc,从Tc到读取至第一存储区用于存储第一数据的位置的时间足以解码得到第一数据且按照该实施例的第一存储规则存储第一数据,从而保障读取到用于存储第一数据的位置时能够有声音输出;T2早于或等于Td,从Td到读取完所述第一数据的时间足以解码得到第二数据并按照第二规则存储第二数据,从而保障第二数据和第一数据播放的连续性;Tt根据第一数据对应的时间戳Ts1与第二预设时间段确定;第二预设时间段大于或等于0,在一些实施例中,且第二预设时间可以小于读取完第一存储区以及读取一半第二存储区的总时长。在一些实施例中,第二预设时间的设置保障播放延时小于读取第一存储区和第二存储区的总时长即可。也就是说可以根据T2时间的变化而调整。In this embodiment, it can be understood that T1 is earlier than or equal to Tc, and the time from Tc to the time of reading the first storage area for storing the first data is sufficient to decode the first data and store the first data according to the first storage rule of this embodiment, so as to ensure that there is sound output when the position for storing the first data is read; T2 is earlier than or equal to Td, and the time from Td to the time of reading the first data is sufficient to decode the second data and store the second data according to the second rule, so as to ensure the continuity of the playback of the second data and the first data; Tt is determined according to the timestamp Ts1 corresponding to the first data and the second preset time period; the second preset time period is greater than or equal to 0, and in some embodiments, the second preset time can be less than the total time of reading the first storage area and reading half of the second storage area. In some embodiments, the setting of the second preset time ensures that the playback delay is less than the total time of reading the first storage area and the second storage area. That is to say, it can be adjusted according to the change of T2 time.
在一些实施例中,音频播放设备被配置用于将第一数据均分为第一部分数据和第二部分数据,第一部分数据存储在第一存储区的后半部分,第二部分数据存储在第二存储区的前半部分,第一部分数据和所述第二部分数据相邻;将第二数据均分为第三部分数据和第四部分数据,第三部分数据存储在第二存储区的后半部分,第四部分数据存储在第一存储区的前半部分,或者第四部分数据存储在第四存储区的前半部分,第三部分数据与第四部分数据相邻。In some embodiments, the audio playback device is configured to equally divide the first data into a first portion of data and a second portion of data, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent; to equally divide the second data into a third portion of data and a fourth portion of data, the third portion of data is stored in the second half of the second storage area, the fourth portion of data is stored in the first half of the first storage area, or the fourth portion of data is stored in the first half of the fourth storage area, and the third portion of data is adjacent to the fourth portion of data.
在一些实施例中,音频模块按照第一存储规则将第一数据存储至第二存储区;按照第二存储规则将第二数据存储至第一存储区;或,将第二数据存储至第四存储区,第四存储区是播放存储区中与第二存储区相邻的存储区。In some embodiments, the audio module stores the first data in the second storage area according to the first storage rule; stores the second data in the first storage area according to the second storage rule; or stores the second data in the fourth storage area, which is a storage area in the playback storage area adjacent to the second storage area.
在本实施例中,可以理解的,T1早于或等于Te,从Te到读取完第一存储区的时间足以解码得到第一数据并将第一数据存储至第二存储区,从而保障第一数据的播放,并降低延时。In this embodiment, it can be understood that T1 is earlier than or equal to Te, and the time from Te to reading the first storage area is sufficient to decode the first data and store the first data in the second storage area, thereby ensuring the playback of the first data and reducing latency.
可以理解的,T2小于或等于Tf,从Tf到读取完第一数据的时间足以解码得到第二数据并将第二数据存储至第一存储区或第四存储区,从而保障第一数据和第二数据播放的连续性。It can be understood that T2 is less than or equal to Tf, and the time from Tf to the completion of reading the first data is sufficient to decode the second data and store the second data in the first storage area or the fourth storage area, thereby ensuring the continuity of the playback of the first data and the second data.
可以理解的,Tt根据第一数据对应的时间戳Ts1与第三预设时间段确定;第三预设时间段大于或等于0,且小于读取第一存储区的时长,从而保障第一数据的延时控制在读取第一存储区和第二存储区的总时长以内。It can be understood that Tt is determined based on the timestamp Ts1 corresponding to the first data and the third preset time period; the third preset time period is greater than or equal to 0 and less than the duration of reading the first storage area, thereby ensuring that the delay of the first data is controlled within the total duration of reading the first storage area and the second storage area.
在一些实施例中,播放触发时间Tt等于所述第一数据对应的时间戳Ts1与半帧数据的时长之和。In some embodiments, the playback trigger time Tt is equal to the sum of the timestamp Ts1 corresponding to the first data and the duration of the half-frame data.
在一些实施例中,音频模块被配置用于在通信模块接收到第一数据包时触发解码以得到第一数据。In some embodiments, the audio module is configured to trigger decoding to obtain the first data when the communication module receives the first data packet.
在一些实施例中,音频模块被配置用于在播放模块读取到第一存储区的中间位置时触发解码得到第二数据。In some embodiments, the audio module is configured to trigger decoding to obtain the second data when the playback module reads a middle position of the first storage area.
在一些实施例中,音频模块被配置用于在播放模块读取到第一存储区的结束位置时触发解码得到第二数据。In some embodiments, the audio module is configured to trigger decoding to obtain the second data when the playback module reads the end position of the first storage area.
在一些实施例中,Tt等于第一数据对应的时间戳Ts1。In some embodiments, Tt is equal to the timestamp Ts1 corresponding to the first data.
在一些实施例中,音频模块被配置用于在播放触发时刻Tt触发解码以得到第一数据。In some embodiments, the audio module is configured to trigger decoding at a play triggering time Tt to obtain the first data.
在一些实施例中,音频模块被配置用于响应于在第二时刻T2生成的第一中断请求获取数据进行解码得到第二数据。In some embodiments, the audio module is configured to obtain data in response to a first interrupt request generated at a second time T2 to decode and obtain second data.
在一些实施例中,音频模块被配置用于,响应于在第三时刻T3生成第二中断请求获取数据进行解码得到第三数据,将第三数据按照第三存储规则存储至所述播放存储区;In some embodiments, the audio module is configured to, in response to generating a second interrupt request at a third time T3, obtain data for decoding to obtain third data, and store the third data in the playback storage area according to a third storage rule;
在一些实施例中,第一中断请求到第二中断请求之间的时间间隔至少为一帧数据的时长。In some embodiments, the time interval between the first interrupt request and the second interrupt request is at least the duration of a frame of data.
在一些实施例中,第一存储区为乒缓存ping buffer,第二存储区为乓缓存pang buffer;或者,第一存储区和第二存储区是环形缓存中的相邻两个缓存区。In some embodiments, the first storage area is a ping buffer, and the second storage area is a pong buffer; or, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer.
在一些实施例中,音频播放设备和音源设备通过LE Audio蓝牙技术进行通信。In some embodiments, the audio playback device and the audio source device communicate via LE Audio Bluetooth technology.
在一些实施例中,第一数据和第二数据均为一帧数据;第一存储区和第二存储区均为存储一帧数据 的大小。In some embodiments, the first data and the second data are both one frame of data; the first storage area and the second storage area are both for storing one frame of data. the size of.
在一些实施例中,T2小于或等于Td,从Td到读取完第一数据的时间足以解码得到第二数据并按照第二存储规则存储第二数据。In some embodiments, T2 is less than or equal to Td, and the time from Td to the completion of reading the first data is sufficient to decode and obtain the second data and store the second data according to the second storage rule.
上述实施例、实施方式及相关技术特征在不冲突的情况下可以相互组合以对应于前面的实施例,例如实施例A-E,对此不再赘述。通过上述各种组合可以降低第一数据例如音乐的第一帧数据的播放延时,从而使得用户可以在播放音乐时更早的听到音乐,此外通过T1、T2、存储规则等参数的设置可以保障音频播放的连续性,从而提升用户体验。The above embodiments, implementation methods and related technical features can be combined with each other to correspond to the previous embodiments, such as embodiments A-E, when they do not conflict, and will not be described in detail. Through the above various combinations, the playback delay of the first data, such as the first frame data of music, can be reduced, so that the user can hear the music earlier when playing music. In addition, the continuity of audio playback can be guaranteed by setting parameters such as T1, T2, storage rules, etc., thereby improving the user experience.
本申请实施例提供一种音频播放设备,包括:播放缓存区,播放缓存区包括第一缓存区和第二缓存区;The embodiment of the present application provides an audio playback device, comprising: a playback buffer area, the playback buffer area comprising a first buffer area and a second buffer area;
解码单元,被配置用于在第一时刻T1触发解码以得到第一数据,将第一数据按照第一存储规则存储至播放存储区;在第二时刻T2触发解码以得到第二数据,将第二数据按照第二存储规则存储至播放存储区;The decoding unit is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in a playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
播放单元,被配置用于在播放触发时刻Tt到来时从第一存储区的第一预设位置开始读取播放存储区并播放;A playback unit, configured to read and play the playback storage area from a first preset position in the first storage area when a playback triggering moment Tt arrives;
其中,T1等于或晚于音频播放设备接收到第一数据的时间Tr1,T2等于或晚于音频播放设备接收到第二数据的时间Tr2,T2等于或晚于Tt,第一数据在自Tt起第一次读取完第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt.
在一些实施例中,播放单元包括数模转换器DAC和扬声器,数模转换器被配置用于对播放存储区的数据进行数模转换;扬声器被配置用于将数模转换后的数据进行播放;In some embodiments, the playback unit includes a digital-to-analog converter DAC and a speaker, the digital-to-analog converter is configured to perform digital-to-analog conversion on the data in the playback storage area; the speaker is configured to play the data after the digital-to-analog conversion;
音频播放设备还包括:通信模块,通信模块包括无线收发器和通信缓存区,无线收发器被配置用于接收音源设备发送的数据包,通信缓存区被配置用于存放所述数据包中携带的待解码的数据,待解码的数据包括待解码的第一数据和/或待解码的第二数据。The audio playback device also includes: a communication module, the communication module includes a wireless transceiver and a communication buffer area, the wireless transceiver is configured to receive a data packet sent by the audio source device, and the communication buffer area is configured to store the data to be decoded carried in the data packet, and the data to be decoded includes first data to be decoded and/or second data to be decoded.
该音频播放设备中相关模块的设置及相关参数例如T1/T2/Tt等的设置可以参考前面相关实施例的描述,在此不再赘述。For the settings of the relevant modules and the relevant parameters such as T1/T2/Tt in the audio playback device, reference may be made to the description of the previous relevant embodiments, which will not be repeated here.
本申请实施例公开一种电子设备,包括至少一个处理器、至少一个无线收发器和至少一个存储器,其中存储器存储有计算机程序,该计算机程序由所述至少一个处理器执行,以使得电子设备执行上述各实施例描述的任意一项低延时播放方法。An embodiment of the present application discloses an electronic device, comprising at least one processor, at least one wireless transceiver and at least one memory, wherein the memory stores a computer program, and the computer program is executed by the at least one processor so that the electronic device executes any one of the low-latency playback methods described in the above embodiments.
本申请实施例公开一种存储介质,其存储有计算机程序,其中,该计算机程序被处理器执行时,使得音频播放设备实现如上述各实施例描述的任意一项低延时播放方法。An embodiment of the present application discloses a storage medium storing a computer program, wherein when the computer program is executed by a processor, an audio playback device implements any one of the low-latency playback methods described in the above embodiments.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一非易失性计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、ROM等。Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing related hardware through a computer program, and the program can be stored in a non-volatile computer-readable storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The storage medium can be a disk, an optical disk, a ROM, etc.
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性和/或易失性存储器。合适的非易失性存储器可包括ROM、可编程ROM(Programmable ROM,PROM)、可擦除PROM(Erasable PROM,EPROM)、电可擦除PROM(Electrically Erasable PROM,EEPROM)或闪存。易失性存储器可包括随机存取存储器(random access memory,RAM),它用作外部高速缓冲存储器。作为说明而非局限,RAM可为多种形式,诸如静态RAM(Static RAM,SRAM)、动态RAM(Dynamic Random Access Memory,DRAM)、同步DRAM(synchronous DRAM,SDRAM)、双倍数据率SDRAM(Double Data Rate SDRAM,DDR SDRAM)、增强型SDRAM(Enhanced Synchronous DRAM,ESDRAM)、同步链路DRAM(Synchlink DRAM,SLDRAM)、存储器总线直接RAM(Rambus DRAM,RDRAM)及直接存储器总线动态RAM(Direct Rambus DRAM,DRDRAM)。As used herein, any reference to memory, storage, database, or other medium may include nonvolatile and/or volatile memory. Suitable nonvolatile memory may include ROM, Programmable ROM (PROM), Erasable PROM (EPROM), Electrically Erasable PROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM), which is used as external cache memory. By way of illustration and not limitation, RAM can be in many forms, such as static RAM (SRAM), dynamic random access memory (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced synchronous DRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus DRAM (RDRAM) and direct Rambus dynamic RAM (DRDRAM).
应理解,说明书通篇中提到的“一个实施例”或“一实施例”意味着与实施例有关的特定特征、结构或特性包括在本申请的至少一个实施例中。因此,在整个说明书各处出现的“在一个实施例中”或“在一实施例中”未必一定指相同的实施例。此外,这些特定特征、结构或特性可以以任意适合的方式结合在一个或多个实施例中。本领域技术人员也应该知悉,说明书中所描述的实施例均属于可选实施例,所涉及 的动作和模块并不一定是本申请所必须的。需要说明的,本申请中的“多个”包括“两个或两个以上”。It should be understood that the "one embodiment" or "an embodiment" mentioned throughout the specification means that the specific features, structures or characteristics related to the embodiment are included in at least one embodiment of the present application. Therefore, the "in one embodiment" or "in an embodiment" appearing throughout the specification does not necessarily refer to the same embodiment. In addition, these specific features, structures or characteristics can be combined in one or more embodiments in any suitable manner. Those skilled in the art should also know that the embodiments described in the specification are all optional embodiments. The actions and modules are not necessarily required by this application. It should be noted that "multiple" in this application includes "two or more".
在本申请的各种实施例中,应理解,上述各过程的序号的大小并不意味着执行顺序的必然先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。In the various embodiments of the present application, it should be understood that the size of the serial numbers of the above-mentioned processes does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
上述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可位于一个地方,或者也可以分布到多个网络单元上。可根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
另外,在本申请各实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above-described embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
以上对本申请实施例公开的一种低延时播放方法、装置、电子设备和存储介质进行了详细介绍,本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想。同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。 The above is a detailed introduction to a low-latency playback method, device, electronic device, and storage medium disclosed in the embodiments of the present application. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method of the present application and its core idea. At the same time, for those of ordinary skill in the art, according to the ideas of the present application, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims (27)

  1. 一种低延时播放方法,应用于音频播放设备,所述音频播放设备包括播放存储区,所述播放存储区包括第一存储区和第二存储区,其中,所述方法包括:A low-latency playback method is applied to an audio playback device, wherein the audio playback device includes a playback storage area, and the playback storage area includes a first storage area and a second storage area, wherein the method includes:
    在播放触发时刻Tt到来时从所述第一存储区的第一预设位置开始读取所述播放存储区并播放;When the play triggering time Tt arrives, the play storage area is read from the first preset position of the first storage area and played;
    在第一时刻T1触发解码以得到第一数据,将所述第一数据按照第一存储规则存储至所述播放存储区;Trigger decoding at a first time T1 to obtain first data, and store the first data in the playback storage area according to a first storage rule;
    在第二时刻T2触发解码以得到第二数据,将所述第二数据按照第二存储规则存储至所述播放存储区;Trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
    其中,所述T1等于或晚于所述音频播放设备接收到所述第一数据的时间Tr1,所述T2等于或晚于所述音频播放设备接收到所述第二数据的时间Tr2,所述T2等于或晚于所述Tt,所述第一数据在自所述Tt起第一次读取完所述第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to be played before the second storage area is read for the first time starting from Tt.
  2. 根据权利要求1所述的方法,其中,所述音频播放设备还包括第三存储区,用于存放待解码的数据,所述待解码的数据包括待解码的第一数据和/或待解码的第二数据;所述方法还包括:依次接收音源设备发送的第一数据包和第二数据包,所述第一数据包包含待解码的所述第一数据,所述第二数据包包含待解码的所述第二数据;将待解码的所述第一数据和/或待解码的所述第二数据存储至所述第三存储区。According to the method of claim 1, the audio playback device further includes a third storage area for storing data to be decoded, wherein the data to be decoded includes first data to be decoded and/or second data to be decoded; the method further includes: sequentially receiving a first data packet and a second data packet sent by a sound source device, the first data packet including the first data to be decoded, and the second data packet including the second data to be decoded; and storing the first data to be decoded and/or the second data to be decoded in the third storage area.
  3. 根据权利要求1所述的方法,其中,所述将所述第一数据按照第一存储规则存储至所述播放存储区,包括:将所述第一数据存储在所述第一存储区;The method according to claim 1, wherein storing the first data in the playback storage area according to a first storage rule comprises: storing the first data in the first storage area;
    所述将所述第二数据按照第二存储规则存储至所述播放存储区,包括:将所述第二数据存储至所述第二存储区。The storing the second data in the playback storage area according to a second storage rule includes: storing the second data in the second storage area.
  4. 根据权利要求3所述的方法,其中,所述播放触发时刻Tt根据所述第一数据对应的时间戳Ts1与第一预设时间段确定;所述第一预设时间段足以解码获得第一数据并将所述第一数据存储至所述第一存储区,且所述第一预设时间段小于读取完所述第一存储区和所述第二存储区的总时长;所述T1早于或等于Ta,所述Ta到所述Tt的时间足以解码得到第一数据并存储至所述第一存储区;所述T2早于或等于Tb,所述Tb到读取完所述第一数据的时间足以解码得到所述第二数据并存储所述第二数据至所述第二存储区。The method according to claim 3, wherein the playback trigger moment Tt is determined according to the timestamp Ts1 corresponding to the first data and a first preset time period; the first preset time period is sufficient to decode and obtain the first data and store the first data in the first storage area, and the first preset time period is less than the total time length for reading the first storage area and the second storage area; T1 is earlier than or equal to Ta, and the time from Ta to Tt is sufficient to decode and obtain the first data and store it in the first storage area; T2 is earlier than or equal to Tb, and the time from Tb to the completion of reading the first data is sufficient to decode and obtain the second data and store the second data in the second storage area.
  5. 根据权利要求1所述的方法,其中,所述将所述第一数据按照第一存储规则存储至所述播放存储区,包括:将所述第一数据按播放顺序分为第一部分数据和第二部分数据,所述第一部分数据存储在所述第一存储区的第一区域,所述第二部分数据存储在所述第二存储区的第二区域,所述第一区域与所述第二区域相邻;所述将所述第二数据按照第二存储规则存储至所述播放存储区,包括,将所述第二数据按播放顺序分为第三部分数据和第四部分数据,将所述第三部分数据存储在所述第二存储区的除所述第二区域的区域;将所述第四部分数据存储在所述第一存储区的除所述第一区域的区域;或者,According to the method of claim 1, wherein storing the first data in the playback storage area according to the first storage rule comprises: dividing the first data into a first portion of data and a second portion of data according to a playback order, the first portion of data is stored in a first area of the first storage area, the second portion of data is stored in a second area of the second storage area, and the first area is adjacent to the second area; storing the second data in the playback storage area according to the second storage rule comprises: dividing the second data into a third portion of data and a fourth portion of data according to a playback order, storing the third portion of data in an area of the second storage area excluding the second area; storing the fourth portion of data in an area of the first storage area excluding the first area; or,
    所述将所述第二数据按照第二存储规则存储至所述播放存储区,包括,将所述第二数据分为第三部分数据和第四部分数据,将所述第三部分数据存储在所述第二存储区的除所述第二区域的区域;将所述第四部分数据存储在第四存储区的第三区域,所述第三区域和所述第二存储区相邻,所述第四存储区是所述播放存储区中与所述第二存储区相邻的存储区。Storing the second data in the playback storage area according to a second storage rule includes dividing the second data into a third portion of data and a fourth portion of data, storing the third portion of data in an area of the second storage area excluding the second area; storing the fourth portion of data in a third area of a fourth storage area, the third area being adjacent to the second storage area, and the fourth storage area being a storage area in the playback storage area adjacent to the second storage area.
  6. 根据权利要求5所述的方法,其中,所述T1早于或等于Tc,从所述Tc到读取至所述第一存储区用于存储所述第一数据的位置的时间足以解码得到所述第一数据且按照所述第一存储规则存储所述第一数据;所述T2早于或等于Td,从所述Td到读取完所述第一数据的时间足以解码得到所述第二数据并按照所述第二规则存储所述第二数据;所述Tt根据所述第一数据对应的时间戳Ts1与第二预设时间段确定;所述第二预设时间段大于或等于0。The method according to claim 5, wherein T1 is earlier than or equal to Tc, and the time from Tc to reading the location of the first storage area for storing the first data is sufficient to decode the first data and store the first data according to the first storage rule; T2 is earlier than or equal to Td, and the time from Td to reading the first data is sufficient to decode the second data and store the second data according to the second rule; Tt is determined according to the timestamp Ts1 corresponding to the first data and a second preset time period; the second preset time period is greater than or equal to 0.
  7. 根据权利要求5所述的方法,其中,所述第一数据被均分为所述第一部分数据和所述第二部分数据,所述第一部分数据存储在所述第一存储区的后半部分,所述第二部分数据存储在所述第二存储区的前半部分,所述第一部分数据和所述第二部分数据相邻;所述第二数据被均分为所述第三部分数据和 所述第四部分数据,所述第三部分数据存储在所述第二存储区的后半部分,所述第四部分数据存储在所述第一存储区的前半部分,或者所述第四部分数据存储在所述第四存储区的前半部分,所述第三部分数据与所述第四部分数据相邻。The method according to claim 5, wherein the first data is equally divided into the first portion of data and the second portion of data, the first portion of data is stored in the second half of the first storage area, the second portion of data is stored in the first half of the second storage area, and the first portion of data and the second portion of data are adjacent; the second data is equally divided into the third portion of data and The fourth part of data, the third part of data is stored in the second half of the second storage area, the fourth part of data is stored in the first half of the first storage area, or the fourth part of data is stored in the first half of the fourth storage area, and the third part of data is adjacent to the fourth part of data.
  8. 根据权利要求1所述的方法,其中,所述将所述第一数据按照第一存储规则存储至所述播放存储区,包括:将所述第一数据存储至所述第二存储区;所述将所述第二数据按照第二存储规则存储至所述播放存储区,包括,将所述第二数据存储至所述第一存储区;或,将所述第二数据存储至第四存储区,所述第四存储区是所述播放存储区中与所述第二存储区相邻的存储区。The method according to claim 1, wherein storing the first data in the playback storage area according to a first storage rule includes: storing the first data in the second storage area; storing the second data in the playback storage area according to a second storage rule includes: storing the second data in the first storage area; or storing the second data in a fourth storage area, wherein the fourth storage area is a storage area in the playback storage area adjacent to the second storage area.
  9. 根据权利要求8所述的方法,其中,所述T1早于或等于Te,从所述Te到读取完所述第一存储区的时间足以解码得到所述第一数据并将所述第一数据存储至所述第二存储区;所述T2小于或等于Tf,从所述Tf到读取完所述第一数据的时间足以解码得到所述第二数据并将所述第二数据存储至所述第一存储区或第四存储区;所述Tt根据第一数据对应的时间戳Ts1与第三预设时间段确定;所述第三预设时间段大于或等于0,且小于读取第一存储区的时长。The method according to claim 8, wherein T1 is earlier than or equal to Te, and the time from Te to the completion of reading the first storage area is sufficient to decode the first data and store the first data in the second storage area; T2 is less than or equal to Tf, and the time from Tf to the completion of reading the first data is sufficient to decode the second data and store the second data in the first storage area or the fourth storage area; Tt is determined according to the timestamp Ts1 corresponding to the first data and a third preset time period; the third preset time period is greater than or equal to 0 and less than the duration of reading the first storage area.
  10. 根据权利要求1-4任一项所述的方法,其中,所述播放触发时间Tt等于所述第一数据对应的时间戳Ts1与半帧数据的时长之和。The method according to any one of claims 1-4, wherein the playback trigger time Tt is equal to the sum of the timestamp Ts1 corresponding to the first data and the duration of the half-frame data.
  11. 根据权利要求1-9任一项所述的方法,其中,在第一时刻T1触发解码以得到第一数据,包括:在接收到所述第一数据包时触发解码以得到所述第一数据。The method according to any one of claims 1 to 9, wherein triggering decoding at a first moment T1 to obtain the first data comprises: triggering decoding to obtain the first data upon receiving the first data packet.
  12. 根据权利要求1-4任一项所述的方法,其中,所述在第二时刻T2触发解码以得到第二数据,包括:The method according to any one of claims 1 to 4, wherein triggering decoding at the second time T2 to obtain the second data comprises:
    在读取到所述第一存储区的中间位置时触发解码得到所述第二数据。When the middle position of the first storage area is read, decoding is triggered to obtain the second data.
  13. 根据权利要求1-2或5-9任一项所述的方法,其中,所述在第二时刻T2触发解码以得到第二数据,包括:The method according to any one of claims 1-2 or 5-9, wherein the triggering decoding at the second time T2 to obtain the second data comprises:
    在读取到所述第一存储区的结束位置时触发解码得到所述第二数据。When the end position of the first storage area is read, decoding is triggered to obtain the second data.
  14. 根据权利要求1-2或5-9任一项所述的方法,其中,所述Tt等于所述第一数据对应的时间戳Ts1。The method according to any one of claims 1-2 or 5-9, wherein the Tt is equal to the timestamp Ts1 corresponding to the first data.
  15. 根据权利要求1-2或5-9任一项所述的方法,其中,所述在第一时刻T1触发解码以得到第一数据,包括:在所述播放触发时刻Tt触发解码以得到所述第一数据。The method according to any one of claims 1-2 or 5-9, wherein triggering decoding at the first moment T1 to obtain the first data includes: triggering decoding at the playback triggering moment Tt to obtain the first data.
  16. 根据权利要求2所述的方法,其中,所述在第二时刻T2触发解码以得到第二数据,包括:The method according to claim 2, wherein triggering decoding at the second time T2 to obtain the second data comprises:
    在第二时刻T2生成第一中断请求,响应于所述第一中断请求获取数据进行解码得到所述第二数据;Generate a first interrupt request at a second time T2, and acquire data in response to the first interrupt request and decode to obtain the second data;
    所述方法还包括:在第三时刻T3生成第二中断请求,响应于所述第二中断获取数据进行解码得到第三数据,将所述第三数据按照第三存储规则存储至所述播放存储区;The method further includes: generating a second interrupt request at a third time T3, decoding data acquired in response to the second interrupt to obtain third data, and storing the third data in the playback storage area according to a third storage rule;
    所述第一中断请求到所述第二中断请求之间的时间间隔至少为一帧数据的时长。The time interval between the first interrupt request and the second interrupt request is at least the duration of a frame of data.
  17. 根据权利要求1所述的方法,其中,所述第一存储区为乒缓存ping buffer,所述第二存储区为乓缓存pang buffer;或者,所述第一存储区和所述第二存储区是环形缓存中的相邻两个缓存区。The method according to claim 1, wherein the first storage area is a ping buffer, and the second storage area is a pong buffer; or, the first storage area and the second storage area are two adjacent buffer areas in a ring buffer.
  18. 根据权利要求1所述的方法,其中,所述音频播放设备和所述音源设备通过LE Audio蓝牙技术进行通信。According to the method according to claim 1, the audio playback device and the audio source device communicate via LE Audio Bluetooth technology.
  19. 根据权利要求1所述的方法,其中,所述第一数据和所述第二数据均为一帧数据;所述第一存储区和所述第二存储区均为存储一帧数据的大小。The method according to claim 1, wherein the first data and the second data are both one frame of data; and the first storage area and the second storage area are both sized to store one frame of data.
  20. 根据权利要求1所述的方法,其中,所述T2小于或等于Td,从所述Td到读取完所述第一数据的时间足以解码得到第二数据并按照第二存储规则存储所述第二数据。The method according to claim 1, wherein T2 is less than or equal to Td, and the time from Td to the completion of reading the first data is sufficient to decode the second data and store the second data according to a second storage rule.
  21. 一种低延时的播放方法,其中,应用于播放设备,所述播放设备包括第一音频播放设备和第二音频播放设备,所述第一音频播放设备和所述第二音频播放设备分别具有如权利要求1所述的播放存储区,所述第一音频播放设备和所述第二音频播放设备分别执行如权利要求1所述的方法以实现同步播放,其中,所述第一音频播放设备的第一数据和所述第二音频播放设备的第一数据具有相同的时间戳 Ts1;所述第一音频播放设备的第二数据和所述第二音频播放设备的第二数据具有相同的时间戳Ts2;所述Tt根据所述Ts1确定。A low-latency playback method, wherein the method is applied to a playback device, wherein the playback device includes a first audio playback device and a second audio playback device, wherein the first audio playback device and the second audio playback device respectively have a playback storage area as claimed in claim 1, and the first audio playback device and the second audio playback device respectively execute the method as claimed in claim 1 to achieve synchronous playback, wherein the first data of the first audio playback device and the first data of the second audio playback device have the same timestamp Ts1; the second data of the first audio playback device and the second data of the second audio playback device have the same timestamp Ts2; the Tt is determined according to the Ts1.
  22. 一种低延时播放装置,其中,所述低延时播放装置包括:播放存储区,所述播放存储区包括第一存储区和第二存储区;A low-latency playback device, wherein the low-latency playback device comprises: a playback storage area, the playback storage area comprises a first storage area and a second storage area;
    播放模块,被配置用于在播放触发时刻Tt到来时从所述第一存储区的第一预设位置开始读取所述播放存储区并播放;A playing module, configured to read and play the playing storage area from a first preset position of the first storage area when a playing triggering moment Tt arrives;
    音频模块,被配置用于在第一时刻T1触发解码以得到第一数据,将所述第一数据按照第一存储规则存储至所述播放存储区;在第二时刻T2触发解码以得到第二数据,将所述第二数据按照第二存储规则存储至所述播放存储区;The audio module is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in the playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
    其中,所述T1等于或晚于接收到所述第一数据的时间Tr1,所述T2等于或晚于接收到所述第二数据的时间Tr2,所述T2等于或晚于所述Tt,所述第一数据在自所述Tt起第一次读取完所述第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the first data is received, T2 is equal to or later than the time Tr2 when the second data is received, T2 is equal to or later than Tt, and the first data starts to play before the second storage area is read for the first time since Tt.
  23. 根据权利要求22所述的装置,其中,所述装置还包括:通信模块,所述通信模块包括无线收发器和通信存储区,所述无线收发器被配置用于接收音源设备发送的数据包,所述通信存储区被配置用于存放所述数据包中携带的待解码的数据,所述待解码的数据包括待解码的所述第一数据和/或待解码的所述第二数据。The device according to claim 22, wherein the device further comprises: a communication module, the communication module comprising a wireless transceiver and a communication storage area, the wireless transceiver is configured to receive a data packet sent by a sound source device, and the communication storage area is configured to store data to be decoded carried in the data packet, and the data to be decoded includes the first data to be decoded and/or the second data to be decoded.
  24. 一种音频播放设备,其中,包括:播放缓存区,所述播放缓存区包括第一缓存区和第二缓存区;An audio playback device, comprising: a playback buffer area, the playback buffer area comprising a first buffer area and a second buffer area;
    解码单元,被配置用于在第一时刻T1触发解码以得到第一数据,将所述第一数据按照第一存储规则存储至所述播放存储区;在第二时刻T2触发解码以得到第二数据,将所述第二数据按照第二存储规则存储至所述播放存储区;A decoding unit is configured to trigger decoding at a first time T1 to obtain first data, and store the first data in the playback storage area according to a first storage rule; trigger decoding at a second time T2 to obtain second data, and store the second data in the playback storage area according to a second storage rule;
    播放单元,被配置用于在播放触发时刻Tt到来时从所述第一存储区的第一预设位置开始读取所述播放存储区并播放;A playback unit, configured to read and play the playback storage area from a first preset position in the first storage area when a playback triggering moment Tt arrives;
    其中,所述T1等于或晚于所述音频播放设备接收到所述第一数据的时间Tr1,所述T2等于或晚于所述音频播放设备接收到所述第二数据的时间Tr2,所述T2等于或晚于所述Tt,所述第一数据在自所述Tt起第一次读取完所述第二存储区前开始播放。Among them, T1 is equal to or later than the time Tr1 when the audio playback device receives the first data, T2 is equal to or later than the time Tr2 when the audio playback device receives the second data, T2 is equal to or later than Tt, and the first data starts to be played before the second storage area is read for the first time starting from Tt.
  25. 根据权利要求24所述的音频播放设备,其中,The audio playback device according to claim 24, wherein:
    所述播放单元包括数模转换器和扬声器,所述数模转换器被配置用于对所述播放存储区的数据进行数模转换;所述扬声器被配置用于将所述数模转换后的数据进行播放;The playback unit includes a digital-to-analog converter and a speaker, wherein the digital-to-analog converter is configured to perform digital-to-analog conversion on the data in the playback storage area; and the speaker is configured to play the data after the digital-to-analog conversion;
    所述音频播放设备还包括:通信模块,所述通信模块包括无线收发器和通信缓存区,所述无线收发器被配置用于接收音源设备发送的数据包,所述通信缓存区被配置用于存放所述数据包中携带的待解码的数据,所述待解码的数据包括待解码的所述第一数据和/或待解码的所述第二数据。The audio playback device also includes: a communication module, the communication module includes a wireless transceiver and a communication buffer area, the wireless transceiver is configured to receive a data packet sent by a sound source device, and the communication buffer area is configured to store data to be decoded carried in the data packet, and the data to be decoded includes the first data to be decoded and/or the second data to be decoded.
  26. 一种电子设备,其中,包括:至少一个处理器、至少一个无线收发器和至少一个存储器,其中所述存储器存储有计算机程序,所述计算机程序由所述存储器执行,使得所述电子设备实现如权利要求1-21中任意一项所述的方法。An electronic device, comprising: at least one processor, at least one wireless transceiver and at least one memory, wherein the memory stores a computer program, and the computer program is executed by the memory, so that the electronic device implements the method as described in any one of claims 1-21.
  27. 一种存储介质,其中,存储有计算机程序,所述计算机程序被处理器执行时使得音频播放设备实现如权利要求1-21中任意一项所述的方法。 A storage medium storing a computer program, wherein the computer program, when executed by a processor, enables an audio playback device to implement the method as described in any one of claims 1 to 21.
PCT/CN2023/120692 2022-11-18 2023-09-22 Low-delay playing method and apparatus, and electronic device and storage medium WO2024103961A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202211449488.7A CN118057841A (en) 2022-11-18 2022-11-18 Low-delay playing method and device, electronic equipment and storage medium
CN202211449488.7 2022-11-18

Publications (1)

Publication Number Publication Date
WO2024103961A1 true WO2024103961A1 (en) 2024-05-23

Family

ID=91068659

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/120692 WO2024103961A1 (en) 2022-11-18 2023-09-22 Low-delay playing method and apparatus, and electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN118057841A (en)
WO (1) WO2024103961A1 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170195769A1 (en) * 2016-01-05 2017-07-06 Johnson Safety, Inc. Wireless Speaker System
CN109274405A (en) * 2018-08-14 2019-01-25 Oppo广东移动通信有限公司 Data transmission method, device, electronic equipment and computer-readable medium
CN113242546A (en) * 2021-06-25 2021-08-10 南京中感微电子有限公司 Audio forwarding method, device and storage medium
US20220013131A1 (en) * 2020-07-10 2022-01-13 Sagemcom Broadband Sas Method, a system, and a program for playing back audio/video signals with automatic adjustment of latency
CN115038002A (en) * 2022-05-26 2022-09-09 恒玄科技(上海)股份有限公司 Bluetooth audio playing method, storage medium and true wireless earphone

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20170195769A1 (en) * 2016-01-05 2017-07-06 Johnson Safety, Inc. Wireless Speaker System
CN109274405A (en) * 2018-08-14 2019-01-25 Oppo广东移动通信有限公司 Data transmission method, device, electronic equipment and computer-readable medium
US20220013131A1 (en) * 2020-07-10 2022-01-13 Sagemcom Broadband Sas Method, a system, and a program for playing back audio/video signals with automatic adjustment of latency
CN113242546A (en) * 2021-06-25 2021-08-10 南京中感微电子有限公司 Audio forwarding method, device and storage medium
CN115038002A (en) * 2022-05-26 2022-09-09 恒玄科技(上海)股份有限公司 Bluetooth audio playing method, storage medium and true wireless earphone

Also Published As

Publication number Publication date
CN118057841A (en) 2024-05-21

Similar Documents

Publication Publication Date Title
US10750459B2 (en) Synchronization method for synchronizing clocks of a bluetooth device
US8233648B2 (en) Ad-hoc adaptive wireless mobile sound system
CN106878920B (en) Data forwarding method, its device, bluetooth equipment and audio frequency transmission method
US20220263883A1 (en) Adaptive audio processing method, device, computer program, and recording medium thereof in wireless communication system
CN107431860A (en) Audio system based on location-based service
CN101278544A (en) Method of combining audio signals in a wireless communication device
US20220321368A1 (en) Method, device, computer program, and recording medium for audio processing in wireless communication system
WO2021175297A1 (en) Distributed data transmission method, apparatus and system
WO2024087881A1 (en) Clock synchronization method and apparatus, system, device, and storage medium
WO2016108114A1 (en) Time to play
CN107431859A (en) The radio broadcasting of the voice data of encapsulation with control data
CN108271095A (en) A kind of major and minor Bluetooth audio equipment and its synchronous playing system and method
CN106878384A (en) Data forwarding method, its device, bluetooth equipment and audio frequency transmission method
US20240168703A1 (en) Method, device, and computer program for audio routing in wireless communication system, and recording medium therefor
WO2024103961A1 (en) Low-delay playing method and apparatus, and electronic device and storage medium
JP2020120366A (en) Audio device control method and control circuit
CN114175689B (en) Method, apparatus and computer program for broadcast discovery service in wireless communication system and recording medium thereof
US11989485B2 (en) Method, device and computer program for controlling audio data in wireless communication system, and recording medium therefor
KR20220023978A (en) Method, apparatus, computer program and recording medium for controlling and managing the state of peripheral devices in a wireless communication system
CN110381492A (en) The implementation method of bluetooth headset ears call
CN113613221B (en) TWS master device, TWS slave device, audio device and system
CN113613124B (en) TWS master and slave equipment and audio equipment and system
TWI715175B (en) Bluetooth device, method of operating bluetooth device, and non-transitory computer readable medium
US20230080122A1 (en) Method, device and computer program for cloud-authenticated pairing in wireless communication system, and recording medium therefor
WO2024001362A9 (en) Display device, bluetooth device, and data processing method