WO2022218165A1 - Method and apparatus for receiving audio data packet, method and apparatus for sending audio data packet, and electronic device - Google Patents

Method and apparatus for receiving audio data packet, method and apparatus for sending audio data packet, and electronic device Download PDF

Info

Publication number
WO2022218165A1
WO2022218165A1 PCT/CN2022/084598 CN2022084598W WO2022218165A1 WO 2022218165 A1 WO2022218165 A1 WO 2022218165A1 CN 2022084598 W CN2022084598 W CN 2022084598W WO 2022218165 A1 WO2022218165 A1 WO 2022218165A1
Authority
WO
WIPO (PCT)
Prior art keywords
audio
data packet
audio data
buffer area
stored
Prior art date
Application number
PCT/CN2022/084598
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 WO2022218165A1 publication Critical patent/WO2022218165A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • H04B5/70Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes
    • H04B5/72Near-field transmission systems, e.g. inductive or capacitive transmission systems specially adapted for specific purposes for local intradevice communication
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04BTRANSMISSION
    • H04B5/00Near-field transmission systems, e.g. inductive or capacitive transmission systems
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/10Flow control between communication endpoints
    • H04W28/14Flow control between communication endpoints using intermediate storage
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/80Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication

Definitions

  • the present application relates to the field of data transmission, and in particular, to a method for receiving audio data packets, a method, apparatus, electronic device and storage medium for transmitting audio data packets.
  • the audio data in the device can be transmitted to the Bluetooth device for playback.
  • the transmission of the transmitted audio data packet may fail, or the Bluetooth device cannot.
  • the audio data packet is received in time, which reduces the transmission efficiency of the audio data packet and causes the audio playback on the Bluetooth device side to freeze.
  • the embodiments of the present application provide a method for receiving audio data packets, a method, apparatus, electronic device and storage medium for sending audio data packets.
  • the embodiment of the present application provides a method for receiving audio data packets in an audio receiving end, including:
  • the second audio data packet in the second buffer area is stored in the first buffer area based on the playing sequence of the audio data packets.
  • Embodiments of the present application also provide a method for sending audio data packets in an audio source, including:
  • the audio source data is encoded to obtain the first audio data packet, and the first audio data packet is stored in the third buffer area;
  • the first audio data packet is extracted from the third buffer area and sent to the audio receiving end.
  • the embodiment of the present application also provides an audio receiving device, including:
  • a first receiving unit configured to receive audio source data from an audio source through transparent transmission
  • a second receiving unit configured to receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area
  • a storage unit configured to encode the audio source data to obtain a second audio data packet, and store the second audio data packet in a second buffer area;
  • the playing unit is configured to store the second audio data packets in the second buffer area into the first buffer area based on the playing sequence of the audio data packets if a predetermined condition is satisfied.
  • the embodiment of the present application also provides another audio transmission device, including:
  • an encoding unit configured to encode the audio source data to obtain a first audio data packet, and store the first audio data packet in a third buffer area;
  • a first transmission unit configured to transparently transmit the audio source data to the audio receiving end
  • the second transmission unit is configured to extract the first audio data packet from the third buffer area and send it to the audio receiving end.
  • Embodiments of the present application also provide an electronic device, including: a processor and a memory configured to store a computer program that can be executed on the processor,
  • the processor is configured to execute the steps of any of the above methods when running the computer program.
  • Embodiments of the present application further provide a storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of any of the foregoing methods.
  • the audio source data is received from the audio source through transparent transmission; the first audio data packet is received from the audio source, and the first audio data packet is stored in the first buffer area; The source data is encoded to obtain the second audio data packet, and the second audio data packet is stored in the second buffer area; if the predetermined condition is met, based on the playback order of the audio data packets, the second audio data packet in the second buffer area is stored.
  • the audio data packet is stored in the first buffer area, and the audio source data and the audio data after the encoding process are simultaneously transmitted to the audio receiving end, so that the audio receiving end can pass the received audio when the playback is stuck. Extract the corresponding data from the source data and continue to play, thus avoiding the problem of audio playback being stuck.
  • FIG. 1 is a schematic flowchart of an implementation of an audio transmission method provided by an embodiment of the present application
  • FIG. 2 is a schematic diagram of an audio playback process of a second Bluetooth device provided by an embodiment of the present application
  • FIG. 3 is a schematic flowchart of determining a first identifier according to an embodiment of the present application
  • FIG. 4 is a schematic diagram of an implementation flowchart of an audio transmission method provided by an embodiment of the present application.
  • FIG. 5 is a schematic diagram of a sending process of audio data provided by an embodiment of the present application.
  • FIG. 6 is a schematic diagram of sending a first audio data packet according to an embodiment of the present application.
  • FIG. 7 is a schematic structural diagram of an audio transmission device provided by an embodiment of the present application.
  • FIG. 8 is a schematic structural diagram of an audio transmission apparatus provided by another embodiment of the present application.
  • FIG. 9 is a schematic structural diagram of a hardware composition of an electronic device according to an embodiment of the present application.
  • FIG. 1 is a schematic flowchart of a method for receiving an audio data packet in an audio receiving end according to an embodiment of the present application. As shown in Figure 1, the method includes:
  • S101 Receive audio source data from an audio source in a transparent transmission manner.
  • the received audio source data is transmitted from the audio source to the audio receiver through transparent transmission.
  • the audio source transmits the audio source data, it does not perform encoding and other processing on the audio source data, and directly transmits the audio source data to the audio receiver. so that the audio sink can obtain the audio source data.
  • the audio source and the audio receiving end may be connected by Bluetooth.
  • the audio source may be a mobile terminal, and the audio receiving end may be a Bluetooth headset.
  • S102 Receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area; the first audio data packet is obtained by encoding the audio source data by the audio source.
  • the audio receiving end may also receive the first audio data packet from the audio source, and store the first audio data packet in the first buffer area on the audio receiving end side.
  • the first audio data packet is the first audio data packet obtained by encoding the audio source data by the audio source.
  • the first audio data packet is transmitted from the audio source to the audio receiving end at a certain time, so the audio source data can be transmitted at a time other than the transmission of the first audio data packet, so that the first audio data packet will not be affected. The transmission efficiency of an audio data packet.
  • S103 Encode the audio source data to obtain a second audio data packet, and store the second audio data packet in a second buffer area.
  • the audio receiving end encodes the audio source data to obtain the second audio data packet, and stores the second audio data packet in the second buffer area, wherein the second buffer area is located in the audio receiving end.
  • the terminal side is responsible for storing the second audio data packet so that when the audio played at the audio receiving end is stuck, the corresponding second audio data packet can be extracted from the second audio buffer area to keep the audio playing.
  • the first audio data packet and the second audio data packet are both valid audio data, and the corresponding audio content can be played.
  • the transmission between the audio sink and the audio source is in good condition
  • the The corresponding first audio data packet is extracted from the buffer area for audio playback.
  • the second audio data packet in the second buffer area can be stored in the first buffer area for playback, wherein the predetermined condition can represent The playback of the first audio data packet is blocked or the audio playback is stuck.
  • the audio source encodes the audio source data to generate an audio data packet
  • the audio source data is encoded in sequence.
  • the first audio data packet received by the audio receiver and the second audio data generated by the encoding are both It is a part of the data in the audio source data.
  • a corresponding first audio data packet serial number may be attached to the first audio data packet, and the first audio data packet serial number may indicate the playback of the audio sequence, so that the corresponding first audio data packet can be extracted and played.
  • the sequence number of the first audio data packet corresponding to the currently playing audio is 3, then after the corresponding audio is played, the first audio data packet is extracted from the first buffer area.
  • the audio data packet whose sequence number is 4 of the first audio data packet is used for subsequent audio playback. As shown in FIG.
  • FIG. 2 shows a schematic diagram of an audio playing process of an audio receiving end.
  • the Bluetooth module of the audio receiving end receives the first audio data packet and audio source data, stores the first audio data packet received by the Bluetooth module in the first buffer area, and encodes the second audio based on the audio source data.
  • the data packets are stored in the second buffer area, and the audio playback unit extracts the corresponding first audio data packets from the first buffer area to realize audio playback.
  • the audio playback unit extracts the corresponding second audio data packets from the second buffer area and stores them in the first buffer area, which can also realize audio playback.
  • the audio source data is received from the audio source through transparent transmission; the first audio data packet is received from the audio source, and the first audio data packet is stored in the first buffer area; Data encoding obtains a second audio data packet, and the second audio data packet is stored in the second buffer area; if a predetermined condition is met, based on the playback order of the audio data packets, the second audio data packet in the second buffer area is stored.
  • the data packet is stored in the first buffer area, and the transmission audio data packet and audio source data can be transmitted to the audio receiving end, so that the audio receiving end encounters a jam during the playback of the audio data packet. Maintain the normal playback of audio according to the received audio source data to avoid the problem of audio playback being stuck or interrupted.
  • the second audio data packet in the second buffer area is stored in the first buffer area based on the playback order of the audio data packets, including:
  • the second audio data packets in the second buffer area are stored in the first buffer area.
  • the number of the first audio data packets stored in the first buffer area can be determined by the number of the first audio data packets stored in the first buffer area whether the audio playback will freeze. Under normal circumstances, the number of the first audio data packets stored in the first buffer area should be in a stable state. When the connection between the audio source and the audio receiver is unstable, and the number of the first audio data packets stored in the first buffer area is less than the set threshold, it can be determined that the audio receiver has not received audio.
  • the new first audio data packet from the source and in this case, in order to maintain the normal playback of the audio, the first audio data packet originally stored in the first buffer area is extracted and played, that is, the audio receiving end
  • the received first audio data packet is about to be exhausted, and the audio playback is about to freeze, then store the second audio data packet in the second buffer area into the first buffer area, and pass through the second buffer area.
  • the first audio data packet that cannot be successfully transmitted will be replaced, so that audio playback can be maintained according to the second audio data packet.
  • the second audio data packets in the second buffer area are stored in the A buffer area, which can predict the situation of audio playback by the data volume of the first audio data packet stored in the buffer area, so that the audio playback can be maintained through the second audio data packet in time when the audio playback freezes, so as to avoid the occurrence of Audio playback is stuttered or interrupted.
  • the method further includes:
  • the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
  • the first audio data packet stored in the first buffer area is greater than or equal to the set threshold, it means that the connection between the audio source and the audio receiving end is restored or the connection state is good, which can ensure the normal operation of the first audio packet. In this case, it is not necessary to perform audio playback through the second audio data packet, so that the extraction of the corresponding second audio data packet from the second buffer area and storing the corresponding second audio data packet in the first buffer area is stopped.
  • the storage of the second audio data packet in the second buffer area into the The first buffer area can determine the transmission status of the first audio data packet according to the number of the first audio data packets stored in the first buffer area.
  • the original playback can be maintained. mode, so as to ensure that the audio can be played normally and avoid the phenomenon that the audio playback is stuck or interrupted.
  • the encoding of the audio source data to obtain the second audio data packet includes:
  • the audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet.
  • the audio receiving end when it encodes the audio source data, it uses the same encoding parameters as the encoding method of the audio source to perform corresponding operations such as encoding and compressing the audio source data, so that the encoding of the generated second audio data packet is
  • the parameter is the same as the encoding parameter of the first audio data packet, wherein the encoding parameter may include the frame length of one audio data packet.
  • the audio data packet sequence number corresponding to each second audio data packet may also be determined when the second audio data packet is generated.
  • the first audio data packet with the same audio data packet serial number is the same as the second audio data packet, for example, the audio data
  • the audio content corresponding to the first audio data packet with the packet sequence number of 1 is the same as the audio content corresponding to the second audio data packet, so that when audio playback is performed based on the second audio data packet, the extracted second audio data packet is just for the subsequent needs.
  • the audio content to be played ensures the continuity of audio playback.
  • the audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet, which enables the generated first audio data packet and the second audio data to be generated.
  • the packets are the same, so that when the audio is played based on the playback of the second audio data packet, the continuity of the audio playback is ensured, and the disorder of the audio playback is avoided.
  • the method when the second audio data packet is stored in the second buffer area, the method further includes:
  • a first identifier is added to the second audio data packet, where the first identifier is used to mark whether the audio receiving end has played the audio corresponding to the second audio data packet.
  • a first identification can be added to the second audio data packet, and the first identification is used to mark whether the audio receiving end is The audio corresponding to the second audio data packet has been played.
  • the first identifier corresponding to the second audio data packet can be changed according to the currently playing audio data packet.
  • the first mark of the second audio data packet of the audio data packet serial number is determined to be in the played state.
  • the first flag is indicated by flag
  • the terminal has played the second audio data packet.
  • the flag value corresponding to the second audio data packet is shown in FIG. 3 , which shows a schematic flowchart of determining the first identifier.
  • the audio corresponding to the second audio data packet of 8 has been played by the audio playback terminal, so that the playback progress of the current audio can be determined according to the first identifier of the second audio data packet.
  • the storing of the second audio data packet in the second buffer area into the first buffer area includes:
  • the second audio data packet in the second buffer area is stored in the first buffer area.
  • a first identification is added to the second audio data packet, and the first identification is used to mark the audio receiving end Whether the audio corresponding to the second audio data packet has been played; based on the corresponding first identification and the current playback order, the second audio data packet in the second buffer area is stored in the first buffer area,
  • the playback progress of the current audio can be determined by the first identification, which is conducive to accurately extracting the audio data packets corresponding to the subsequent content of the current audio, and can accurately play the corresponding audio content while avoiding the audio playback jam, keeping the audio Continuity of playback.
  • storing the second audio data packet in the second buffer area into the first buffer area includes:
  • the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
  • the corresponding second audio data packet is extracted from the second buffer area, it is not obtained continuously, but every first cycle, the corresponding second audio data packet is extracted from the second buffer area, wherein, The first period is determined based on the audio playback speed of the audio receiving end.
  • the first audio data packet that the audio receiving end can receive periodically indicates that the audio source can send the first audio data packet normally, thus ensuring that The audio playback at the audio receiving end is smooth. Therefore, extracting the second audio data packet from the second buffer area based on the first cycle of receiving the first audio data packet can maintain the audio playback speed and ensure smooth audio playback.
  • a first cycle is determined based on the audio playback speed of the audio receiving end; and every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first cycle
  • the buffer area can maintain the audio playback speed by controlling the extraction time of the audio data packet, so that the effect of playing audio based on the second audio data packet is similar to or the same as the effect of playing audio based on the first audio data packet, thereby ensuring smooth audio playback.
  • the method further includes:
  • the second audio data packet in the second buffer area is stored in the first buffer area for playback.
  • the first audio data packet is realized by the Bluetooth connection between the audio source and the audio receiving end.
  • the Bluetooth connection between the audio source and the audio receiving end is disconnected, for example, the audio receiving end and the audio receiving end are disconnected.
  • the distance between the sources is outside the effective Bluetooth communication range, so the effective transmission of the first audio data packet cannot be achieved, resulting in the inability to realize audio playback according to the first audio data packet before the audio source and the audio receiving end are reconnected, and In the process of maintaining the Bluetooth connection between the audio source and the audio receiving end, the transmission of all audio source data can be realized, and the transmission of the audio source data does not take too long.
  • the second audio data package obtained by encoding the audio source data is used for audio playback, and the second audio data package is stored in the audio receiving device to realize offline local playback.
  • the second audio data packet in the second buffer area is stored in the first buffer area for playback, which can be played when the Bluetooth connection is disconnected.
  • offline local playback is implemented based on the audio data packets of the transmitted audio source data, so that the offline playback capability of the audio receiving end can be implemented.
  • the method further includes:
  • the corresponding audio is played.
  • the second audio data packet extracted from the second buffer area is stored in the first buffer area, and the first buffer area can play the corresponding audio according to the stored second audio data packet.
  • Both the audio data packet and the second audio data packet are valid audio data and can play the corresponding audio content
  • the second audio data packet in the first buffer area is the first audio data packet in the first buffer area that is about to be consumed. Therefore, when the corresponding audio is played according to the second audio data packet, the playback content corresponding to the first audio data packet can be followed, thereby ensuring smooth playback of the audio.
  • the transparently transmitted audio data can be used to maintain the audio playback when the transmission condition is not good, so as to avoid audio Playback freezes.
  • the embodiment of the present application also provides a method for sending audio data packets in an audio source, as shown in FIG. 4 , the method includes:
  • S401 Encode audio source data to obtain a first audio data packet, and store the first audio data packet in a third buffer area.
  • the audio source encodes the audio source data to generate the first audio data packet, and stores the generated first audio data packet into the third buffer area.
  • a corresponding audio data packet serial number can also be added to the first audio data packet when the first audio data packet is generated, and different first audio data packets can be played in the playback order through the audio data packet serial number. Sorting, so that the order in which the first audio data packets are sent to the audio receiving end can be determined.
  • S402 Transparently transmit the audio source data to the audio receiving end.
  • the audio source also transmits audio source data to the audio sink through transparent transmission.
  • the audio source data does not need to undergo data processing such as encoding, and the audio source data is directly transmitted to the audio receiving end.
  • S403 Extract the first audio data packet from the third buffer area and send it to the audio receiving end.
  • the first audio data packet is extracted from the third buffer area and sent to the receiving end.
  • the third buffer area on the audio source side can be used to encode the first audio data packet generated later.
  • the audio data packet is buffered first, and after the first audio data packet that needs to be retransmitted is successfully transmitted, the first audio data packet stored in the third buffer area can be transmitted immediately, so as to ensure that the connection is unstable or the transmission condition is insufficient.
  • the complete transmission of audio data packets can be achieved under optimal conditions.
  • Figure 5 shows a schematic diagram of the sending process of the first audio data packet and the audio source data.
  • the audio source will encode the audio source data to obtain the first audio data packet, and judge the previous first audio data. Whether the transmission of the packet is successful and whether there is no audio data packet in the buffer area, when the last first audio data packet is sent successfully, it means that the first audio data packet can be sent directly. If successful, the first audio data packet is stored in the buffer area, and when the previous first audio data packet is successfully sent, the first audio data packet in the buffer area is sent out.
  • the audio source data is encoded to obtain the first audio data packet, and the first audio data packet is stored in the third buffer area; the audio source data is transparently transmitted to the audio receiving end; The third buffer area extracts the first audio data packet and sends it to the audio receiving end, so that the audio source data and the corresponding audio data packet can be sent to the audio playing end, so that the audio receiving end can receive the audio in time.
  • the audio source data is used for subsequent audio playback to avoid abnormal disconnection between Bluetooth devices or the phenomenon that audio playback is stuck due to infinite interference.
  • the extracting the first audio data packet from the third buffer area and sending it to the audio receiving end includes:
  • the first audio data packet is extracted from the third buffer area and sent to the audio receiving end.
  • FIG. 6 shows a schematic diagram of sending a first audio data packet.
  • the sending time interval between two different first audio data packets is a first period.
  • the transparent transmission of the audio source data to the audio receiving end includes:
  • the audio source data is transparently transmitted to the audio receiving end in the transmission gap of the first audio data packet.
  • the audio source data is transparently transmitted to the audio receiving end during the transmission gap of the first audio data packet. Since the first audio data packet is sent every first cycle, the first audio data will not be processed in the first cycle. In the transmission of the packet, the transparent transmission of the audio source data at this time will not affect the transmission performance of the first audio data packet, so that the transmission of the audio source data can be achieved while ensuring the transmission efficiency of the first audio data packet.
  • the first cycle is determined based on the audio playback speed of the audio receiving end; and, every first cycle, the first audio data packet is extracted from the third buffer area and sent to the
  • the audio receiving end transparently transmits the audio source data to the audio receiving end in the transmission gap of the first audio data packet, so that the transmission of the audio data packet can be carried out without affecting the transmission of the audio data packet, and the audio data can be transmitted. transmission efficiency.
  • the embodiment of the present application further provides an audio receiving apparatus, as shown in FIG. 7 , the apparatus includes:
  • the first receiving unit 701 is configured to receive audio source data from the audio source through transparent transmission
  • the second receiving unit 702 is configured to receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area; the first audio data packet is stored by the audio source to the The audio source data is encoded and obtained;
  • Storage unit 703 configured to encode the audio source data to obtain a second audio data packet, and store the second audio data packet into a second buffer area;
  • the playback unit 704 is configured to extract the corresponding first audio data packets from the first buffer area and play them according to the playback sequence corresponding to the audio data packets, or, under predetermined conditions, place the second buffer area in the second buffer area.
  • the second audio data packet is stored in the first buffer area and played.
  • the playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area under a predetermined condition and plays it, and is further configured to:
  • the second audio data packets in the second buffer area are stored in the first buffer area and played.
  • the playing unit 704 is further configured to:
  • the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
  • the storage unit 703 encodes the audio source data to obtain a second audio data packet, and is further configured to:
  • the audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet.
  • the storage unit 703, which stores the second audio data packet in the second buffer area is further configured to:
  • a first identification is added for the second audio data packet, and the first identification is used to mark whether the audio receiver has played the audio corresponding to the second audio packet;
  • the playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area, and is further configured to:
  • the second audio data packet in the second buffer area is stored in the first buffer area.
  • the playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area, and is further configured to:
  • the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
  • the playback unit 704 is further configured to:
  • the second audio data packet in the second buffer area is stored in the first buffer area for playback.
  • the playback unit 704 is further configured to:
  • the corresponding audio is played.
  • the first receiving unit 701, the second receiving unit 702, the storage unit 703, and the playing unit 704 may be implemented by a processor in an audio receiving device.
  • the processor needs to run the program stored in the memory to realize the functions of the above program modules.
  • the audio receiving apparatus provided in the above embodiment of FIG. 7 performs audio transmission
  • only the division of the above program modules is used as an example for illustration.
  • the above processing may be allocated to different program modules as required. Completion means dividing the internal structure of the device into different program modules to complete all or part of the processing described above.
  • the audio receiving apparatus provided in the above embodiment and the method embodiment for receiving an audio data packet in an audio receiving end belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
  • the embodiment of the present application also provides another audio transmission device, as shown in FIG. 8 , the device includes:
  • the encoding unit 801 is configured to encode the audio source data to obtain the first audio data packet, and store the first audio data packet into the third buffer area;
  • a first transmission unit 802 configured to transparently transmit the audio source data to the audio receiving end
  • the second transmission unit 803 is configured to extract the first audio data packet from the third buffer area and send it to the audio receiving end.
  • the second transmission unit 803 extracts the first audio data packet from the third buffer area and sends it to the audio receiving end, and is further configured to:
  • the first transmission unit 802 transparently transmits the audio source data to the audio receiving end, and is further configured to:
  • the audio source data is transparently transmitted to the audio receiving end in the transmission gap of the first audio data packet.
  • the encoding unit 801, the first transmission unit 802, and the second transmission unit 803 may be implemented by a processor in the audio transmission apparatus.
  • the processor needs to run the program stored in the memory to realize the functions of the above program modules.
  • the audio transmission device provided in the above-mentioned embodiment of FIG. 8 performs audio transmission
  • only the division of the above-mentioned program modules is used for illustration.
  • the above-mentioned processing may be allocated to different program modules as required. Completion means dividing the internal structure of the device into different program modules to complete all or part of the processing described above.
  • the audio sending device provided in the above embodiment and the method embodiment for sending audio data packets in an audio source belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
  • FIG. 9 is a schematic diagram of the hardware composition of the electronic device according to the embodiment of the present application, as shown in FIG. 9 .
  • electronic equipment including:
  • Communication interface 1 which can exchange information with other devices such as network devices;
  • the processor 2 is connected to the communication interface 1 to realize information interaction with other devices, and is configured to execute the audio transmission method provided by one or more of the above technical solutions when running a computer program.
  • the computer program is instead stored on the memory 3 .
  • bus system 4 is configured to enable connection communication between these components.
  • bus system 4 also includes a power bus, a control bus and a status signal bus.
  • the various buses are labeled as bus system 4 in FIG. 9 .
  • the memory 3 in the embodiment of the present application is configured to store various types of data to support the operation of the electronic device.
  • Examples of such data include: any computer program configured to operate on an electronic device.
  • the memory may be either volatile memory or non-volatile memory, and may include both volatile and non-volatile memory.
  • the non-volatile memory can be a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), an erasable programmable read-only memory (EPROM, Erasable Programmable Read-only memory) Only Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM, Electrically Erasable Programmable Read-Only Memory), Magnetic Random Access Memory (FRAM, ferromagnetic random access memory), Flash Memory (Flash Memory), Magnetic Surface Memory , CD-ROM, or CD-ROM (Compact Disc Read-Only Memory); magnetic surface memory can be disk memory or tape memory.
  • RAM Random Access Memory
  • SRAM Static Random Access Memory
  • SSRAM Synchronous Static Random Access Memory
  • DRAM Dynamic Random Access Memory
  • SDRAM Synchronous Dynamic Random Access Memory
  • DDRSDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • ESDRAM Double Data Rate Synchronous Dynamic Random Access Memory
  • ESDRAM Enhanced Type Synchronous Dynamic Random Access Memory
  • SLDRAM Synchronous Link Dynamic Random Access Memory
  • DRRAM Direct Rambus Random Access Memory
  • DRRAM Direct Rambus Random Access Memory
  • a processor may be an integrated circuit chip with signal processing capabilities.
  • each step of the above-mentioned method can be completed by a hardware integrated logic circuit in a processor or an instruction in the form of software.
  • the above-mentioned processors may be general-purpose processors, DSPs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like.
  • the processor may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of this application.
  • a general purpose processor may be a microprocessor or any conventional processor or the like.
  • the steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor.
  • the software module may be located in a storage medium, the storage medium is located in a memory, and the processor reads the program in the memory, and completes the steps of the foregoing method in combination with its hardware.
  • an embodiment of the present application further provides a storage medium, that is, a computer storage medium, specifically a computer-readable storage medium, for example, including a memory for storing a computer program, and the above-mentioned computer program can be executed by a processor to complete the steps described in the preceding method.
  • the computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM.
  • the disclosed apparatus, electronic device and method may be implemented in other manners.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division. In actual implementation, there may be other division methods.
  • multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented.
  • the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.
  • the unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration
  • the unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.
  • the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute It includes the steps of the above method embodiments; and the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other media that can store program codes.
  • the above-mentioned integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium.
  • the computer software products are stored in a storage medium and include several instructions for An electronic device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present application.
  • the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other mediums that can store program codes.

Landscapes

  • Engineering & Computer Science (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • Acoustics & Sound (AREA)
  • Reverberation, Karaoke And Other Acoustics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Disclosed in the embodiments of the present application are a method and apparatus for receiving an audio data packet, a method and apparatus for sending an audio data packet, and an electronic device and a storage medium. The method for receiving an audio data packet comprises: receiving audio source data from an audio source by means of transparent transmission; receiving a first audio data packet from the audio source, and storing the first audio data packet in a first cache area; encoding the audio source data to obtain a second audio data packet, and storing the second audio data packet in a second cache area; and if a predetermined condition is satisfied, storing the second audio data packet of the second cache area in the first cache area on the basis of a playing order of the audio data packet.

Description

接收和发送音频数据包的方法、装置、电子设备Method, apparatus and electronic device for receiving and transmitting audio data packets
相关申请的交叉引用CROSS-REFERENCE TO RELATED APPLICATIONS
本申请基于申请号为202110395397.9,申请日为2021年4月13日的中国专利申请提出,并要求上述中国专利申请的优先权,上述中国专利申请的全部内容在此引入本申请作为参考。This application is based on the Chinese patent application with the application number of 202110395397.9 and the filing date of April 13, 2021, and claims the priority of the above-mentioned Chinese patent application. The entire content of the above-mentioned Chinese patent application is incorporated herein by reference.
技术领域technical field
本申请涉及数据传输领域,具体涉及一种接收音频数据包的方法、发送音频数据包的方法、装置、电子设备及存储介质。The present application relates to the field of data transmission, and in particular, to a method for receiving audio data packets, a method, apparatus, electronic device and storage medium for transmitting audio data packets.
背景技术Background technique
相关技术中,通过蓝牙传输,能够将设备中的音频数据传输至蓝牙设备上播放,而在蓝牙连接状况不好的情况下,可能会出现传输的音频数据包发送失败的情况,或者蓝牙设备不能及时接收到音频数据包,导致音频数据包的发送效率降低,蓝牙设备侧音频播放卡顿。In the related art, through Bluetooth transmission, the audio data in the device can be transmitted to the Bluetooth device for playback. However, when the Bluetooth connection is not good, the transmission of the transmitted audio data packet may fail, or the Bluetooth device cannot. The audio data packet is received in time, which reduces the transmission efficiency of the audio data packet and causes the audio playback on the Bluetooth device side to freeze.
发明内容SUMMARY OF THE INVENTION
为解决相关技术问题,本申请实施例提供了一种接收音频数据包的方法、发送音频数据包的方法、装置、电子设备及存储介质。In order to solve the related technical problems, the embodiments of the present application provide a method for receiving audio data packets, a method, apparatus, electronic device and storage medium for sending audio data packets.
本申请实施例提供了一种在音频接收端中接收音频数据包的方法,包括:The embodiment of the present application provides a method for receiving audio data packets in an audio receiving end, including:
通过透传方式从音频源接收音频源数据;Receive audio source data from the audio source through transparent transmission;
从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;Receive the first audio data packet from the audio source, and store the first audio data packet in the first buffer area;
对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;Encoding the audio source data to obtain a second audio data packet, and storing the second audio data packet in the second buffer area;
若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。If the predetermined condition is satisfied, the second audio data packet in the second buffer area is stored in the first buffer area based on the playing sequence of the audio data packets.
本申请实施例还提供了一种在音频源中发送音频数据包的方法,包括:Embodiments of the present application also provide a method for sending audio data packets in an audio source, including:
对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;The audio source data is encoded to obtain the first audio data packet, and the first audio data packet is stored in the third buffer area;
向所述音频接收端透传所述音频源数据;transparently transmit the audio source data to the audio receiving end;
从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。The first audio data packet is extracted from the third buffer area and sent to the audio receiving end.
本申请实施例还提供了一种音频接收装置,包括:The embodiment of the present application also provides an audio receiving device, including:
第一接收单元,配置为通过透传方式从音频源接收音频源数据;a first receiving unit, configured to receive audio source data from an audio source through transparent transmission;
第二接收单元,配置为从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;a second receiving unit, configured to receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area;
存储单元,配置为对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;a storage unit, configured to encode the audio source data to obtain a second audio data packet, and store the second audio data packet in a second buffer area;
播放单元,配置为若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。The playing unit is configured to store the second audio data packets in the second buffer area into the first buffer area based on the playing sequence of the audio data packets if a predetermined condition is satisfied.
本申请实施例还提供了另一种音频发送装置,包括:The embodiment of the present application also provides another audio transmission device, including:
编码单元,配置为对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;an encoding unit, configured to encode the audio source data to obtain a first audio data packet, and store the first audio data packet in a third buffer area;
第一传输单元,配置为向所述音频接收端透传所述音频源数据;a first transmission unit, configured to transparently transmit the audio source data to the audio receiving end;
第二传输单元,配置为从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。The second transmission unit is configured to extract the first audio data packet from the third buffer area and send it to the audio receiving end.
本申请实施例还提供了一种电子设备,包括:处理器和配置为存储能够在处理器上运行的计算机程序的存储器,Embodiments of the present application also provide an electronic device, including: a processor and a memory configured to store a computer program that can be executed on the processor,
其中,所述处理器配置为运行所述计算机程序时,执行上述任一方法的步骤。Wherein, the processor is configured to execute the steps of any of the above methods when running the computer program.
本申请实施例还提供了一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述任一方法的步骤。Embodiments of the present application further provide a storage medium on which a computer program is stored, and when the computer program is executed by a processor, implements the steps of any of the foregoing methods.
在本申请实施例中,通过透传方式从音频源接收音频源数据;从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,通过将音频源数据与进行编码处理之后的音频数据同时传输到音频接收端,使得音频接收端在出现播放卡顿的情况下,可以通过接收的音频源数据提取对应的数据继续播放,从而避免了音频播放卡顿的问题。In the embodiment of the present application, the audio source data is received from the audio source through transparent transmission; the first audio data packet is received from the audio source, and the first audio data packet is stored in the first buffer area; The source data is encoded to obtain the second audio data packet, and the second audio data packet is stored in the second buffer area; if the predetermined condition is met, based on the playback order of the audio data packets, the second audio data packet in the second buffer area is stored. The audio data packet is stored in the first buffer area, and the audio source data and the audio data after the encoding process are simultaneously transmitted to the audio receiving end, so that the audio receiving end can pass the received audio when the playback is stuck. Extract the corresponding data from the source data and continue to play, thus avoiding the problem of audio playback being stuck.
附图说明Description of drawings
图1为本申请一实施例提供的音频传输方法的实现流程示意图;1 is a schematic flowchart of an implementation of an audio transmission method provided by an embodiment of the present application;
图2为本申请一实施例提供的第二蓝牙设备的音频播放流程示意图;2 is a schematic diagram of an audio playback process of a second Bluetooth device provided by an embodiment of the present application;
图3为本申请一实施例提供的确定第一标识的流程示意图;3 is a schematic flowchart of determining a first identifier according to an embodiment of the present application;
图4为本申请一实施例提供的音频传输方法的实现流程示意图;FIG. 4 is a schematic diagram of an implementation flowchart of an audio transmission method provided by an embodiment of the present application;
图5为本申请一实施例提供的音频数据的发送流程示意图;FIG. 5 is a schematic diagram of a sending process of audio data provided by an embodiment of the present application;
图6为本申请一实施例提供的发送第一音频数据包的示意图;6 is a schematic diagram of sending a first audio data packet according to an embodiment of the present application;
图7为本申请一实施例提供的音频传输装置的结构示意图;7 is a schematic structural diagram of an audio transmission device provided by an embodiment of the present application;
图8为本申请又一实施例提供的音频传输装置的结构示意图FIG. 8 is a schematic structural diagram of an audio transmission apparatus provided by another embodiment of the present application
图9为本申请一实施例提供电子设备的硬件组成结构示意图。FIG. 9 is a schematic structural diagram of a hardware composition of an electronic device according to an embodiment of the present application.
具体实施方式Detailed ways
本申请实施例提供了一种在音频接收端中接收音频数据包的方法,图1为本申请实施例的在音频接收端中接收音频数据包的方法一种流程示意图。如图1所示,所述方法包括:An embodiment of the present application provides a method for receiving an audio data packet in an audio receiving end, and FIG. 1 is a schematic flowchart of a method for receiving an audio data packet in an audio receiving end according to an embodiment of the present application. As shown in Figure 1, the method includes:
S101:通过透传方式从音频源接收音频源数据。S101: Receive audio source data from an audio source in a transparent transmission manner.
这里,接收的音频源数据是由音频源通过透传的方式传输至音频接收端的,音频源在传输音频源数据的时候,不对音频源数据进行编码等处理,直接将音频源数据输到音频接收端,从而音频接收端能够获取音频源数据。在实际应用中,音频源与音频接收端可以进行蓝牙连接,示例地,音频源可以为移动终端,音频接收端可以为蓝牙耳机。Here, the received audio source data is transmitted from the audio source to the audio receiver through transparent transmission. When the audio source transmits the audio source data, it does not perform encoding and other processing on the audio source data, and directly transmits the audio source data to the audio receiver. so that the audio sink can obtain the audio source data. In practical applications, the audio source and the audio receiving end may be connected by Bluetooth. For example, the audio source may be a mobile terminal, and the audio receiving end may be a Bluetooth headset.
S102:从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;所述第一音频数据包由所述音频源对所述音频源数据编码得到。S102: Receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area; the first audio data packet is obtained by encoding the audio source data by the audio source.
这里,音频接收端还可以从音频源中接收到第一音频数据包,将第一音频数据包存入到音频接收端侧的第一缓存区中。第一音频数据包是经过编码处理的,是由音频源对音频源数据进行编码得到的第一音频数据包。在实际应用中,第一音频数据包是在一定的时间下从音频源传输到音频接收端的,因此音频源数据可以在传输第一音频数据包之外的时间进行传输,从而不会影响到第一音频数据包的传输效率。Here, the audio receiving end may also receive the first audio data packet from the audio source, and store the first audio data packet in the first buffer area on the audio receiving end side. The first audio data packet is the first audio data packet obtained by encoding the audio source data by the audio source. In practical applications, the first audio data packet is transmitted from the audio source to the audio receiving end at a certain time, so the audio source data can be transmitted at a time other than the transmission of the first audio data packet, so that the first audio data packet will not be affected. The transmission efficiency of an audio data packet.
S103:对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区。S103: Encode the audio source data to obtain a second audio data packet, and store the second audio data packet in a second buffer area.
这里,音频接收端在接收到音频源数据之后,对音频源数据进行编码得到第二音频数据包,并将第二音频数据包存入第二缓存区,其中,第二缓存区是位于音频接收端侧,负责存储第二音频数据包以使在音频接收端播放的音频卡顿的时候,可以从第二音频缓存区中提取对应的第二音频数据包保持音频的播放。Here, after receiving the audio source data, the audio receiving end encodes the audio source data to obtain the second audio data packet, and stores the second audio data packet in the second buffer area, wherein the second buffer area is located in the audio receiving end. The terminal side is responsible for storing the second audio data packet so that when the audio played at the audio receiving end is stuck, the corresponding second audio data packet can be extracted from the second audio buffer area to keep the audio playing.
S104:若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。S104: If a predetermined condition is satisfied, store the second audio data packet in the second buffer area into the first buffer area based on the playback sequence of the audio data packets.
这里,第一音频数据包与第二音频数据包均为有效的音频数据,可以播放对应的音频内容,一般在音频接收端与音频源端之间的传输状况良好的情况下,会从第一缓存区中提取对应的第一音频数据包进行音频的播放, 若满足预定条件,可以将第二缓存区中的第二音频数据包存入第一缓存区中进行播放,其中,预定条件可以表征利用第一音频数据包播放出现障碍或者音频播放卡顿的现象。在实际应用中,音频源对音频源数据进行编码生成音频数据包的时候,是按照顺序对音频源数据进行编码的,音频接收端接收的第一音频数据包以及编码生成的第二音频数据均为音频源数据中的一部分数据,在进行音频播放的时候,需要按照音频数据包对应的播放顺序播放对应的音频数据包,可以保证音频播放的正常而不会出现音频播放错乱的情况。在实际应用中,在音频源编码生成第一音频数据包的时候,可以在第一音频数据包上附带有对应的第一音频数据包序列号,第一音频数据包序列号可以指示音频的播放顺序,从而可以提取对应的第一音频数据包进行播放,示例地,当前播放的音频对应的第一音频数据包序列号为3,那么在播放完对应的音频之后,从第一缓存区中提取第一音频数据包序列号为4的音频数据包进行后续的音频播放。如图2所示,图2示出了音频接收端的音频播放流程示意图。在图2中,音频接收端的蓝牙模块接收第一音频数据包以及音频源数据,将蓝牙模块接收到的第一音频数据包存储到第一缓存区,将基于音频源数据编码得到的第二音频数据包存储到第二缓存区,音频播放单元从第一缓存区提取对应的第一音频数据包实现音频的播放。在设定条件的情况下,音频播放单元从第二缓存区提取对应的第二音频数据包存入到第一缓存区中,也可以实现音频的播放。Here, the first audio data packet and the second audio data packet are both valid audio data, and the corresponding audio content can be played. Generally, when the transmission between the audio sink and the audio source is in good condition, the The corresponding first audio data packet is extracted from the buffer area for audio playback. If the predetermined condition is met, the second audio data packet in the second buffer area can be stored in the first buffer area for playback, wherein the predetermined condition can represent The playback of the first audio data packet is blocked or the audio playback is stuck. In practical applications, when the audio source encodes the audio source data to generate an audio data packet, the audio source data is encoded in sequence. The first audio data packet received by the audio receiver and the second audio data generated by the encoding are both It is a part of the data in the audio source data. When performing audio playback, it is necessary to play the corresponding audio data packets in the playback order corresponding to the audio data packets, which can ensure the normal audio playback without any disordered audio playback. In practical applications, when the audio source coding generates the first audio data packet, a corresponding first audio data packet serial number may be attached to the first audio data packet, and the first audio data packet serial number may indicate the playback of the audio sequence, so that the corresponding first audio data packet can be extracted and played. For example, the sequence number of the first audio data packet corresponding to the currently playing audio is 3, then after the corresponding audio is played, the first audio data packet is extracted from the first buffer area. The audio data packet whose sequence number is 4 of the first audio data packet is used for subsequent audio playback. As shown in FIG. 2 , FIG. 2 shows a schematic diagram of an audio playing process of an audio receiving end. In Figure 2, the Bluetooth module of the audio receiving end receives the first audio data packet and audio source data, stores the first audio data packet received by the Bluetooth module in the first buffer area, and encodes the second audio based on the audio source data. The data packets are stored in the second buffer area, and the audio playback unit extracts the corresponding first audio data packets from the first buffer area to realize audio playback. In the case of setting conditions, the audio playback unit extracts the corresponding second audio data packets from the second buffer area and stores them in the first buffer area, which can also realize audio playback.
在上述实施例中,通过透传方式从音频源接收音频源数据;从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,能够将传输音频数据包与音频源数据传输到音频接收端中,使得音频接收端在根据音频数据包播放的过程中遇到卡顿的情况下,可以根据接收到的音频源数据维持音频的正常播放,避免出现音频播放卡顿或中断的问题。In the above-mentioned embodiment, the audio source data is received from the audio source through transparent transmission; the first audio data packet is received from the audio source, and the first audio data packet is stored in the first buffer area; Data encoding obtains a second audio data packet, and the second audio data packet is stored in the second buffer area; if a predetermined condition is met, based on the playback order of the audio data packets, the second audio data packet in the second buffer area is stored. The data packet is stored in the first buffer area, and the transmission audio data packet and audio source data can be transmitted to the audio receiving end, so that the audio receiving end encounters a jam during the playback of the audio data packet. Maintain the normal playback of audio according to the received audio source data to avoid the problem of audio playback being stuck or interrupted.
在一实施例中,所述若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:In one embodiment, if a predetermined condition is met, the second audio data packet in the second buffer area is stored in the first buffer area based on the playback order of the audio data packets, including:
在所述第一缓存区中存储的第一音频数据包的数量小于设定阈值的情况下,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the number of the first audio data packets stored in the first buffer area is less than the set threshold, the second audio data packets in the second buffer area are stored in the first buffer area.
这里,可以通过第一缓存区中存储的第一音频数据包的数量确定音频播放是否会出现卡顿,在正常情况下,第一缓存区中存储的第一音频数据包的数量应当处于一个稳定的阈值,当音频源与音频接收端之间的连接不稳定的时候,第一缓存区中存储的第一音频数据包的数量小于设定阈值的情况下,可以确定音频接收端没有接收到音频源传来的新的第一音频数据包,并且在这种情况下,为了维持音频的正常播放,将第一缓存区中原先存储的第一音频数据包提取并播放,也就是说音频接收端已接收的第一音 频数据包即将被耗尽,音频播放即将会出现卡顿的情况,那么将第二缓存区中的第二音频数据包存入到第一缓存区中,通过第二缓存区将替补无法传输成功的第一音频数据包,从而可以根据第二音频数据包维持音频的播放。Here, it can be determined by the number of the first audio data packets stored in the first buffer area whether the audio playback will freeze. Under normal circumstances, the number of the first audio data packets stored in the first buffer area should be in a stable state. When the connection between the audio source and the audio receiver is unstable, and the number of the first audio data packets stored in the first buffer area is less than the set threshold, it can be determined that the audio receiver has not received audio. The new first audio data packet from the source, and in this case, in order to maintain the normal playback of the audio, the first audio data packet originally stored in the first buffer area is extracted and played, that is, the audio receiving end The received first audio data packet is about to be exhausted, and the audio playback is about to freeze, then store the second audio data packet in the second buffer area into the first buffer area, and pass through the second buffer area. The first audio data packet that cannot be successfully transmitted will be replaced, so that audio playback can be maintained according to the second audio data packet.
在上述实施例中,在所述第一缓存区中存储的第一音频数据包的数量小于设定阈值的情况下,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,可以通过缓存区中存储的第一音频数据包的数据量预判音频播放的情况,从而能够在发生音频播放卡顿之外及时通过第二音频数据包维持音频的播放,避免出现音频播放卡顿或中断的问题。In the above embodiment, when the number of the first audio data packets stored in the first buffer area is less than a set threshold, the second audio data packets in the second buffer area are stored in the A buffer area, which can predict the situation of audio playback by the data volume of the first audio data packet stored in the buffer area, so that the audio playback can be maintained through the second audio data packet in time when the audio playback freezes, so as to avoid the occurrence of Audio playback is stuttered or interrupted.
在一实施例中,在所述第二缓存区中的第二音频数据包存入所述第一缓存区之后,所述方法还包括:In one embodiment, after the second audio data packets in the second buffer area are stored in the first buffer area, the method further includes:
在所述第一缓存区中缓存的第一音频数据包大于或等于设定阈值的情况下,中止将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the first audio data packet buffered in the first buffer area is greater than or equal to the set threshold, the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
这里,当第一缓存区中存储的第一音频数据包大于或等于设定阈值的情况下,说明音频源与音频接收端之间的连接恢复或者连接状态良好,能够保证第一音频包的正常传输,在这种情况,不需要再通过第二音频数据包进行音频的播放,从而中止从第二缓存区中提取出对应的第二音频数据包存入到第一缓存区中。Here, when the first audio data packet stored in the first buffer area is greater than or equal to the set threshold, it means that the connection between the audio source and the audio receiving end is restored or the connection state is good, which can ensure the normal operation of the first audio packet. In this case, it is not necessary to perform audio playback through the second audio data packet, so that the extraction of the corresponding second audio data packet from the second buffer area and storing the corresponding second audio data packet in the first buffer area is stopped.
在上述实施例中,在所述第一缓存区中缓存的第一音频数据包大于或等于设定阈值的情况下,中止将所述第二缓存区中的第二音频数据包存入所述第一缓存区,能够根据第一缓存区中存储的第一音频数据包的数量,确定第一音频数据包的传输状况,当第一音频数据包传输恢复正常的时候,可以维持原有的播放模式,从而能够保证音频可以正常播放,避免出现音频播放卡顿或中断的现象。In the above embodiment, when the first audio data packet buffered in the first buffer area is greater than or equal to the set threshold, the storage of the second audio data packet in the second buffer area into the The first buffer area can determine the transmission status of the first audio data packet according to the number of the first audio data packets stored in the first buffer area. When the transmission of the first audio data packet returns to normal, the original playback can be maintained. mode, so as to ensure that the audio can be played normally and avoid the phenomenon that the audio playback is stuck or interrupted.
在一实施例中,所述对所述音频源数据编码得到第二音频数据包,包括:In one embodiment, the encoding of the audio source data to obtain the second audio data packet includes:
采用与所述音频源的编码方式相同的编码参数对所述音频源数据进行编码,得到所述第二音频数据包。The audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet.
这里,音频接收端在对音频源数据进行编码的时候,是采用与音频源的编码方式相同的编码参数对音频源数据做编码压缩等相应的操作,从而使得生成的第二音频数据包的编码参数与第一音频数据包的编码参数相同,其中,编码参数可以包括一个音频数据包的帧长度。在实际应用中,在生成第二音频数据包的时候还可以确定每个第二音频数据包对应的音频数据包序列号。由于第二音频数据包采用与生成第一音频数据包相同的编码参数而生成的,原则上相同音频数据包序列号的第一音频数据包与第二音频数据包是相同的,例如,音频数据包序列号为1的第一音频数据包与第二音频数据包对应的音频内容是相同的,从而使基于第二音频数据包进行音频播放的时候,提取的第二音频数据包恰好为后续需要播放的音频内 容,保证音频播放的连贯性。Here, when the audio receiving end encodes the audio source data, it uses the same encoding parameters as the encoding method of the audio source to perform corresponding operations such as encoding and compressing the audio source data, so that the encoding of the generated second audio data packet is The parameter is the same as the encoding parameter of the first audio data packet, wherein the encoding parameter may include the frame length of one audio data packet. In practical applications, the audio data packet sequence number corresponding to each second audio data packet may also be determined when the second audio data packet is generated. Since the second audio data packet is generated using the same encoding parameters as the first audio data packet, in principle, the first audio data packet with the same audio data packet serial number is the same as the second audio data packet, for example, the audio data The audio content corresponding to the first audio data packet with the packet sequence number of 1 is the same as the audio content corresponding to the second audio data packet, so that when audio playback is performed based on the second audio data packet, the extracted second audio data packet is just for the subsequent needs. The audio content to be played ensures the continuity of audio playback.
上述实施例中,采用与所述音频源的编码方式相同的编码参数对所述音频源数据进行编码,得到所述第二音频数据包,能够使生成的第一音频数据包与第二音频数据包相同,从而使得在基于第二音频数据包播放进行音频播放的时候,保证了音频播放的连贯性,避免出现音频播放错乱的情况。In the above embodiment, the audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet, which enables the generated first audio data packet and the second audio data to be generated. The packets are the same, so that when the audio is played based on the playback of the second audio data packet, the continuity of the audio playback is ensured, and the disorder of the audio playback is avoided.
在一实施例中,所述将所述第二音频数据包存入第二缓存区时,所述方法还包括:In an embodiment, when the second audio data packet is stored in the second buffer area, the method further includes:
为所述第二音频数据包添加第一标识,所述第一标识用于标记所述音频接收端是否已播放了所述第二音频数据包对应的音频。A first identifier is added to the second audio data packet, where the first identifier is used to mark whether the audio receiving end has played the audio corresponding to the second audio data packet.
这里,为了保证从第二缓存区中提取的第二音频数据包是已播放的音频内容的后续内容,因此可以为第二音频数据包添加第一标识,第一标识用于标记音频接收端是否已播放了第二音频数据包对应的音频。在实际应用中,可以根据当前播放的音频数据包更改第二音频数据包对应的第一标识,示例地,根据当前播放的第一音频数据包所对应的音频数据包序列号,可以将具有相同音频数据包序列号的第二音频数据包的第一标记确定为已播放的状态,由于第一音频数据包与第二音频数据包相同,因此,当第一音频数据包的内容已经被播放的时候,对应的具有相同内容的第二音频数据包也处于已播放的状态,例如,通过flag表示第一标识,flag=0表示音频接收端未播放第二音频数据包,flag=1表示音频接收端已播放第二音频数据包,在实际应用中,默认所有第二音频数据包的flag=0,将第二音频数据包与音频接收终端正在播放的第一音频数据包进行对比,从而及时更改第二音频数据包对应的flag值,如图3所示,图3示出了确定第一标识的流程示意图,在图3中,当前播放的音频数据包对应的音频数据包序列号Sequence_Num=8,根据与第二缓存区中的第二音频数据包进行对比,确定Sequence_Num=8的第二音频数据包,并将对应的第一标识flag的数值由0更改到1,标识音频数据包序列号为8的第二音频数据包对应的音频已被音频播放端播放,从而可以根据第二音频数据包的第一标识确定当前音频的播放进度。Here, in order to ensure that the second audio data packet extracted from the second buffer area is the subsequent content of the played audio content, a first identification can be added to the second audio data packet, and the first identification is used to mark whether the audio receiving end is The audio corresponding to the second audio data packet has been played. In practical applications, the first identifier corresponding to the second audio data packet can be changed according to the currently playing audio data packet. The first mark of the second audio data packet of the audio data packet serial number is determined to be in the played state. Since the first audio data packet is the same as the second audio data packet, when the content of the first audio data packet has been played When the corresponding second audio data packet with the same content is also in the state of being played, for example, the first flag is indicated by flag, flag=0 means that the audio receiving end does not play the second audio data packet, and flag=1 means that the audio is received The terminal has played the second audio data packet. In practical applications, the flag=0 of all the second audio data packets is defaulted, and the second audio data packet is compared with the first audio data packet being played by the audio receiving terminal, so as to change it in time. The flag value corresponding to the second audio data packet is shown in FIG. 3 , which shows a schematic flowchart of determining the first identifier. In FIG. 3 , the audio data packet sequence number Sequence_Num=8 corresponding to the currently playing audio data packet , according to the comparison with the second audio data packet in the second buffer area, determine the second audio data packet of Sequence_Num=8, and change the value of the corresponding first identification flag from 0 to 1, and identify the audio data packet sequence number The audio corresponding to the second audio data packet of 8 has been played by the audio playback terminal, so that the playback progress of the current audio can be determined according to the first identifier of the second audio data packet.
所述将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:The storing of the second audio data packet in the second buffer area into the first buffer area includes:
基于对应的第一标识和当前的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。Based on the corresponding first identifier and the current play sequence, the second audio data packet in the second buffer area is stored in the first buffer area.
这里,由于第一标识可以确定第二音频数据包对应的音频内容是否已经被音频接收端播放,从而如果第二音频数据包的第一标识表征当前的第二音频数据包并未被音频接收端播放,可以确定音频接收端为当前播放的音频的后续音频内容,根据对应的第一标识和当前播放顺序,将第二缓存区中的第二音频数据包存入到第一缓存区中,例如,根据第二音频数据包 flag=0可以确定未播放的第二音频数据包,根据第二音频数据包flag=1可以确定当前的播放顺序,当在设定条件的情况下,第二音频数据包flag=1对应的音频数据包序列号为5,并且音频数据包序列号为6对应的第二音频数据包的flag=0,则表示下一个播放的音频内容为音频数据包序列号为6的第二音频数据包,从而将第二缓存区中音频数据包序列号为6的第二音频数据包提取到第一缓存区中。Here, because the first identification can determine whether the audio content corresponding to the second audio data packet has been played by the audio receiving end, so if the first identification of the second audio data packet represents the current second audio data packet has not been played by the audio receiving end Play, it can be determined that the audio receiving end is the follow-up audio content of the currently playing audio, and according to the corresponding first identification and the current playback order, the second audio data packet in the second buffer area is stored in the first buffer area, for example , the unplayed second audio data packet can be determined according to the second audio data packet flag=0, and the current playback order can be determined according to the second audio data packet flag=1. When the conditions are set, the second audio data packet The audio data packet sequence number corresponding to the packet flag=1 is 5, and the flag=0 of the second audio data packet corresponding to the audio data packet sequence number 6 indicates that the audio content to be played next is the audio data packet sequence number 6. to extract the second audio data packet with the audio data packet sequence number of 6 in the second buffer area to the first buffer area.
在上述实施例中,所述将所述第二音频数据包存入第二缓存区时,为所述第二音频数据包添加第一标识,所述第一标识用于标记所述音频接收端是否已播放了所述第二音频数据包对应的音频;基于对应的第一标识和当前的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,能够通过第一标识确定当前音频的播放进度,从而有利于准确地提取当前音频的后续内容所对应的音频数据包,在避免音频播放卡顿的同时还能准确定播放对应的音频内容,保持音频播放的连贯性。In the above embodiment, when the second audio data packet is stored in the second buffer area, a first identification is added to the second audio data packet, and the first identification is used to mark the audio receiving end Whether the audio corresponding to the second audio data packet has been played; based on the corresponding first identification and the current playback order, the second audio data packet in the second buffer area is stored in the first buffer area, The playback progress of the current audio can be determined by the first identification, which is conducive to accurately extracting the audio data packets corresponding to the subsequent content of the current audio, and can accurately play the corresponding audio content while avoiding the audio playback jam, keeping the audio Continuity of playback.
在一实施例中,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:In one embodiment, storing the second audio data packet in the second buffer area into the first buffer area includes:
基于所述音频接收端的音频播放速度确定第一周期;以及Determine the first period based on the audio playback speed of the audio receiver; and
每隔所述第一周期,将所述第二缓存区中的第二音频数据包依次存入所述第一缓存区。Every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
这里,从第二缓存区中提取出对应的第二音频数据包的时候并不是连续获取的,而是每隔第一周期,从第二缓存区中提取对应的第二音频数据包,其中,第一周期是基于音频接收端的音频播放速度确定的,在实际应用中,音频接收端能够周期性地接收的第一音频数据包,表明了音频源能够正常发送第一音频数据包,从而能够保证音频接收端的音频播放流畅,因此,基于接收第一音频数据包的第一周期从第二缓存区中提取第二音频数据包,能够保持音频的播放速度,保证音频播放流畅。Here, when the corresponding second audio data packet is extracted from the second buffer area, it is not obtained continuously, but every first cycle, the corresponding second audio data packet is extracted from the second buffer area, wherein, The first period is determined based on the audio playback speed of the audio receiving end. In practical applications, the first audio data packet that the audio receiving end can receive periodically indicates that the audio source can send the first audio data packet normally, thus ensuring that The audio playback at the audio receiving end is smooth. Therefore, extracting the second audio data packet from the second buffer area based on the first cycle of receiving the first audio data packet can maintain the audio playback speed and ensure smooth audio playback.
在上述实施例中,基于所述音频接收端的音频播放速度确定第一周期;以及每隔所述第一周期,将所述第二缓存区中的第二音频数据包依次存入所述第一缓存区,通过控制音频数据包的提取时间可以保持音频的播放速度,使得基于第二音频数据包播放音频的效果与基于第一音频数据包播放音频的效果相近或相同,从而保证了音频播放流畅。In the above embodiment, a first cycle is determined based on the audio playback speed of the audio receiving end; and every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first cycle The buffer area can maintain the audio playback speed by controlling the extraction time of the audio data packet, so that the effect of playing audio based on the second audio data packet is similar to or the same as the effect of playing audio based on the first audio data packet, thereby ensuring smooth audio playback. .
在一实施例中,所述方法还包括:In one embodiment, the method further includes:
若与所述音频源断开蓝牙连接,则将所述第二缓存区中的第二音频数据包存入所述第一缓存区进行播放。If the Bluetooth connection is disconnected from the audio source, the second audio data packet in the second buffer area is stored in the first buffer area for playback.
这里,第一音频数据包是在音频源与音频接收端之间的蓝牙连接而实现数据传输的,当音频源与音频接收端之间的蓝牙连接断开的时候,例如,音频接收端与音频源之间的距离在有效蓝牙通讯范围之外,那么无法实现第一音频数据包的有效传输,导致在音频源与音频接收端在恢复连接之前无法根据第一音频数据包实现音频的播放,而在音频源与音频接收端保持 蓝牙连接的过程中能够实现全部音频源数据的传输,并且,音频源数据的传输不需要过长的时间,在这种情况下,可以根据第二缓存区中基于音频源数据编码得到的第二音频数据包进行音频的播放,第二音频数据包是存储在音频接收设备中,实现了离线的本地播放。Here, the first audio data packet is realized by the Bluetooth connection between the audio source and the audio receiving end. When the Bluetooth connection between the audio source and the audio receiving end is disconnected, for example, the audio receiving end and the audio receiving end are disconnected. The distance between the sources is outside the effective Bluetooth communication range, so the effective transmission of the first audio data packet cannot be achieved, resulting in the inability to realize audio playback according to the first audio data packet before the audio source and the audio receiving end are reconnected, and In the process of maintaining the Bluetooth connection between the audio source and the audio receiving end, the transmission of all audio source data can be realized, and the transmission of the audio source data does not take too long. The second audio data package obtained by encoding the audio source data is used for audio playback, and the second audio data package is stored in the audio receiving device to realize offline local playback.
在上述实施例中,若与所述音频源断开蓝牙连接,则将所述第二缓存区中的第二音频数据包存入所述第一缓存区进行播放,能够在蓝牙连接断开的情况下,基于传输的音频源数据的音频数据包实现离线的本地播放,从而能够实现音频接收端的离线播放能力。In the above embodiment, if the Bluetooth connection is disconnected from the audio source, the second audio data packet in the second buffer area is stored in the first buffer area for playback, which can be played when the Bluetooth connection is disconnected. In this case, offline local playback is implemented based on the audio data packets of the transmitted audio source data, so that the offline playback capability of the audio receiving end can be implemented.
在一实施例中,所述方法还包括:In one embodiment, the method further includes:
基于存入所述第一缓存区的第二音频数据包,播放对应的音频。Based on the second audio data packet stored in the first buffer area, the corresponding audio is played.
这里,将从第二缓存区中提取的第二音频数据包存入第一缓存区中,第一缓存区能够根据存入的第二音频数据包播放对应的音频,在实际应用中,第一音频数据包与第二音频数据包均为有效的音频数据,能够播放对应的音频内容,并且,第一缓存区的第二音频数据包是在第一缓存区中的第一音频数据包即将耗尽的时存入的,因此,根据第二音频数据包播放对应的音频的时候可以接着第一音频数据包对应的播放内容进行播放,从而能够保证音频的流畅播放。Here, the second audio data packet extracted from the second buffer area is stored in the first buffer area, and the first buffer area can play the corresponding audio according to the stored second audio data packet. Both the audio data packet and the second audio data packet are valid audio data and can play the corresponding audio content, and the second audio data packet in the first buffer area is the first audio data packet in the first buffer area that is about to be consumed. Therefore, when the corresponding audio is played according to the second audio data packet, the playback content corresponding to the first audio data packet can be followed, thereby ensuring smooth playback of the audio.
在上述实施例中,基于存入所述第一缓存区的第二音频数据包,播放对应的音频,能够在传输状况不好的情况下,利用透传的音频数据保持音频的播放,避免音频播放卡顿的现象。In the above-mentioned embodiment, based on the second audio data packet stored in the first buffer area, the corresponding audio is played, and the transparently transmitted audio data can be used to maintain the audio playback when the transmission condition is not good, so as to avoid audio Playback freezes.
本申请实施例还提供了一种在音频源中发送音频数据包的方法,如图4所示,所述方法包括:The embodiment of the present application also provides a method for sending audio data packets in an audio source, as shown in FIG. 4 , the method includes:
S401:对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区。S401: Encode audio source data to obtain a first audio data packet, and store the first audio data packet in a third buffer area.
这里,音频源对音频源数据进行编码生成第一音频数据包,将生成的第一音频数据包存入到第三缓存区中。在实际应用中,还可以在生成第一音频数据包的时候为第一音频数据包添加对应的音频数据包序列号,通过音频数据包序列号可以将不同的第一音频数据包按照播放顺序进行排序,从而可以确定第一音频数据包向音频接收端发送的顺序。Here, the audio source encodes the audio source data to generate the first audio data packet, and stores the generated first audio data packet into the third buffer area. In practical applications, a corresponding audio data packet serial number can also be added to the first audio data packet when the first audio data packet is generated, and different first audio data packets can be played in the playback order through the audio data packet serial number. Sorting, so that the order in which the first audio data packets are sent to the audio receiving end can be determined.
S402:向所述音频接收端透传所述音频源数据。S402: Transparently transmit the audio source data to the audio receiving end.
这里,音频源还通过透传向音频接收端传输音频源数据。在实际应用中,音频源数据不需要经过编码等数据处理,直接将音频源数据传输到音频接收端。Here, the audio source also transmits audio source data to the audio sink through transparent transmission. In practical applications, the audio source data does not need to undergo data processing such as encoding, and the audio source data is directly transmitted to the audio receiving end.
S403:从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。S403: Extract the first audio data packet from the third buffer area and send it to the audio receiving end.
这里,在发送第一音频数据包的时候,从第三缓存区中提取出第一音频数据包并发送至接收端。当在音频源与音频接收端之间的传输状况不好的情况下,例如,出现第一音频数据包需要重传等情况,可以利用音频源 侧的第三缓存区将后面编码生成的第一音频数据包先缓存下来,当需要重传的第一音频数据包成功传输之后,可以立马对第三缓存区中存储的第一音频数据包进行传输,从而能够保证在连接不稳定或者传输状况欠佳的情况下实现音频数据包的完整传输。如图5所示,图5示出了第一音频数据包与音频源数据的发送流程示意图,首先音频源会对音频源数据进行编码后得到第一音频数据包,判断上一个第一音频数据包的发送是否成功并且缓存区中是否不存在音频数据包,当上一个第一音频数据包发送成功,则代表着可以直接将第一音频数据包发出,如果上一个第一音频数据包发送不成功,则将第一音频数据包存入到缓存区中,并在上一个第一音频数据包发送成功的时候,将缓存区中的第一音频数据包发出。Here, when the first audio data packet is sent, the first audio data packet is extracted from the third buffer area and sent to the receiving end. When the transmission condition between the audio source and the audio receiver is not good, for example, the first audio data packet needs to be retransmitted, etc., the third buffer area on the audio source side can be used to encode the first audio data packet generated later. The audio data packet is buffered first, and after the first audio data packet that needs to be retransmitted is successfully transmitted, the first audio data packet stored in the third buffer area can be transmitted immediately, so as to ensure that the connection is unstable or the transmission condition is insufficient. The complete transmission of audio data packets can be achieved under optimal conditions. As shown in Figure 5, Figure 5 shows a schematic diagram of the sending process of the first audio data packet and the audio source data. First, the audio source will encode the audio source data to obtain the first audio data packet, and judge the previous first audio data. Whether the transmission of the packet is successful and whether there is no audio data packet in the buffer area, when the last first audio data packet is sent successfully, it means that the first audio data packet can be sent directly. If successful, the first audio data packet is stored in the buffer area, and when the previous first audio data packet is successfully sent, the first audio data packet in the buffer area is sent out.
在上述实施例中,对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;向所述音频接收端透传所述音频源数据;从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端,能够将音频源数据以及对应的音频数据包发送到音频播放端,使得音频接收端能够在无法及时接收到音频数据包的情况下,利用音频源数据进行音频的后续播放,避免在蓝牙设备之间的连接异常断开或者因无限干扰而导致音频播放卡顿的现象。In the above embodiment, the audio source data is encoded to obtain the first audio data packet, and the first audio data packet is stored in the third buffer area; the audio source data is transparently transmitted to the audio receiving end; The third buffer area extracts the first audio data packet and sends it to the audio receiving end, so that the audio source data and the corresponding audio data packet can be sent to the audio playing end, so that the audio receiving end can receive the audio in time. In the case of data packets, the audio source data is used for subsequent audio playback to avoid abnormal disconnection between Bluetooth devices or the phenomenon that audio playback is stuck due to infinite interference.
在一实施例中,所述从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端,包括:In an embodiment, the extracting the first audio data packet from the third buffer area and sending it to the audio receiving end includes:
基于所述音频接收端的音频播放速度确定第一周期;以及,Determine the first cycle based on the audio playback speed of the audio receiver; and,
每隔所述第一周期,从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。Every first cycle, the first audio data packet is extracted from the third buffer area and sent to the audio receiving end.
这里,第一音频数据包从音频源传输到音频接收端需要适配音频的播放数据,因此,传输的第一音频数据包在每隔第一周期,从第三缓存区中提取出第一音频数据包向音频接收端发送的,第一周期是基于音频接收端的音频播放速度确定的,在实际应用中,当第一周期能够保持相同的话,说明第一音频数据包的传输稳定,从而能够使得音频播放流畅。如图6所示,图6示出了发送第一音频数据包的示意图,在图6中,在两个不同的第一音频数据包之间的发送时间间隔为第一周期。Here, the transmission of the first audio data packet from the audio source to the audio receiving end needs to adapt the playback data of the audio. Therefore, the transmitted first audio data packet extracts the first audio from the third buffer area every first cycle. The data packet is sent to the audio receiving end, and the first cycle is determined based on the audio playback speed of the audio receiving end. In practical applications, when the first cycle can remain the same, it means that the transmission of the first audio data packet is stable, so that the Audio playback is smooth. As shown in FIG. 6 , FIG. 6 shows a schematic diagram of sending a first audio data packet. In FIG. 6 , the sending time interval between two different first audio data packets is a first period.
所述向所述音频接收端透传所述音频源数据,包括:The transparent transmission of the audio source data to the audio receiving end includes:
在所述第一音频数据包的发送间隙向所述音频接收端透传音频源数据。The audio source data is transparently transmitted to the audio receiving end in the transmission gap of the first audio data packet.
这里,在第一音频数据包的发送间隙向音频接收端透传音频源数据,由于第一音频数据包是每隔第一周期发送的,因此,在第一周期内不会进行第一音频数据包的传输,在这个时间下透传音频源数据并不会影响到第一音频数据包的传输性能,从而能够保证第一音频数据包的传输效率的同时实现音频源数据的传输。Here, the audio source data is transparently transmitted to the audio receiving end during the transmission gap of the first audio data packet. Since the first audio data packet is sent every first cycle, the first audio data will not be processed in the first cycle. In the transmission of the packet, the transparent transmission of the audio source data at this time will not affect the transmission performance of the first audio data packet, so that the transmission of the audio source data can be achieved while ensuring the transmission efficiency of the first audio data packet.
在上述实施例中,基于所述音频接收端的音频播放速度确定第一周期; 以及,每隔所述第一周期,从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端,在所述第一音频数据包的发送间隙向所述音频接收端透传音频源数据,能够不会影响音频数据包的传输,进行传输音频源数据的传输,提高了音频数据的传输效率。In the above embodiment, the first cycle is determined based on the audio playback speed of the audio receiving end; and, every first cycle, the first audio data packet is extracted from the third buffer area and sent to the The audio receiving end transparently transmits the audio source data to the audio receiving end in the transmission gap of the first audio data packet, so that the transmission of the audio data packet can be carried out without affecting the transmission of the audio data packet, and the audio data can be transmitted. transmission efficiency.
为实现本申请实施例的方法,本申请实施例还提供了一种音频接收装置,如图7所示,该装置包括:In order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an audio receiving apparatus, as shown in FIG. 7 , the apparatus includes:
第一接收单元701,配置为通过透传方式从音频源接收音频源数据;The first receiving unit 701 is configured to receive audio source data from the audio source through transparent transmission;
第二接收单元702,配置为从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;所述第一音频数据包由所述音频源对所述音频源数据编码得到;The second receiving unit 702 is configured to receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area; the first audio data packet is stored by the audio source to the The audio source data is encoded and obtained;
存储单元703,配置为对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区; Storage unit 703, configured to encode the audio source data to obtain a second audio data packet, and store the second audio data packet into a second buffer area;
播放单元704,配置为按照音频数据包对应的播放顺序,从所述第一缓存区中提取对应的第一音频数据包并播放,或者,在预定条件的情况下将所述第二缓存区中的第二音频数据包存入所述第一缓存区并播放。The playback unit 704 is configured to extract the corresponding first audio data packets from the first buffer area and play them according to the playback sequence corresponding to the audio data packets, or, under predetermined conditions, place the second buffer area in the second buffer area. The second audio data packet is stored in the first buffer area and played.
在一实施例中,所述播放单元704在预定条件的情况下将所述第二缓存区中的第二音频数据包存入所述第一缓存区并播放,还配置为:In one embodiment, the playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area under a predetermined condition and plays it, and is further configured to:
在所述第一缓存区中存储的第一音频数据包的数量小于设定阈值的情况下,将所述第二缓存区中的第二音频数据包存入所述第一缓存区并播放。In the case that the number of the first audio data packets stored in the first buffer area is less than the set threshold, the second audio data packets in the second buffer area are stored in the first buffer area and played.
在一实施例中,所述播放单元704在所述第二缓存区中的第二音频数据包存入所述第一缓存区并播放之后,还配置为:In one embodiment, after the second audio data packet in the second buffer is stored in the first buffer and played, the playing unit 704 is further configured to:
在所述第一缓存区中缓存的第一音频数据包大于或等于设定阈值的情况下,中止将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the first audio data packet buffered in the first buffer area is greater than or equal to the set threshold, the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
在一实施例中,所述存储单元703对所述音频源数据编码得到第二音频数据包,还配置为:In one embodiment, the storage unit 703 encodes the audio source data to obtain a second audio data packet, and is further configured to:
采用与所述音频源的编码方式相同的编码参数对所述音频源数据进行编码,得到所述第二音频数据包。The audio source data is encoded using the same encoding parameters as the encoding method of the audio source to obtain the second audio data packet.
在一实施例中,所述存储单元703所述将所述第二音频数据包存入第二缓存区,还配置为:In one embodiment, the storage unit 703, which stores the second audio data packet in the second buffer area, is further configured to:
为所述第二音频数据包添加第一标识,所述第一标识用于标记所述音频接收端是否已播放了所述第二音频数据包对应的音频;A first identification is added for the second audio data packet, and the first identification is used to mark whether the audio receiver has played the audio corresponding to the second audio packet;
所述播放单元704将所述第二缓存区中的第二音频数据包存入所述第一缓存区,还配置为:The playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area, and is further configured to:
基于对应的第一标识和当前的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。Based on the corresponding first identifier and the current play sequence, the second audio data packet in the second buffer area is stored in the first buffer area.
在一实施例中,所述播放单元704将所述第二缓存区中的第二音频数据包存入所述第一缓存区,还配置为:In one embodiment, the playing unit 704 stores the second audio data packet in the second buffer area into the first buffer area, and is further configured to:
基于所述音频接收端的音频播放速度确定第一周期;以及Determine the first period based on the audio playback speed of the audio receiver; and
每隔所述第一周期,将所述第二缓存区中的第二音频数据包依次存入所述第一缓存区。Every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
在一实施例中,所述播放单元704还配置为:In one embodiment, the playback unit 704 is further configured to:
若与所述音频源断开蓝牙连接,则将所述第二缓存区中的第二音频数据包存入所述第一缓存区进行播放。If the Bluetooth connection is disconnected from the audio source, the second audio data packet in the second buffer area is stored in the first buffer area for playback.
在一实施例中,所述播放单元704还配置为:In one embodiment, the playback unit 704 is further configured to:
基于存入所述第一缓存区的第二音频数据包,播放对应的音频。Based on the second audio data packet stored in the first buffer area, the corresponding audio is played.
实际应用时,第一接收单元701、第二接收单元702、存储单元703、播放单元704可由音频接收装置中的处理器来实现。当然,处理器需要运行存储器中存储的程序来实现上述各程序模块的功能。In practical applications, the first receiving unit 701, the second receiving unit 702, the storage unit 703, and the playing unit 704 may be implemented by a processor in an audio receiving device. Of course, the processor needs to run the program stored in the memory to realize the functions of the above program modules.
需要说明的是,上述图7实施例提供的音频接收装置在进行音频传输时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施例提供的音频接收装置与在音频接收端中接收音频数据包的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the audio receiving apparatus provided in the above embodiment of FIG. 7 performs audio transmission, only the division of the above program modules is used as an example for illustration. In practical applications, the above processing may be allocated to different program modules as required. Completion means dividing the internal structure of the device into different program modules to complete all or part of the processing described above. In addition, the audio receiving apparatus provided in the above embodiment and the method embodiment for receiving an audio data packet in an audio receiving end belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
本申请实施例还提供了另一种音频发送装置,如图8所示,该装置包括:The embodiment of the present application also provides another audio transmission device, as shown in FIG. 8 , the device includes:
编码单元801,配置为对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;The encoding unit 801 is configured to encode the audio source data to obtain the first audio data packet, and store the first audio data packet into the third buffer area;
第一传输单元802,配置为向所述音频接收端透传所述音频源数据;a first transmission unit 802, configured to transparently transmit the audio source data to the audio receiving end;
第二传输单元803,配置为从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。The second transmission unit 803 is configured to extract the first audio data packet from the third buffer area and send it to the audio receiving end.
在一实施例中,所述第二传输单元803从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端,还配置为:In one embodiment, the second transmission unit 803 extracts the first audio data packet from the third buffer area and sends it to the audio receiving end, and is further configured to:
基于所述音频接收端的音频播放速度确定第一周期;以及,Determine the first cycle based on the audio playback speed of the audio receiver; and,
每隔所述第一周期,从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端;At every first cycle, extract the first audio data packet from the third buffer area and send it to the audio receiver;
第一传输单元802向所述音频接收端透传所述音频源数据,还配置为:The first transmission unit 802 transparently transmits the audio source data to the audio receiving end, and is further configured to:
在所述第一音频数据包的发送间隙向所述音频接收端透传音频源数据。The audio source data is transparently transmitted to the audio receiving end in the transmission gap of the first audio data packet.
实际应用时,编码单元801、第一传输单元802、第二传输单元803可由音频发送装置中的处理器来实现。当然,处理器需要运行存储器中存储的程序来实现上述各程序模块的功能。In practical application, the encoding unit 801, the first transmission unit 802, and the second transmission unit 803 may be implemented by a processor in the audio transmission apparatus. Of course, the processor needs to run the program stored in the memory to realize the functions of the above program modules.
需要说明的是,上述图8实施例提供的音频发送装置在进行音频传输时,仅以上述各程序模块的划分进行举例说明,实际应用中,可以根据需要而将上述处理分配由不同的程序模块完成,即将装置的内部结构划分成不同的程序模块,以完成以上描述的全部或者部分处理。另外,上述实施 例提供的音频发送装置与在音频源中发送音频数据包的方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。It should be noted that, when the audio transmission device provided in the above-mentioned embodiment of FIG. 8 performs audio transmission, only the division of the above-mentioned program modules is used for illustration. In practical applications, the above-mentioned processing may be allocated to different program modules as required. Completion means dividing the internal structure of the device into different program modules to complete all or part of the processing described above. In addition, the audio sending device provided in the above embodiment and the method embodiment for sending audio data packets in an audio source belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.
基于上述程序模块的硬件实现,且为了实现本申请实施例的方法,本申请实施例还提供了一种电子设备,图9为本申请实施例电子设备的硬件组成结构示意图,如图9所示,电子设备包括:Based on the hardware implementation of the above program modules, and in order to implement the method of the embodiment of the present application, the embodiment of the present application further provides an electronic device. FIG. 9 is a schematic diagram of the hardware composition of the electronic device according to the embodiment of the present application, as shown in FIG. 9 . , electronic equipment including:
通信接口1,能够与其它设备比如网络设备等进行信息交互; Communication interface 1, which can exchange information with other devices such as network devices;
处理器2,与通信接口1连接,以实现与其它设备进行信息交互,配置为运行计算机程序时,执行上述一个或多个技术方案提供的音频传输方法。而所述计算机程序存储在存储器3上。The processor 2 is connected to the communication interface 1 to realize information interaction with other devices, and is configured to execute the audio transmission method provided by one or more of the above technical solutions when running a computer program. The computer program is instead stored on the memory 3 .
当然,实际应用时,电子设备中的各个组件通过总线系统4耦合在一起。可理解,总线系统4配置为实现这些组件之间的连接通信。总线系统4除包括数据总线之外,还包括电源总线、控制总线和状态信号总线。但是为了清楚说明起见,在图9中将各种总线都标为总线系统4。Of course, in practical application, various components in the electronic device are coupled together through the bus system 4 . It will be appreciated that the bus system 4 is configured to enable connection communication between these components. In addition to the data bus, the bus system 4 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the various buses are labeled as bus system 4 in FIG. 9 .
本申请实施例中的存储器3配置为存储各种类型的数据以支持电子设备的操作。这些数据的示例包括:配置为在电子设备上操作的任何计算机程序。The memory 3 in the embodiment of the present application is configured to store various types of data to support the operation of the electronic device. Examples of such data include: any computer program configured to operate on an electronic device.
可以理解,存储器可以是易失性存储器或非易失性存储器,也可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程只读存储器(EEPROM,Electrically Erasable Programmable Read-Only Memory)、磁性随机存取存储器(FRAM,ferromagnetic random access memory)、快闪存储器(Flash Memory)、磁表面存储器、光盘、或只读光盘(CD-ROM,Compact Disc Read-Only Memory);磁表面存储器可以是磁盘存储器或磁带存储器。易失性存储器可以是随机存取存储器(RAM,Random Access Memory),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(SRAM,Static Random Access Memory)、同步静态随机存取存储器(SSRAM,Synchronous Static Random Access Memory)、动态随机存取存储器(DRAM,Dynamic Random Access Memory)、同步动态随机存取存储器(SDRAM,Synchronous Dynamic Random Access Memory)、双倍数据速率同步动态随机存取存储器(DDRSDRAM,Double Data Rate Synchronous Dynamic Random Access Memory)、增强型同步动态随机存取存储器(ESDRAM,Enhanced Synchronous Dynamic Random Access Memory)、同步连接动态随机存取存储器(SLDRAM,SyncLink Dynamic Random Access Memory)、直接内存总线随机存取存储器(DRRAM,Direct Rambus Random Access Memory)。本申请实施例描述的存储器旨在包括但不限于这些和任意其它适合类型的存储器。It will be appreciated that the memory may be either volatile memory or non-volatile memory, and may include both volatile and non-volatile memory. Among them, the non-volatile memory can be a read-only memory (ROM, Read Only Memory), a programmable read-only memory (PROM, Programmable Read-Only Memory), an erasable programmable read-only memory (EPROM, Erasable Programmable Read-only memory) Only Memory), Electrically Erasable Programmable Read-Only Memory (EEPROM, Electrically Erasable Programmable Read-Only Memory), Magnetic Random Access Memory (FRAM, ferromagnetic random access memory), Flash Memory (Flash Memory), Magnetic Surface Memory , CD-ROM, or CD-ROM (Compact Disc Read-Only Memory); magnetic surface memory can be disk memory or tape memory. Volatile memory may be Random Access Memory (RAM), which is used as an external cache. By way of example and not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Synchronous Static Random Access Memory (SSRAM), Dynamic Random Access Memory Memory (DRAM, Dynamic Random Access Memory), Synchronous Dynamic Random Access Memory (SDRAM, Synchronous Dynamic Random Access Memory), Double Data Rate Synchronous Dynamic Random Access Memory (DDRSDRAM, Double Data Rate Synchronous Dynamic Random Access Memory), Enhanced Type Synchronous Dynamic Random Access Memory (ESDRAM, Enhanced Synchronous Dynamic Random Access Memory), Synchronous Link Dynamic Random Access Memory (SLDRAM, SyncLink Dynamic Random Access Memory), Direct Memory Bus Random Access Memory (DRRAM, Direct Rambus Random Access Memory) ). The memories described in the embodiments of the present application are intended to include, but not be limited to, these and any other suitable types of memories.
上述本申请实施例揭示的方法可以应用于处理器中,或者由处理器实现。处理器可能是一种集成电路芯片,具有信号的处理能力。在实现过程中,上述方法的各步骤可以通过处理器中的硬件的集成逻辑电路或者软件形式的指令完成。上述的处理器可以是通用处理器、DSP,或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。处理器可以实现或者执行本申请实施例中的公开的各方法、步骤及逻辑框图。通用处理器可以是微处理器或者任何常规的处理器等。结合本申请实施例所公开的方法的步骤,可以直接体现为硬件译码处理器执行完成,或者用译码处理器中的硬件及软件模块组合执行完成。软件模块可以位于存储介质中,该存储介质位于存储器,处理器读取存储器中的程序,结合其硬件完成前述方法的步骤。The methods disclosed in the above embodiments of the present application may be applied to a processor, or implemented by a processor. A processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above-mentioned method can be completed by a hardware integrated logic circuit in a processor or an instruction in the form of software. The above-mentioned processors may be general-purpose processors, DSPs, or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, and the like. The processor may implement or execute the methods, steps, and logical block diagrams disclosed in the embodiments of this application. A general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software module may be located in a storage medium, the storage medium is located in a memory, and the processor reads the program in the memory, and completes the steps of the foregoing method in combination with its hardware.
处理器执行所述程序时实现本申请实施例的各个方法中的相应流程,为了简洁,在此不再赘述。When the processor executes the program, the corresponding process in each method of the embodiments of the present application is implemented, which is not repeated here for brevity.
在示例性实施例中,本申请实施例还提供了一种存储介质,即计算机存储介质,具体为计算机可读存储介质,例如包括存储计算机程序的存储器,上述计算机程序可由处理器执行,以完成前述方法所述步骤。计算机可读存储介质可以是FRAM、ROM、PROM、EPROM、EEPROM、Flash Memory、磁表面存储器、光盘、或CD-ROM等存储器。In an exemplary embodiment, an embodiment of the present application further provides a storage medium, that is, a computer storage medium, specifically a computer-readable storage medium, for example, including a memory for storing a computer program, and the above-mentioned computer program can be executed by a processor to complete the steps described in the preceding method. The computer-readable storage medium may be memory such as FRAM, ROM, PROM, EPROM, EEPROM, Flash Memory, magnetic surface memory, optical disk, or CD-ROM.
在本申请所提供的几个实施例中,应该理解到,所揭露的装置、电子设备和方法,可以通过其它的方式实现。以上所描述的设备实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,如:多个单元或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的耦合、或直接耦合、或通信连接可以是通过一些接口,设备或单元的间接耦合或通信连接,可以是电性的、机械的或其它形式的。In the several embodiments provided in this application, it should be understood that the disclosed apparatus, electronic device and method may be implemented in other manners. The device embodiments described above are only illustrative. For example, the division of the units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components may be combined, or Can be integrated into another system, or some features can be ignored, or not implemented. In addition, the coupling, or direct coupling, or communication connection between the components shown or discussed may be through some interfaces, and the indirect coupling or communication connection of devices or units may be electrical, mechanical or other forms. of.
上述作为分离部件说明的单元可以是、或也可以不是物理上分开的,作为单元显示的部件可以是、或也可以不是物理单元,即可以位于一个地方,也可以分布到多个网络单元上;可以根据实际的需要选择其中的部分或全部单元来实现本实施例方案的目的。The unit described above as a separate component may or may not be physically separated, and the component displayed as a unit may or may not be a physical unit, that is, it may be located in one place or distributed to multiple network units; Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本申请各实施例中的各功能单元可以全部集成在一个处理单元中,也可以是各单元分别单独作为一个单元,也可以两个或两个以上单元集成在一个单元中;上述集成的单元既可以采用硬件的形式实现,也可以采用硬件加软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present application may all be integrated into one processing unit, or each unit may be separately used as a unit, or two or more units may be integrated into one unit; the above integration The unit can be implemented either in the form of hardware or in the form of hardware plus software functional units.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Those of ordinary skill in the art can understand that all or part of the steps of implementing the above method embodiments can be completed by program instructions related to hardware, the aforementioned program can be stored in a computer-readable storage medium, and when the program is executed, execute It includes the steps of the above method embodiments; and the aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other media that can store program codes.
或者,本申请上述集成的单元如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台电子设备(可以是个人计算机、服务器、或者网络设备等)执行本申请各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、RAM、磁碟或者光盘等各种可以存储程序代码的介质。Alternatively, if the above-mentioned integrated units of the present application are implemented in the form of software function modules and sold or used as independent products, they may also be stored in a computer-readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application can be embodied in the form of software products in essence or in the parts that make contributions to the prior art. The computer software products are stored in a storage medium and include several instructions for An electronic device (which may be a personal computer, a server, or a network device, etc.) is caused to execute all or part of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a removable storage device, a ROM, a RAM, a magnetic disk or an optical disk and other mediums that can store program codes.
需要说明的是:“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。It should be noted that "first", "second", etc. are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence.
另外,本申请实施例所记载的技术方案之间,在不冲突的情况下,可以任意组合。In addition, the technical solutions described in the embodiments of the present application may be combined arbitrarily unless there is a conflict.
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific embodiments of the present application, but the protection scope of the present application is not limited to this. should be covered within the scope of protection of this application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (20)

  1. 一种在音频接收端中接收音频数据包的方法,包括:A method for receiving audio data packets in an audio receiving end, comprising:
    通过透传方式从音频源接收音频源数据;Receive audio source data from the audio source through transparent transmission;
    从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;Receive the first audio data packet from the audio source, and store the first audio data packet in the first buffer area;
    对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;以及Encoding the audio source data to obtain a second audio data packet, and storing the second audio data packet into the second buffer area; and
    若满足预定条件,则基于所述音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。If a predetermined condition is met, the second audio data packet in the second buffer area is stored in the first buffer area based on the playback sequence of the audio data packets.
  2. 根据权利要求1所述的方法,其中,所述若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:The method according to claim 1, wherein, if a predetermined condition is met, the second audio data packet in the second buffer area is stored in the first buffer area based on the playback sequence of the audio data packets, include:
    在所述第一缓存区中存储的第一音频数据包的数量小于预定阈值的情况下,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the number of the first audio data packets stored in the first buffer area is less than a predetermined threshold, the second audio data packets in the second buffer area are stored in the first buffer area.
  3. 根据权利要求2所述的方法,其中,在所述第二缓存区中的第二音频数据包存入所述第一缓存区之后,所述方法还包括:The method according to claim 2, wherein after the second audio data packets in the second buffer area are stored in the first buffer area, the method further comprises:
    在所述第一缓存区中缓存的第一音频数据包大于或等于所述预定阈值的情况下,中止将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the first audio data packet buffered in the first buffer area is greater than or equal to the predetermined threshold, the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
  4. 根据权利要求1至3中任一项所述的方法,其中,所述对所述音频源数据编码得到第二音频数据包进一步包括:The method according to any one of claims 1 to 3, wherein the encoding the audio source data to obtain the second audio data packet further comprises:
    采用与所述音频源的编码方式相同的编码方式对所述音频源数据编码得到所述第二音频数据包。The second audio data packet is obtained by encoding the audio source data in the same encoding manner as the encoding manner of the audio source.
  5. 根据权利要求1至3中任一项所述的方法,其中,所述将所述第二音频数据包存入第二缓存区时,所述方法还包括:The method according to any one of claims 1 to 3, wherein, when the second audio data packet is stored in the second buffer area, the method further comprises:
    为所述第二音频数据包添加第一标识,所述第一标识用于标记所述音频接收端是否已播放了所述第二音频数据包对应的音频;A first identification is added for the second audio data packet, and the first identification is used to mark whether the audio receiver has played the audio corresponding to the second audio packet;
    所述将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:The storing of the second audio data packet in the second buffer area into the first buffer area includes:
    基于对应的第一标识和当前的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。Based on the corresponding first identifier and the current play sequence, the second audio data packet in the second buffer area is stored in the first buffer area.
  6. 根据权利要求1至3中任一项所述的方法,其中,所述将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:The method according to any one of claims 1 to 3, wherein the storing the second audio data packet in the second buffer area into the first buffer area comprises:
    基于所述音频接收端的音频播放速度确定第一周期;以及Determine the first period based on the audio playback speed of the audio receiver; and
    每隔所述第一周期,将所述第二缓存区中的第二音频数据包依次存入所述第一缓存区。Every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
  7. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1, wherein the method further comprises:
    若与所述音频源断开蓝牙连接,则将所述第二缓存区中的第二音频数据包存入所述第一缓存区进行播放。If the Bluetooth connection is disconnected from the audio source, the second audio data packet in the second buffer area is stored in the first buffer area for playback.
  8. 根据权利要求1所述的方法,其中,所述方法还包括:The method of claim 1, wherein the method further comprises:
    基于存入所述第一缓存区的第二音频数据包,播放对应的音频。Based on the second audio data packet stored in the first buffer area, the corresponding audio is played.
  9. 一种在音频源中发送音频数据包的方法,所述方法包括:A method of sending audio data packets in an audio source, the method comprising:
    对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;The audio source data is encoded to obtain the first audio data packet, and the first audio data packet is stored in the third buffer area;
    向音频接收端透传所述音频源数据;以及transparently transmit the audio source data to the audio sink; and
    从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。The first audio data packet is extracted from the third buffer area and sent to the audio receiving end.
  10. 根据权利要求9所述的方法,其中,所述从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端,包括:The method according to claim 9, wherein the extracting the first audio data packet from the third buffer area and sending it to the audio receiving end comprises:
    基于所述音频接收端的音频播放速度确定第一周期;以及,Determine the first cycle based on the audio playback speed of the audio receiver; and,
    每隔所述第一周期,从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端;At every first cycle, extract the first audio data packet from the third buffer area and send it to the audio receiver;
    所述向所述音频接收端透传所述音频源数据,包括:The transparent transmission of the audio source data to the audio receiving end includes:
    在所述第一音频数据包的发送间隙向所述音频接收端透传音频源数据。The audio source data is transparently transmitted to the audio receiving end in the transmission gap of the first audio data packet.
  11. 一种音频接收装置,包括:An audio receiving device, comprising:
    第一接收单元,配置为通过透传方式从音频源接收音频源数据;a first receiving unit, configured to receive audio source data from an audio source through transparent transmission;
    第二接收单元,配置为从所述音频源接收第一音频数据包,将所述第一音频数据包存入第一缓存区;a second receiving unit, configured to receive a first audio data packet from the audio source, and store the first audio data packet in a first buffer area;
    存储单元,配置为对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区;a storage unit, configured to encode the audio source data to obtain a second audio data packet, and store the second audio data packet in a second buffer area;
    播放单元,配置为若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。The playing unit is configured to store the second audio data packets in the second buffer area into the first buffer area based on the playing sequence of the audio data packets if a predetermined condition is satisfied.
  12. 根据权利要求11所述的音频接收装置,其中,所述播放单元在若满足预定条件,则基于音频数据包的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区时,还配置为:The audio receiving apparatus according to claim 11, wherein, if a predetermined condition is satisfied, the playback unit stores the second audio data packet in the second buffer area into the When the first buffer area is also configured as:
    在所述第一缓存区中存储的第一音频数据包的数量小于预定阈值的情况下,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the number of the first audio data packets stored in the first buffer area is less than a predetermined threshold, the second audio data packets in the second buffer area are stored in the first buffer area.
  13. 根据权利要求12所述的音频接收装置,其中,所述播放单元在所述第二缓存区中的第二音频数据包存入所述第一缓存区之后,还配置为:The audio receiving apparatus according to claim 12, wherein after the second audio data packet in the second buffer area is stored in the first buffer area, the playback unit is further configured to:
    在所述第一缓存区中缓存的第一音频数据包大于或等于所述预定阈值的情况下,中止将所述第二缓存区中的第二音频数据包存入所述第一缓存区。In the case that the first audio data packet buffered in the first buffer area is greater than or equal to the predetermined threshold, the storing of the second audio data packet in the second buffer area into the first buffer area is stopped.
  14. 根据权利要求11至13中任一项所述的音频接收装置,其中,所述存储单元在对所述音频源数据编码得到第二音频数据包,将所述第二音频数据包存入第二缓存区,还配置为:The audio receiving device according to any one of claims 11 to 13, wherein the storage unit encodes the audio source data to obtain a second audio data packet, and stores the second audio data packet in the second audio data packet. The cache area is also configured as:
    采用与所述音频源的编码方式相同的编码方式对所述音频源数据编码得到所述第二音频数据包。The second audio data packet is obtained by encoding the audio source data in the same encoding manner as the encoding manner of the audio source.
  15. 根据权利要求11至13中任一项所述的音频接收装置,其中,所述存储单元在将所述第二音频数据包存入第二缓存区时,还配置为:The audio receiving apparatus according to any one of claims 11 to 13, wherein, when the storage unit stores the second audio data packet in the second buffer area, it is further configured to:
    为所述第二音频数据包添加第一标识,所述第一标识用于标记所述音频接收端是否已播放了所述第二音频数据包对应的音频;A first identification is added for the second audio data packet, and the first identification is used to mark whether the audio receiver has played the audio corresponding to the second audio packet;
    所述将所述第二缓存区中的第二音频数据包存入所述第一缓存区,包括:The storing of the second audio data packet in the second buffer area into the first buffer area includes:
    基于对应的第一标识和当前的播放顺序,将所述第二缓存区中的第二音频数据包存入所述第一缓存区。Based on the corresponding first identifier and the current play sequence, the second audio data packet in the second buffer area is stored in the first buffer area.
  16. 根据权利要求11至13中任一项所述的音频接收装置,其中,所述存储单元在将所述第二缓存区中的第二音频数据包存入所述第一缓存区时,还配置为:The audio receiving device according to any one of claims 11 to 13, wherein, when the storage unit stores the second audio data packets in the second buffer area into the first buffer area, the storage unit is further configured to for:
    基于所述音频接收端的音频播放速度确定第一周期;以及Determine the first period based on the audio playback speed of the audio receiver; and
    每隔所述第一周期,将所述第二缓存区中的第二音频数据包依次存入所述第一缓存区。Every first cycle, the second audio data packets in the second buffer area are sequentially stored in the first buffer area.
  17. 根据权利要求11所述的音频接收装置,其中,所述装置还配置为:The audio receiving apparatus of claim 11, wherein the apparatus is further configured to:
    若与所述音频源断开蓝牙连接,则将所述第二缓存区中的第二音频数据包存入所述第一缓存区进行播放。If the Bluetooth connection is disconnected from the audio source, the second audio data packet in the second buffer area is stored in the first buffer area for playback.
  18. 一种音频发送装置,包括:An audio transmission device, comprising:
    编码单元,配置为对音频源数据编码得到第一音频数据包,将所述第一音频数据包存入第三缓存区;an encoding unit, configured to encode the audio source data to obtain a first audio data packet, and store the first audio data packet in a third buffer area;
    第一传输单元,配置为向所述音频接收端透传所述音频源数据;a first transmission unit, configured to transparently transmit the audio source data to the audio receiving end;
    第二传输单元,配置为从所述第三缓存区提取出所述第一音频数据包并发送至所述音频接收端。The second transmission unit is configured to extract the first audio data packet from the third buffer area and send it to the audio receiving end.
  19. 一种电子设备,包括:处理器和配置为存储能够在处理器上运行的计算机程序的存储器,An electronic device comprising: a processor and a memory configured to store a computer program executable on the processor,
    其中,所述处理器配置为运行所述计算机程序时,执行权利要求1至8或9至10任一项所述方法的步骤。Wherein, the processor is configured to execute the steps of the method of any one of claims 1 to 8 or 9 to 10 when running the computer program.
  20. 一种存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至8或9至10中任一项所述方法的步骤。A storage medium having a computer program stored thereon, the computer program implementing the steps of the method of any one of claims 1 to 8 or 9 to 10 when executed by a processor.
PCT/CN2022/084598 2021-04-13 2022-03-31 Method and apparatus for receiving audio data packet, method and apparatus for sending audio data packet, and electronic device WO2022218165A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202110395397.9 2021-04-13
CN202110395397.9A CN113131972B (en) 2021-04-13 2021-04-13 Method, device, electronic equipment and storage medium for receiving and transmitting audio data packet

Publications (1)

Publication Number Publication Date
WO2022218165A1 true WO2022218165A1 (en) 2022-10-20

Family

ID=76776105

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/084598 WO2022218165A1 (en) 2021-04-13 2022-03-31 Method and apparatus for receiving audio data packet, method and apparatus for sending audio data packet, and electronic device

Country Status (2)

Country Link
CN (1) CN113131972B (en)
WO (1) WO2022218165A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113131972B (en) * 2021-04-13 2022-04-15 Oppo广东移动通信有限公司 Method, device, electronic equipment and storage medium for receiving and transmitting audio data packet
CN114173426B (en) * 2021-11-30 2023-09-29 广州番禺巨大汽车音响设备有限公司 Wireless sound box playing control method, device and system based on wireless audio transmission

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333752A (en) * 2014-11-25 2015-02-04 杭州海康威视数字技术股份有限公司 Audio quality diagnostic method and device
CN105429983A (en) * 2015-11-27 2016-03-23 刘军 Media data acquisition method, media terminal and music teaching system
CN105611317A (en) * 2016-01-18 2016-05-25 北京流金岁月文化传播股份有限公司 Video-audio transcoding device and method capable of supporting audio unvarnished transmission
US20190373032A1 (en) * 2018-06-01 2019-12-05 Apple Inc. Adaptive and seamless playback buffer adjustment for streaming content
CN110661992A (en) * 2018-06-29 2020-01-07 视联动力信息技术股份有限公司 Data processing method and device
CN111385780A (en) * 2020-01-17 2020-07-07 北京塞宾科技有限公司 Bluetooth audio signal transmission method and device
CN113131972A (en) * 2021-04-13 2021-07-16 Oppo广东移动通信有限公司 Method, device and electronic equipment for receiving and sending audio data packet

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2001043603A (en) * 1999-07-29 2001-02-16 Pioneer Electronic Corp Music apparatus
CN103747317B (en) * 2013-12-27 2017-03-15 高新兴科技集团股份有限公司 A kind of smooth playing control method of broadcasting storehouse under unstable network
CN105635804B (en) * 2014-11-04 2019-08-16 深圳Tcl新技术有限公司 A kind of wireless audio transmission method and system
CN105791961B (en) * 2014-12-23 2018-12-07 深圳Tcl数字技术有限公司 Terminal and the radio transmitting method and system for surrounding audio data between sound equipment
CN107911729A (en) * 2017-10-23 2018-04-13 广州市百果园网络科技有限公司 Internet video playback method and terminal
CN108495177B (en) * 2018-03-30 2021-07-13 北京世纪好未来教育科技有限公司 Audio frequency speed change processing method and device
CN109981590A (en) * 2019-02-28 2019-07-05 浙江工业大学 A kind of stream medium audio and video synchronous broadcast method based on B/S framework
CN110503935B (en) * 2019-07-16 2020-11-06 北京达佳互联信息技术有限公司 Audio data processing method and device, electronic equipment and storage medium
CN110634511B (en) * 2019-09-27 2021-09-14 北京西山居互动娱乐科技有限公司 Audio data processing method and device
CN112105006A (en) * 2019-12-12 2020-12-18 炬力(珠海)微电子有限公司 Bluetooth device playing method and device

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104333752A (en) * 2014-11-25 2015-02-04 杭州海康威视数字技术股份有限公司 Audio quality diagnostic method and device
CN105429983A (en) * 2015-11-27 2016-03-23 刘军 Media data acquisition method, media terminal and music teaching system
CN105611317A (en) * 2016-01-18 2016-05-25 北京流金岁月文化传播股份有限公司 Video-audio transcoding device and method capable of supporting audio unvarnished transmission
US20190373032A1 (en) * 2018-06-01 2019-12-05 Apple Inc. Adaptive and seamless playback buffer adjustment for streaming content
CN110661992A (en) * 2018-06-29 2020-01-07 视联动力信息技术股份有限公司 Data processing method and device
CN111385780A (en) * 2020-01-17 2020-07-07 北京塞宾科技有限公司 Bluetooth audio signal transmission method and device
CN113131972A (en) * 2021-04-13 2021-07-16 Oppo广东移动通信有限公司 Method, device and electronic equipment for receiving and sending audio data packet

Also Published As

Publication number Publication date
CN113131972A (en) 2021-07-16
CN113131972B (en) 2022-04-15

Similar Documents

Publication Publication Date Title
WO2022218165A1 (en) Method and apparatus for receiving audio data packet, method and apparatus for sending audio data packet, and electronic device
US11681452B2 (en) Memory access technology and computer system
WO2019148563A1 (en) Data sending method and apparatus, and data receiving method and apparatus
KR102173089B1 (en) Interface circuit and packet transmission method thereof
US11784756B2 (en) Memory access technology and computer system
CN111314217B (en) Multilink transmission system
US9420022B2 (en) Media requests to counter latency and minimize network bursts
CN111107017A (en) Method, equipment and storage medium for processing switch message congestion
CN111352889A (en) Equipment management method, equipment, device and medium based on MCTP (Multi-port technology protocol)
WO2019057005A1 (en) Data check method, device and network card
JP2017519406A (en) Network video playback method and apparatus
EP3995961A1 (en) Storage system and operating method thereof
WO2020001315A1 (en) Method and apparatus for detecting video playing quality
WO2019134499A1 (en) Method and device for labeling video frames in real time
WO2024061005A1 (en) Read processing method and apparatus for audio and video buffer
US20190020847A1 (en) Method and system for pushing audio data
CN114513472A (en) Network congestion control method and device
CN110765059A (en) PCIE data priority management method and device
CN114780465A (en) Method and device for creating sharable remote direct data access link
CN112286454B (en) Bitmap synchronization method and device, electronic equipment and storage medium
CN112270919A (en) Method, system, storage medium and electronic device for automatically complementing sound of video conference
CN112449208A (en) Voice processing method and device
US20180034749A1 (en) System and method for distributing and replaying trigger packets via a variable latency bus interconnect
CN110798366A (en) Task logic processing method, device and equipment
CN110990313B (en) Method, equipment and storage medium for processing clock stretching of I3C bus

Legal Events

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

Ref document number: 22787392

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 22787392

Country of ref document: EP

Kind code of ref document: A1