Audio data transmission method, electronic device and storage medium
By using Bluetooth radio frequency modules, controllers and codecs in electronic devices to directly process audio data packets, the complexity and delay problems of audio data transmission between single-mode Bluetooth devices are solved, and efficient audio data transmission and low power consumption are achieved. .
Patent Information
- Application Number
- CN202110056494.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-01-15
- Publication Date
- 2024-08-23
- Estimated Expiration
- 2041-01-15
AI Technical Summary
When audio data is transmitted between different types of single-mode Bluetooth devices, the process is complex and the delay is long, the transmission efficiency is low, and the host needs to be woken up during the audio data conversion process, which increases the power consumption of the device.
By introducing Bluetooth radio frequency modules, controllers and codecs into electronic devices, directly connect and use the controller to extract the initial audio data in the audio data packet, and convert it into target audio data through the codec to generate target audio New packets of data are sent directly to the target device, preventing the host from participating in data packet encapsulation and unpacking processing.
It simplifies the audio data transmission process, improves processing efficiency, reduces device power consumption, avoids host wake-up during audio data conversion, improves transmission efficiency, and reduces power consumption.
Smart Images

Figure CN114765761B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of Bluetooth, and in particular to an audio data transmission method, electronic equipment and storage medium. Background Art
[0002] Bluetooth is a short-range wireless technology, also known as the incredible connection, that supports a variety of network topologies, including point-to-point, broadcast and mesh networks. Bluetooth brings the convenience of short-range wireless connection and transmission between electronic devices, giving devices such as mobile phones, tablets, laptops, cameras and other various digital products a stronger connection.
[0003] Bluetooth modules can be mainly divided into two types according to applications and supported protocols: Classic Bluetooth (BT) and Bluetooth Low Energy (BLE). When transmitting audio data between different types of single-mode Bluetooth devices, it is often necessary to forward the audio data through a dual-mode Bluetooth device. At present, the process of audio data transmission between different types of single-mode Bluetooth devices by dual-mode Bluetooth devices is relatively cumbersome and complicated, often with delay problems, low transmission efficiency and high power consumption. Summary of the invention
[0004] The embodiments of the present application provide a method for transmitting audio data, an electronic device and a storage medium, which can effectively simplify the data transmission process and greatly improve the processing efficiency. At the same time, the host is no longer woken up during the audio data conversion process, which can reduce the power consumption of the device.
[0005] The technical solution of the embodiment of the present application is implemented as follows:
[0006] In a first aspect, an embodiment of the present application provides a method for transmitting audio data for an electronic device, wherein the electronic device includes a Bluetooth radio frequency module, a controller, and a codec, and the controller is directly connected to the Bluetooth radio frequency module and the codec, respectively, and the method includes:
[0007] Receiving a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module;
[0008] extracting the initial audio data in the first audio data packet by the controller;
[0009] Converting the initial audio data into target audio data based on a second Bluetooth protocol through the codec;
[0010] generating, by the controller, a second audio data packet carrying the target audio data; and
[0011] The second audio data packet is sent to the second Bluetooth device through the Bluetooth radio frequency module.
[0012] In a second aspect, an embodiment of the present application provides an electronic device, the electronic device comprising a Bluetooth radio module, a controller and a codec,
[0013] The Bluetooth radio frequency module is used to receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device;
[0014] The controller is directly connected to the Bluetooth radio module and the codec, respectively, and is used to extract the initial audio data in the first audio data packet;
[0015] The codec is used to convert the initial audio data into target audio data based on a second Bluetooth protocol;
[0016] The controller is further used to generate a second audio data packet carrying the target audio data;
[0017] The Bluetooth radio frequency module is further used to send the second audio data packet to the second Bluetooth device.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, which includes a Bluetooth radio frequency module, a controller and a codec, wherein the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, and the electronic device also includes a processor and a memory storing instructions executable by the processor. When the instructions are executed by the processor, the audio data transmission method described above is implemented.
[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having a program stored thereon, and when the program is executed by a processor, the method for transmitting audio data as described above is implemented.
[0020] The embodiment of the present application provides a method for transmitting audio data, an electronic device and a storage medium, and the transmission method is applied to an electronic device, wherein the electronic device includes a Bluetooth radio frequency module, a controller and a codec, the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, and the electronic device receives a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extracts the initial audio data in the first audio data packet through the controller; converts the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generates a second audio data packet carrying the target audio data through the controller; and sends the second audio data packet to a second Bluetooth device through the Bluetooth radio frequency module. It can be seen that in the embodiment of the present application, after receiving a data packet sent by a single-mode Bluetooth device, the controller in the electronic device can complete the extraction of the initial audio data and the encapsulation of the target audio data, and can directly transmit data with the codec, and send the converted data packet to another single-mode Bluetooth device, thereby effectively simplifying the data transmission process and greatly improving the processing efficiency. At the same time, the host is no longer awakened during the audio data conversion process, which can reduce the power consumption of the device. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] Figure 1 A schematic diagram for sending audio data;
[0022] Figure 2 Schematic diagram of the structure of electronic equipment Figure 1 ;
[0023] Figure 3 Schematic diagram of the implementation process of the audio data transmission method Figure 1 ;
[0024] Figure 4 Schematic diagram of the implementation process of the audio data transmission method Figure 2 ;
[0025] Figure 5 Schematic diagram of the implementation process of the audio data transmission method Figure 3 ;
[0026] Figure 6 Implementation framework for transmitting audio data Figure 1 ;
[0027] Figure 7 Implementation framework for transmitting audio data Figure 2 ;
[0028] Figure 8 Schematic diagram of the structure of electronic equipment Figure 2 ;
[0029] Fig. 9 Schematic diagram of the structure of electronic equipment Figure 3. DETAILED DESCRIPTION
[0030] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. It is understood that the specific embodiments described herein are only used to explain the related applications, rather than to limit the applications. It should also be noted that, for ease of description, only the parts related to the related applications are shown in the drawings.
[0031] Bluetooth is a short-range wireless technology, also known as the incredible connection, that supports a variety of network topologies, including point-to-point, broadcast and mesh networks. It brings the convenience of short-range wireless connection and transmission between electronic devices. With nearly 4 billion devices using Bluetooth connection, it has a huge range of use, giving our mobile phones, tablets, laptops, cameras and other digital products a stronger connection.
[0032] Bluetooth wireless technology is currently divided into two types of technology: Basic Rate (BR) / Enhanced Data Rate (EDR) (also known as classic Bluetooth) and Low Energy (LE). Among them, BR / EDR type is used for audio and streaming applications, and creates one-to-one device communication based on a point-to-point network topology; LE type is mostly used for battery-operated sensor devices, using a variety of network topologies such as point-to-point (one-to-one), broadcast (one-to-many) and mesh (many-to-many).
[0033] Existing Bluetooth technology, especially classic Bluetooth technology, mainly transmits audio data through the Bluetooth audio transmission protocol (Advanced Audio Distribution Profile, A2DP protocol). For example, in a mobile phone, the encoder (Encoder) in the audio codec (Audio Encoder and Decoder, Audio Codec) converts the audio data encoded by Pulse Code Modulation (Pulse Code Modulation, PCM) into the target format, and the host (Host) frames the encoded data according to the A2DP protocol. The host then sends the framed A2DP protocol data frame to the controller (Controller) through the host controller interface (HCI) interface, and the controller sends the data to the peer device, which is usually a Bluetooth headset.
[0034] A single-mode Bluetooth module is a Bluetooth module that only supports classic Bluetooth (EDR / BDR) or only supports low-power Bluetooth (BLE), while a dual-mode Bluetooth module is a module that supports both classic Bluetooth (EDR / BDR) and low-power Bluetooth (BLE).
[0035] Since classic Bluetooth and Bluetooth low energy are very different in connection methods, data communication, etc., single-mode Bluetooth low energy devices cannot directly transmit data with single-mode classic Bluetooth devices. If single-mode Bluetooth low energy devices and single-mode classic Bluetooth devices need to transmit audio data, they can only use dual-mode Bluetooth devices to convert audio data. This is because dual-mode Bluetooth devices support both classic Bluetooth and Bluetooth low energy, so they can communicate with single-mode Bluetooth low energy devices and single-mode classic Bluetooth devices respectively.
[0036] For example, Figure 1 A schematic diagram of sending audio data is shown in FIG. Figure 1 As shown in the figure, if a low-power single-mode Bluetooth device is supported as an audio source device (Audio Source), and a classic single-mode Bluetooth device is supported as a target device (AudioSink). The audio source (Audio Source) device that supports low-power single-mode Bluetooth can only transmit audio data through a low-power Bluetooth link, such as an ACL link or a low-power Bluetooth isochronous channel (ISOL). After the Bluetooth RF module in the Bluetooth Dual Mode Device receives the audio data packet from the low-power Bluetooth single-mode AudioSource device, it needs to send the data packet to the Bluetooth controller Controller for link layer (Link Layer) analysis. After the analysis is completed, the Controller sends the data packet to the Bluetooth host Host through the HCI interface. After the Bluetooth host Host performs relevant protocol unpacking, it passes the encoded audio data to the codec Audio Codec module for decoding (Decode).
[0037] After the Audio Codec completes decoding, it obtains the decoded PCM data packet, and then encodes (Encode) the PCM data packet again according to the Codec configuration of the classic Bluetooth Audio Sink device and sends it to the Bluetooth host Host. After the Bluetooth host Host encapsulates the data packet of the A2DP protocol and the Logical Link Control and Adaptation Protocol (L2CAP protocol), the Bluetooth host Host transmits the data packet to the Bluetooth controller Controller through the HCI interface. The Bluetooth controller Controller sends the relevant data packet to the Bluetooth RF module responsible for transmission and reception, thereby completing the transmission of audio data to the Audio Sink.
[0038] It can be seen that when transmitting audio data between different types of single-mode Bluetooth devices, a relatively complex audio data conversion process is required, which takes a long time to process. At the same time, when converting audio data, the host needs to be awakened, which increases the power consumption of the device.
[0039] In order to solve the above problems, in an embodiment of the present application, after receiving a data packet sent by a single-mode Bluetooth device, the controller in the electronic device can complete the extraction of initial audio data and the encapsulation of target audio data, and can directly transmit data with the codec, and send the converted data packet to another single-mode Bluetooth device, thereby effectively simplifying the data transmission process and greatly improving processing efficiency. At the same time, the host is no longer woken up during the audio data conversion process, which can reduce device power consumption.
[0040] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.
[0041] An embodiment of the present application provides a method for transmitting audio data, which can be applied to an electronic device, wherein the electronic device is configured with a Bluetooth radio frequency module, a controller and a codec, and the controller is directly connected to the Bluetooth radio frequency module and the codec respectively.
[0042] It should be noted that, in the embodiments of the present application, the electronic device may be an electronic device supporting dual-mode Bluetooth.
[0043] Figure 2 Schematic diagram of the structure of electronic equipment Figure 1 ,like Figure 2 As shown, the electronic device 10 may include a Bluetooth radio module 11, a controller 12, a codec 13 and a host 14, wherein the device in the controller 12 has a parsing and encapsulation submodule 121 for performing disassembly and encapsulation processing. Specifically, the parsing and encapsulation submodule 121 can support the A2DP protocol, the L2CAP protocol, the Isochronous Adaptation Layer (ISOAL) and other Bluetooth audio transmission protocols, that is, the parsing and encapsulation submodule 121 can parse and encapsulate audio data packets based on the A2DP protocol, the L2CAP protocol, the ISOAL and other Bluetooth audio transmission protocols respectively.
[0044] Furthermore, in an embodiment of the present application, the controller 12 in the electronic device 10 can directly establish connections with the Bluetooth RF module 11 and the codec 13, respectively, that is, the controller 12 can directly receive and send data with the Bluetooth RF module 11 and the codec 13, respectively.
[0045] Figure 3Schematic diagram of the implementation process of the audio data transmission method Figure 1 ,like Figure 3 As shown, in an embodiment of the present application, the method for transmitting audio data by an electronic device may include the following steps:
[0046] Step 101: Receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through a Bluetooth radio frequency module.
[0047] Step 102: extracting initial audio data from a first audio data packet through a controller.
[0048] In an embodiment of the present application, the electronic device may first receive a first audio data packet sent by a first Bluetooth device through a configured Bluetooth radio frequency module, wherein the Bluetooth radio frequency module may receive the first audio data packet sent by the first Bluetooth device based on a first Bluetooth protocol.
[0049] Furthermore, in the present application, after receiving a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device, the Bluetooth radio frequency module in the electronic device may continue to extract initial audio data in the first audio data packet through a configured controller.
[0050] It should be noted that, in the embodiments of the present application, the electronic device may be any dual-mode Bluetooth device, that is, the electronic device may support both low-power Bluetooth and classic Bluetooth.
[0051] Exemplarily, in the embodiments of the present application, the electronic device can perform encoding and decoding processing according to the configuration supported by low-power Bluetooth, or can perform encoding and decoding processing according to the configuration supported by classic Bluetooth, including but not limited to: tablet computers, mobile phones, e-readers, personal computers (PersonaLComputer, PC), laptops, vehicle-mounted devices, wearable devices, etc.
[0052] It should be noted that, in the embodiments of the present application, the first Bluetooth device may be any device that only supports low-power Bluetooth or classic Bluetooth. For example, the first Bluetooth device is a Bluetooth headset that only supports low-power Bluetooth, or the first Bluetooth device is a Bluetooth headset that only supports classic Bluetooth.
[0053] Accordingly, in an embodiment of the present application, the first Bluetooth protocol is a Bluetooth protocol supported by the first Bluetooth device. Specifically, if the first Bluetooth device is a classic Bluetooth device, then the first Bluetooth protocol is the classic Bluetooth protocol. If the first Bluetooth device is a low-power Bluetooth device, then the first Bluetooth protocol is the low-power Bluetooth protocol. Exemplarily, the first Bluetooth protocol may be an A2DP protocol or an L2CAP protocol.
[0054] For example, in this application, the Bluetooth radio module may be a Bluetooth Radio, which is mainly responsible for sending and receiving data and voice. The Bluetooth radio specification specifies parameters such as the Bluetooth radio frequency band, modulation mode, frequency modulation frequency, transmission power, and receiving sensitivity.
[0055] Exemplarily, in the present application, the controller is a Bluetooth Controller, wherein, for a dual-mode Bluetooth device, the Bluetooth Controller may include a radio frequency layer (Radio Frequency, RF), a baseband layer (baseband), a link manager protocol (Link Manager Protocol, LMP), a physical layer (Physical, PHY), a link layer (Link Layer), etc.
[0056] It should be noted that in the embodiments of the present application, since the device in the controller has a parsing and encapsulation sub-module that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, the controller can not only perform link layer parsing processing, but also perform audio data disassembly processing based on different protocols.
[0057] It can be understood that in an embodiment of the present application, after receiving the first audio data packet sent by the first Bluetooth device, the Bluetooth RF module of the electronic device can send the first audio data packet to the controller, and then the controller performs link layer analysis on the first audio data packet to obtain the parsed data packet, and then uses the parsing and encapsulation submodule configured by the controller to disassemble and process the parsed data packet, and finally the initial audio data in the first audio data packet can be obtained.
[0058] Specifically, the format of the initial audio data is a data format supported by the first Bluetooth device.
[0059] Figure 4 Schematic diagram of the implementation process of the audio data transmission method Figure 2 ,like Figure 4 As shown, in an embodiment of the present application, before the electronic device receives a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module, that is, before step 101, the method for transmitting audio data by the electronic device may further include the following steps:
[0060] Step 106: Establish a communication connection with the first Bluetooth device.
[0061] In an embodiment of the present application, the electronic device may first establish a communication connection with the first Bluetooth device, so as to receive a first audio data packet sent by the first Bluetooth device based on the first Bluetooth protocol.
[0062] It should be noted that, in the embodiments of the present application, the categories of the first Bluetooth device are different, and the types of physical links used by the electronic device to receive the first audio data packet are also different. For example, if the first Bluetooth device is a low-power Bluetooth device, then the first Bluetooth device can transmit the first audio data packet through a physical link of a type that supports low-power Bluetooth. For example, if the first Bluetooth device is a low-power Bluetooth single-mode device, then the electronic device can receive the first audio data packet sent by the first Bluetooth device through an ISOL link; if the first Bluetooth device is a classic Bluetooth single-mode device, then the electronic device can receive the first audio data packet sent by the first Bluetooth device through an ACL link.
[0063] Accordingly, in an embodiment of the present application, the electronic device may also establish a communication connection with the second Bluetooth device, thereby sending an audio data packet to the second Bluetooth device based on the second Bluetooth protocol.
[0064] It should be noted that, in the embodiments of the present application, the categories of the second Bluetooth device are different, and the types of physical links used by the electronic device to send the second audio data packet to the second Bluetooth device are also different. For example, if the second Bluetooth device is a low-power Bluetooth device, the electronic device can transmit the second audio data packet to the second Bluetooth device through a physical link of a type that supports low-power Bluetooth. For example, if the second Bluetooth device is a low-power Bluetooth single-mode device, the electronic device can send the second audio data packet to the second Bluetooth device through an ISOL link; if the second Bluetooth device is a classic Bluetooth single-mode device, the electronic device can send the second audio data packet to the second Bluetooth device through an ACL link.
[0065] It can be seen that in the present application, since the parsing and encapsulation submodule configured by the controller is capable of realizing the disassembly and processing of the data packet, the initial audio data can be directly extracted from the first audio data packet through the controller without waking up the host to perform data disassembly and processing, thereby simplifying the processing flow and saving power consumption.
[0066] Step 103: Convert the initial audio data into target audio data based on the second Bluetooth protocol through a codec.
[0067] In an embodiment of the present application, after the electronic device extracts the initial audio data in the first audio data packet through the controller, the initial audio data can be converted into target audio data based on the second Bluetooth protocol through the codec.
[0068] Furthermore, in an embodiment of the present application, after the parsing and encapsulation submodule configured by the controller in the electronic device extracts the initial audio data in the first audio data packet, the controller can send the initial audio data to the codec, so that the initial audio data can be encoded and decoded by the codec, thereby completing the data format conversion and obtaining the target audio data based on the second Bluetooth protocol.
[0069] Specifically, the format of the target audio data is a data format supported by the second Bluetooth device, so after completing the conversion from the initial audio data to the target audio data, the electronic device can send a data packet carrying the target audio data to the second Bluetooth device.
[0070] It can be understood that in an embodiment of the present application, the format of the initial audio data is different from the format of the target audio data, that is, the data formats supported by the first Bluetooth device and the second Bluetooth device are different, and accordingly, the compilation configuration parameters supported by the first Bluetooth device and the second Bluetooth device are different.
[0071] Furthermore, in an embodiment of the present application, when the electronic device converts the initial audio data into target audio data based on the second Bluetooth protocol through the codec, it can first decode the initial audio data through the codec based on the compilation configuration parameters corresponding to the first Bluetooth device to obtain decoded data; and then encode the decoded data through the codec based on the compilation configuration parameters corresponding to the second Bluetooth device to obtain the target audio data.
[0072] It can be understood that, in the embodiment of the present application, the decoded data can be in the PCM original audio data format.
[0073] It can be seen that in the present application, since the parsing and encapsulation submodule configured by the controller is capable of realizing the disassembly and processing of the data packet, the initial audio data can be directly extracted from the first audio data packet through the controller. At the same time, the codec connected to the controller can directly obtain the disassembled initial audio data from the controller, instead of obtaining the disassembled data from the host.
[0074] It should be noted that, in the embodiments of the present application, the second Bluetooth device is a single-mode Bluetooth device different from the first Bluetooth device. Specifically, the second Bluetooth device can be any device that only supports low-power Bluetooth or classic Bluetooth. For example, the second Bluetooth device is a Bluetooth headset that only supports low-power Bluetooth, or the second Bluetooth device is a Bluetooth speaker that only supports classic Bluetooth.
[0075] For example, in the present application, if the first Bluetooth device is a low-power Bluetooth device, the second Bluetooth device may be a classic Bluetooth device; correspondingly, if the first Bluetooth device is a classic Bluetooth device, the second Bluetooth device may be a low-power Bluetooth device. That is, the electronic device in the embodiment of the present application is used to forward audio data between the first Bluetooth device and the second Bluetooth device.
[0076] It is understood that, in the embodiment of the present application, the second Bluetooth protocol is a Bluetooth protocol supported by the second Bluetooth device. Specifically, if the second Bluetooth device is a classic Bluetooth device, then the second Bluetooth protocol is the classic Bluetooth protocol. If the second Bluetooth device is a low-power Bluetooth device, then the second Bluetooth protocol is the low-power Bluetooth protocol. Exemplarily, the second Bluetooth protocol can be the A2DP protocol or the L2CAP protocol.
[0077] That is, since the first Bluetooth device and the second Bluetooth device are devices supporting different Bluetooth protocols, the first Bluetooth protocol is different from the second Bluetooth protocol.
[0078] It should be noted that, in the present application, since the target audio data is transmitted to the second Bluetooth device, the codec can complete the encoding processing of the decoded data according to the Bluetooth protocol supported by the second Bluetooth device to generate the target audio data.
[0079] Step 104: Generate a second audio data packet carrying target audio data through a controller.
[0080] In an embodiment of the present application, after the electronic device converts the initial audio data into target audio data based on the second Bluetooth protocol through the codec, it can continue to generate a second audio data packet carrying the target audio data through the controller.
[0081] Furthermore, in an embodiment of the present application, since the controller is configured with a parsing and encapsulation sub-module that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, the target audio data obtained by conversion processing through the codec can be directly sent to the controller for further encapsulation processing.
[0082] It is understandable that, in the embodiment of the present application, since the target audio data is transmitted to the second Bluetooth device, the parsing and encapsulation submodule can complete the encapsulation processing of the target audio data according to the Bluetooth protocol supported by the second Bluetooth device to generate a second audio data packet. In other words, the first audio data packet can be generated by encapsulating the Bluetooth protocol supported by the first Bluetooth device, and the second audio data packet can be generated by encapsulating the Bluetooth protocol supported by the second Bluetooth device.
[0083] Exemplarily, in an embodiment of the present application, if the second Bluetooth device is a classic Bluetooth device, then the electronic device can encapsulate the target audio data into data packets of the A2DP protocol and the L2CAP protocol through the parsing encapsulation submodule, and finally generate a second audio data packet to be transmitted to the classic Bluetooth device.
[0084] Specifically, the L2CAP protocol is located above the baseband, converts the baseband data packets into a data packet format that is convenient for high-level applications, and provides functions such as protocol multiplexing and quality of service exchange. The L2CAP protocol only supports ACL data transmission, not SCO data.
[0085] That is to say, in the present application, when the electronic device generates a second audio data packet carrying the target audio data through the controller, it can directly use the parsing and encapsulation submodule to encapsulate the target audio data, thereby obtaining the second audio data packet.
[0086] Step 105: Send the second audio data packet to the second Bluetooth device through the Bluetooth radio frequency module.
[0087] In an embodiment of the present application, after the electronic device generates a second audio data packet carrying target audio data through a controller, the electronic device can send the second audio data packet to a second Bluetooth device through a Bluetooth radio frequency module.
[0088] Furthermore, in an embodiment of the present application, the controller in the electronic device may send the generated second audio data packet to the Bluetooth radio frequency module, and then the Bluetooth radio frequency module sends the second audio data packet to the second Bluetooth device.
[0089] It can be understood that in the present application, since the encapsulation processing of the second audio data packet is directly completed by the parsing and encapsulation submodule in the controller, after completing the generation of the second audio data packet, the controller can directly send the second audio data packet to the Bluetooth radio frequency module. Compared with the current common technical means, there is no need to encapsulate the data packet through the host, and after completing the encapsulation processing, the controller does not need to send the data packet to the Bluetooth radio frequency module after receiving the data packet sent by the host through the HCI interface, thereby simplifying the processing flow of data packet transmission, which not only improves the transmission efficiency but also reduces power consumption.
[0090] Further, in an embodiment of the present application, the electronic device may send a second audio data packet through a physical link corresponding to a second Bluetooth device. Among them, for different second Bluetooth devices, the type of corresponding physical link is also different. That is to say, the category of the second Bluetooth device is different, and the type of physical link used by the electronic device to send the second audio data packet is also different. Specifically, if the second Bluetooth device is a classic Bluetooth device, then the second Bluetooth device can transmit the second audio data packet through a physical link of a type that supports classic Bluetooth. For example, if the second Bluetooth device is a low-power Bluetooth single-mode device, then the electronic device can send the second audio data packet to the second Bluetooth device through an ISOL link; if the second Bluetooth device is a classic Bluetooth single-mode device, then the electronic device can send the second audio data packet to the second Bluetooth device through an ACL link.
[0091] That is to say, in the embodiment of the present application, since the first Bluetooth device and the second Bluetooth device are different single-mode Bluetooth devices, the physical links used by the electronic device when receiving the audio data packet and sending the audio data packet are different. Specifically, if the first Bluetooth device is a low-power Bluetooth device and the second Bluetooth device is a classic Bluetooth device, the electronic device can receive the first audio data packet through the first physical link; and then send the second audio data packet through the second physical link. If the first Bluetooth device is a classic Bluetooth device and the second Bluetooth device is a low-power Bluetooth device, the electronic device can receive the first audio data packet through the second physical link; and then send the second audio data packet through the first physical link.
[0092] The first physical link is a link supporting data transmission of low-power Bluetooth, and the second physical link is a link supporting data transmission of classic Bluetooth.
[0093] It can be understood that in the embodiments of the present application, when transmitting audio data, the controller in the electronic device can complete the parsing and encapsulation of the audio data packet by parsing the configuration of the encapsulation sub-module, so that the data conversion processing is no longer required through the host. Furthermore, when performing the extraction processing of the initial audio data and the generation processing of the target audio data, the electronic device may not wake up the host, thereby reducing power consumption.
[0094] That is to say, in the embodiment of the present application, since the controller is configured with a parsing and encapsulation sub-module that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, the electronic device can directly parse and encapsulate the audio data packets according to different Bluetooth protocols, that is, the conversion of different Bluetooth protocols can be completed by using the controller, and there is no need to unpack and encapsulate on the host side, so there is no need to wake up the host.
[0095] Exemplarily, in the present application, if the parsing and encapsulation submodule supports the A2DP protocol and the L2CAP protocol, and the electronic device receives a first audio data packet based on the A2DP protocol, then when the electronic device extracts the initial audio data in the first audio data packet through the controller, it can first perform link layer parsing processing on the first audio data packet based on the A2DP protocol to obtain a parsed data packet; then the parsing and encapsulation submodule can be used to disassemble the parsed data packet according to the A2DP protocol, so as to obtain the initial audio data.
[0096] Accordingly, in the present application, if the electronic device sends a second audio data packet based on the L2CAP protocol, then after extracting the initial audio data in the first audio data packet through the controller, the electronic device can use the parsing and encapsulation submodule to encapsulate and process the target audio data according to the L2CAP protocol, thereby obtaining the second audio data packet based on the L2CAP protocol, and then sending the second audio data packet to the second Bluetooth device according to the L2CAP protocol.
[0097] Exemplarily, in the present application, if the parsing and encapsulation submodule supports the A2DP protocol and the L2CAP protocol, and the electronic device receives a first audio data packet based on the L2CAP protocol, then when the electronic device extracts the initial audio data in the first audio data packet through the controller, it can first perform link layer parsing processing on the first audio data packet based on the L2CAP protocol to obtain a parsed data packet; then the parsing and encapsulation submodule can be used to disassemble the parsed data packet according to the L2CAP protocol, so as to obtain the initial audio data.
[0098] Accordingly, in the present application, if the electronic device sends a second audio data packet based on the A2DP protocol, then after extracting the initial audio data in the first audio data packet through the controller, the electronic device can use the parsing and encapsulation submodule to encapsulate the target audio data according to the A2DP protocol, thereby obtaining the second audio data packet based on the A2DP protocol, and then sending the second audio data packet to the second Bluetooth device according to the A2DP protocol.
[0099] To sum up, in an embodiment of the present application, through the audio data transmission method proposed in the above steps 101 to 105, the electronic device can use a controller configured with a parsing and encapsulation sub-module to directly disassemble and encapsulate the audio data packet, and the controller can be directly connected to the codec, so the extracted initial audio data can be directly sent to the codec for decoding processing, and the target audio data after re-encoding can also be directly sent to the controller, which greatly simplifies the processing flow of audio data transmission, solves the delay problem, and improves processing efficiency.
[0100] The embodiment of the present application provides a method for transmitting audio data for an electronic device, wherein the electronic device includes a Bluetooth radio frequency module, a controller and a codec, the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, the electronic device receives a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extracts the initial audio data in the first audio data packet through the controller; converts the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generates a second audio data packet carrying the target audio data through the controller; and sends the second audio data packet to a second Bluetooth device through the Bluetooth radio frequency module. It can be seen that in the embodiment of the present application, after receiving a data packet sent by a single-mode Bluetooth device, the controller in the electronic device can complete the extraction of the initial audio data and the encapsulation of the target audio data, and can directly transmit data with the codec, and send the converted data packet to another single-mode Bluetooth device, thereby effectively simplifying the data transmission process and greatly improving the processing efficiency. At the same time, the host is no longer awakened during the audio data conversion process, which can reduce the power consumption of the device.
[0101] Based on the above embodiment, in yet another embodiment of the present application, Figure 5 Schematic diagram of the implementation process of the audio data transmission method Figure 3 ,like Figure 5 As shown, the method for transmitting audio data by an electronic device may further include the following steps:
[0102] Step 201: The Bluetooth radio frequency module establishes a communication connection with a first Bluetooth device.
[0103] In an embodiment of the present application, the electronic device may first establish a communication connection with the first Bluetooth device, so as to receive a first audio data packet sent by the first Bluetooth device.
[0104] Step 202: Does the Bluetooth radio frequency module receive the first audio data packet? If yes, execute step 203; otherwise, execute step 201.
[0105] In an embodiment of the present application, after establishing a connection with a first Bluetooth device, the electronic device can wait for a first audio data packet sent by the first Bluetooth device. If the electronic device receives the first audio data packet, it further processes the first audio data packet. If the electronic device does not receive a second audio data packet, it continues to wait for the first audio data packet sent by the first Bluetooth device. The Bluetooth radio frequency module can receive the first audio data packet sent by the first Bluetooth device based on the first Bluetooth protocol.
[0106] It should be noted that, in the embodiment of the present application, the first Bluetooth protocol is a Bluetooth protocol supported by the first Bluetooth device. Exemplarily, the first Bluetooth protocol may be an A2DP protocol or an L2CAP protocol.
[0107] Step 203: The controller parses the first audio data packet and extracts initial audio data.
[0108] In an embodiment of the present application, after receiving the first audio data packet sent by the first Bluetooth device, the Bluetooth radio frequency module of the electronic device can send the first audio data packet to the controller, and then the controller performs link layer analysis on the first audio data packet to obtain a parsed data packet, and then uses the parsing and encapsulation submodule configured by the controller to disassemble and process the parsed data packet, and finally the initial audio data in the first audio data packet can be obtained.
[0109] It can be understood that in the embodiment of the present application, since the controller is configured with a parsing and encapsulation submodule that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, that is, the parsing and encapsulation submodule configured by the controller can realize the disassembly and processing of the data packet, the initial audio data can be directly extracted from the first audio data packet through the controller, and there is no need to wake up the host for data disassembly and processing.
[0110] Step 204: The codec decodes the initial audio data to generate decoded data.
[0111] Step 205: The codec encodes the decoded data to generate target audio data.
[0112] In an embodiment of the present application, when the electronic device converts the initial audio data into target audio data based on the second Bluetooth protocol through the codec, it can first decode the initial audio data through the codec based on the compilation configuration parameters corresponding to the first Bluetooth device to obtain decoded data; and then encode the decoded data through the codec based on the compilation configuration parameters corresponding to the second Bluetooth device to obtain the target audio data.
[0113] It is understandable that, in the embodiment of the present application, the second Bluetooth protocol is a Bluetooth protocol supported by the second Bluetooth device. Exemplarily, the second Bluetooth protocol may be an A2DP protocol or an L2CAP protocol.
[0114] Step 206: The controller encapsulates the target audio data to generate a second audio data packet.
[0115] In an embodiment of the present application, since the controller is configured with a parsing and encapsulation sub-module that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, the target audio data obtained by conversion processing through the codec can be directly sent to the controller for further encapsulation processing.
[0116] Specifically, the electronic device may directly utilize the parsing and encapsulating submodule to encapsulate the target audio data, thereby obtaining the second audio data packet.
[0117] Step 207: The Bluetooth radio module sends a second audio data packet to the second Bluetooth device.
[0118] It is understandable that the audio data transmission method proposed in the present application can be applied to the scenario of audio data transmission between two different types of single-mode Bluetooth devices, for example, a low-power Bluetooth single-mode device sends an audio data packet to a classic Bluetooth single-mode device, or a classic Bluetooth single-mode device sends an audio data packet to a low-power Bluetooth single-mode device. Specifically, since data communication cannot be directly performed between a low-power Bluetooth single-mode device and a classic Bluetooth single-mode device, the electronic device, as an execution device for audio data conversion, needs to support both low-power Bluetooth and classic Bluetooth, and in the present application, the host configured in the electronic device no longer participates in the transmission process of audio data, and the parsing and encapsulation processing of the data packet in the common scheme is directly completed by the Bluetooth processor configured with a parsing and encapsulation submodule, which not only reduces power consumption but also improves efficiency.
[0119] For example, in the embodiments of the present application, Figure 6 Implementation framework for transmitting audio data Figure 1 ,like Figure 6 As shown, the electronic device is configured with a Bluetooth radio module (Radio), a codec (Audio Codec), a host (Host) and a controller (Controller), wherein the Controller is configured with a parsing and encapsulation submodule supporting A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, and the Controller is directly connected to the Audio Codec.
[0120] When a low-power Bluetooth single-mode device is used as a sound source device and a classic Bluetooth single-mode device is used as a target device, the Radio in the electronic device can first receive data packet 1 sent by the low-power Bluetooth single-mode device based on protocol 1 through the physical link of the low-power Bluetooth, where data packet 1 is in a format supported by the low-power Bluetooth single-mode device; after the Radio sends data packet 1 to the Controller, the Controller can first parse data packet 1 at the link layer to obtain the parsed data packet, and then use the parsing and encapsulation submodule configured by the controller to disassemble and process the parsed data packet according to protocol 1, and finally obtain audio data 1 in data packet 1. Wherein, protocol 1 can be the L2CAP protocol.
[0121] Furthermore, since the Controller is directly connected to the Audio Codec, the Controller can send the disassembled data packet 1 to the Audio Codec for decoding, and can also control the Audio Codec to re-encode the decoded data in an encoding method supported by Classic Bluetooth to generate audio data 2, and send the audio data 2 back to the Controller.
[0122] It should be noted that the compilation configuration parameters supported by the low-power Bluetooth single-mode device and the classic Bluetooth single-mode device are different. Therefore, the Audio Codec can first decode the audio data 1 through the Audio Codec based on the compilation configuration parameters corresponding to the low-power Bluetooth single-mode device to obtain the decoded data; and then encode the decoded data through the Audio Codec based on the compilation configuration parameters corresponding to the classic Bluetooth single-mode device to obtain the audio data 2, and then transmit the audio data 2 to the Controller.
[0123] Furthermore, after obtaining the audio data 2, the Controller can encapsulate the audio data 2 according to protocol 2 through a parsing and encapsulation submodule that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols. In other words, the Controller can complete the encapsulation of the audio data 2 according to the Bluetooth protocol supported by the classic Bluetooth single-mode device, generate data packet 2, and send data packet 2 to the Radio.
[0124] Finally, the radio in the electronic device can send data packet 2 to the classic Bluetooth single-mode device based on protocol 2 through the physical link of classic Bluetooth, and finally complete the transmission and forwarding of audio data. Among them, protocol 2 can be the A2DP protocol.
[0125] For example, in the embodiments of the present application, Figure 7Implementation framework for transmitting audio data Figure 2 ,like Figure 7 As shown, the electronic device is configured with a Bluetooth radio module (Radio), a codec (Audio Codec), a host (Host) and a controller (Controller), wherein the Controller is configured with a parsing and encapsulation submodule supporting A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, and the Controller is directly connected to the Audio Codec.
[0126] When the classic Bluetooth single-mode device is used as the audio source device and the low-power Bluetooth single-mode device is used as the target device, the Radio in the electronic device can first receive data packet 3 sent by the classic Bluetooth single-mode device through the physical link of the classic Bluetooth based on protocol 3, where data packet 3 is in the format supported by the classic Bluetooth single-mode device; after the Radio sends data packet 3 to the Controller, the Controller can first parse data packet 3 at the link layer to obtain the parsed data packet, and then use the parsing and encapsulation submodule configured by the controller to disassemble and process the parsed data packet according to protocol 3, and finally obtain audio data 3 in data packet 3. Wherein, protocol 3 can be the A2DP protocol.
[0127] Furthermore, since the Controller is directly connected to the Audio Codec, the Controller can send the disassembled data packet 3 to the Audio Codec for decoding, and can also control the Audio Codec to re-encode the decoded data in an encoding method supported by Bluetooth Low Energy to generate audio data 4, and send the audio data 4 back to the Controller.
[0128] It should be noted that the compilation configuration parameters supported by the classic Bluetooth single-mode device and the low-power Bluetooth single-mode device are different. Therefore, the Audio Codec can first decode the audio data 3 through the Audio Codec based on the compilation configuration parameters corresponding to the classic Bluetooth single-mode device to obtain the decoded data; and then encode the decoded data through the Audio Codec based on the compilation configuration parameters corresponding to the low-power Bluetooth single-mode device to obtain the audio data 4, and then transmit the audio data 4 to the Controller.
[0129] Furthermore, after obtaining the audio data 4, the Controller can encapsulate the audio data 4 according to protocol 4 through a parsing and encapsulation submodule that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols. Among them, the Controller can complete the encapsulation of the audio data 4 according to the Bluetooth protocol supported by the low-power Bluetooth single-mode device, generate data packet 4, and send data packet 4 to the Radio.
[0130] Finally, the radio in the electronic device can send data packet 4 to the low-power Bluetooth single-mode device based on protocol 4 through the physical link of the low-power Bluetooth, and finally complete the transmission and forwarding of the audio data. Among them, protocol 4 can be the L2CAP protocol.
[0131] That is to say, in the embodiment of the present application, since the controller is configured with a parsing and encapsulation sub-module that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols, the electronic device can directly parse and encapsulate the audio data packets according to different Bluetooth protocols, that is, the conversion of different Bluetooth protocols can be completed by using the controller, and there is no need to unpack and encapsulate on the host side, so there is no need to wake up the host.
[0132] It can be seen that the audio data transmission method proposed in the present application, when transmitting from a low-power Bluetooth audio source device to a classic Bluetooth audio sink device, or from a classic Bluetooth audio source device to a low-power Bluetooth audio sink device, compared to the traditional solution, the Controller in the electronic device supporting dual-mode Bluetooth is configured with a parsing and encapsulation submodule that supports the A2DP protocol, L2CAP protocol, ISOAL and other Bluetooth audio transmission protocols. Therefore, the Host end in the electronic device no longer needs to participate in the forwarding process of the audio data, which greatly simplifies the processing flow, thereby reducing the power consumption of the electronic device and optimizing the delay of audio data forwarding. That is to say, in the present application, for the forwarding process of audio data frames between a low-power Bluetooth single-mode device and a classic Bluetooth single-mode device, since the Controller in the electronic device can realize the disassembly and encapsulation of the data packet, the electronic device can directly connect the Audio Codec to the Controller, thereby achieving the dual benefits of low latency and low power consumption.
[0133] The embodiment of the present application provides a method for transmitting audio data for an electronic device, wherein the electronic device includes a Bluetooth radio frequency module, a controller and a codec, the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, the electronic device receives a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extracts the initial audio data in the first audio data packet through the controller; converts the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generates a second audio data packet carrying the target audio data through the controller; and sends the second audio data packet to a second Bluetooth device through the Bluetooth radio frequency module. It can be seen that in the embodiment of the present application, after receiving a data packet sent by a single-mode Bluetooth device, the controller in the electronic device can complete the extraction of the initial audio data and the encapsulation of the target audio data, and can directly transmit data with the codec, and send the converted data packet to another single-mode Bluetooth device, thereby effectively simplifying the data transmission process and greatly improving the processing efficiency. At the same time, the host is no longer awakened during the audio data conversion process, which can reduce the power consumption of the device.
[0134] Based on the above embodiment, in another embodiment of the present application, Figure 8 Schematic diagram of the structure of electronic equipment Figure 2 ,like Figure 8 As shown, the electronic device 10 proposed in the embodiment of the present application may include: an extraction unit 15, a conversion unit 16, a generation unit 17, a sending unit 18, a receiving unit 19, and a connection unit 110.
[0135] The receiving unit 19 is configured to receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module;
[0136] The extraction unit 15 is used to extract the initial audio data in the first audio data packet through the controller;
[0137] The conversion unit 16 is used to convert the initial audio data into target audio data based on a second Bluetooth protocol through the codec;
[0138] The generating unit 17 is used to generate a second audio data packet carrying the target audio data through the controller;
[0139] The sending unit 18 is used to send the second audio data packet to the second Bluetooth device through the Bluetooth radio frequency module.
[0140] Further, in an embodiment of the present application, the controller includes a parsing and encapsulating submodule, wherein the parsing and encapsulating submodule supports the A2DP protocol and the L2CAP protocol.
[0141] Furthermore, in an embodiment of the present application, the extraction unit 15 is specifically used to perform link layer parsing processing on the first audio data packet based on the A2DP protocol to obtain a parsed data packet; and use the parsing and encapsulation submodule to disassemble the parsed data packet according to the A2DP protocol to obtain the initial audio data.
[0142] Further, in an embodiment of the present application, the generating unit 17 is specifically configured to utilize the parsing and encapsulating submodule to encapsulate the target audio data according to the L2CAP protocol to obtain the second audio data packet based on the L2CAP protocol.
[0143] Furthermore, in an embodiment of the present application, the extraction unit 15 is also specifically used to perform link layer parsing processing on the first audio data packet based on the L2CAP protocol to obtain a parsed data packet; and utilize the parsing and encapsulation submodule to disassemble and process the parsed data packet according to the L2CAP protocol to obtain the initial audio data.
[0144] Further, in an embodiment of the present application, the generating unit 17 is further specifically configured to utilize the parsing and encapsulating submodule to encapsulate the target audio data according to the A2DP protocol to obtain the second audio data packet based on the A2DP protocol.
[0145] Further, in an embodiment of the present application, the conversion unit 16 is specifically used to decode the initial audio data through the codec based on the compilation configuration parameters corresponding to the first Bluetooth device to obtain decoded data; and encode the decoded data through the codec based on the compilation configuration parameters corresponding to the second Bluetooth device to obtain the target audio data.
[0146] Furthermore, in an embodiment of the present application, the electronic device further includes a host, and when the audio data transmission method proposed in the present application is implemented, the host is not awakened.
[0147] Further, in an embodiment of the present application, the connecting unit 110 is used to establish a communication connection with the first Bluetooth device before receiving a first audio data packet based on a first Bluetooth protocol from the first Bluetooth device through the Bluetooth radio frequency module.
[0148] Furthermore, in an embodiment of the present application, the connecting unit 110 is further configured to establish a communication connection with the second Bluetooth device.
[0149] It should be noted that in the embodiments of the present application, based on the above Figure 2The Bluetooth radio frequency module 11 is used to receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device; the controller 12 is directly connected to the Bluetooth radio frequency module and the codec, respectively, and is used to extract the initial audio data in the first audio data packet; the codec 13 is used to convert the initial audio data into target audio data based on a second Bluetooth protocol; the controller 12 is also used to generate a second audio data packet carrying the target audio data; the Bluetooth radio frequency module 11 is also used to send the second audio data packet to the second Bluetooth device.
[0150] Fig. 9 Schematic diagram of the structure of electronic equipment Figure 3 ,like Fig. 9 As shown, the electronic device 10 proposed in the embodiment of the present application may include a processor 111 and a memory 112 storing executable instructions of the processor 111. Further, the terminal 20 may also include a communication interface 113 and a bus 114 for connecting the processor 111, the memory 112 and the communication interface 113.
[0151] In the embodiment of the present application, the processor 111 can be at least one of an application-specific integrated circuit (ASIC), a digital signal processor (DSP), a digital signal processing device (DSPD), a programmable logic device (PLD), a field programmable gate array (FPGA), a central processing unit (CPU), a controller, a microcontroller, and a microprocessor. It can be understood that for different devices, the electronic device used to implement the function of the processor can also be other, and the embodiment of the present application is not specifically limited. The electronic device 10 can also include a memory 112, which can be connected to the processor 111, wherein the memory 112 is used to store executable program code, the program code includes computer operation instructions, and the memory 112 may include a high-speed RAM memory, and may also include a non-volatile memory, for example, at least two disk memories.
[0152] In the embodiment of the present application, the bus 114 is used to connect the communication interface 113, the processor 111 and the memory 112, and the mutual communication between these devices.
[0153] In the embodiment of the present application, the memory 112 is used to store instructions and data.
[0154] Furthermore, in an embodiment of the present application, the above-mentioned processor 111 is used to receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extract initial audio data in the first audio data packet through the controller; convert the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generate a second audio data packet carrying the target audio data through the controller; and send the second audio data packet to the second Bluetooth device through the Bluetooth radio frequency module.
[0155] In practical applications, the memory 112 may be a volatile memory, such as a random access memory (RAM); or a non-volatile memory, such as a read-only memory (ROM), a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or a combination of the above types of memories, and provide instructions and data to the processor 111.
[0156] In addition, each functional module in this embodiment can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or software functional modules.
[0157] If the integrated unit is implemented in the form of a software function module and is not sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this embodiment is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) or a processor to perform all or part of the steps of the method of this embodiment. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.
[0158] The embodiment of the present application provides an electronic device, which includes a Bluetooth radio frequency module, a controller and a codec, the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, the electronic device receives a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extracts the initial audio data in the first audio data packet through the controller; converts the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generates a second audio data packet carrying the target audio data through the controller; and sends the second audio data packet to a second Bluetooth device through the Bluetooth radio frequency module. It can be seen that in the embodiment of the present application, after receiving a data packet sent by a single-mode Bluetooth device, the controller in the electronic device can complete the extraction of the initial audio data and the encapsulation of the target audio data, and can directly transmit data with the codec, and send the converted data packet to another single-mode Bluetooth device, thereby effectively simplifying the data transmission process and greatly improving the processing efficiency. At the same time, the host is no longer awakened during the audio data conversion process, which can reduce the power consumption of the device.
[0159] An embodiment of the present application provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the method for transmitting audio data as described above is implemented.
[0160] Specifically, the program instructions corresponding to the audio data transmission method in this embodiment can be stored in a storage medium such as a CD, a hard disk, a USB flash drive, etc. When the program instructions corresponding to the audio data transmission method in the storage medium are read or executed by an electronic device, the following steps are included:
[0161] Receiving a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module;
[0162] extracting the initial audio data in the first audio data packet by the controller;
[0163] Converting the initial audio data into target audio data based on a second Bluetooth protocol through the codec;
[0164] generating, by the controller, a second audio data packet carrying the target audio data; and
[0165] The second audio data packet is sent to the second Bluetooth device through the Bluetooth radio frequency module.
[0166] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.
[0167] The present application is described with reference to implementation flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0168] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a manufactured product including an instruction device, which is implemented in the implementation flow diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0169] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for executing the steps in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0170] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.
Claims
1. A method for transmitting audio data of an electronic device, wherein: The electronic device comprises a Bluetooth radio module, a controller and a codec, the controller is directly connected to the Bluetooth radio module and the codec respectively, and the method comprises: Receiving a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module; extracting the initial audio data in the first audio data packet by the controller; Converting the initial audio data into target audio data based on a second Bluetooth protocol through the codec; generating, by the controller, a second audio data packet carrying the target audio data; and Sending the second audio data packet to a second Bluetooth device through the Bluetooth radio frequency module; Wherein, when the first Bluetooth protocol is a classic Bluetooth protocol and the second Bluetooth protocol is a low-power Bluetooth protocol, extracting the initial audio data in the first audio data packet by the controller includes: Performing link layer parsing processing on the first audio data packet based on the A2DP protocol to obtain a parsed data packet; Using the parsing and encapsulation submodule, the parsed data packet is disassembled and processed according to the A2DP protocol to obtain the initial audio data; or, When the first Bluetooth protocol is a low-power Bluetooth protocol and the second Bluetooth protocol is a classic Bluetooth protocol, extracting the initial audio data in the first audio data packet by the controller includes: Performing link layer parsing processing on the first audio data packet based on the L2CAP protocol to obtain a parsed data packet; The parsed data packet is disassembled and processed according to the L2CAP protocol by using the parsing and encapsulation submodule to obtain the initial audio data.
2. The method according to claim 1, characterized in that The controller comprises a parsing and encapsulating submodule, wherein the parsing and encapsulating submodule supports the A2DP protocol and the L2CAP protocol.
3. The method according to claim 1, characterized in that The step of generating, by the controller, a second audio data packet carrying the target audio data comprises: The target audio data is encapsulated and processed according to the L2CAP protocol by utilizing the parsing and encapsulation submodule to obtain the second audio data packet based on the L2CAP protocol.
4. The method according to claim 1, characterized in that: The step of generating, by the controller, a second audio data packet carrying the target audio data comprises: The target audio data is encapsulated and processed according to the A2DP protocol by utilizing the parsing and encapsulation submodule to obtain the second audio data packet based on the A2DP protocol.
5. The method according to claim 1, characterized in that The converting the initial audio data into target audio data based on a second Bluetooth protocol by the codec comprises: Based on the compiled configuration parameters corresponding to the first Bluetooth device, decoding the initial audio data through the codec to obtain decoded data; and Based on the compilation configuration parameters corresponding to the second Bluetooth device, the decoded data is encoded by the codec to obtain the target audio data.
6. The method according to claim 1, characterized in that The electronic device further includes a host, and the method further includes: When the method according to any one of claims 1 to 5 is implemented, the host is not woken up.
7. The method according to claim 1, characterized in that Before receiving a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device through the Bluetooth radio frequency module, the method further includes: Establish a communication connection with the first Bluetooth device.
8. The method according to claim 1, characterized in that The method further comprises: Establish a communication connection with the second Bluetooth device.
9. An electronic device, characterized in that: The electronic device includes a Bluetooth radio frequency module, a controller and a codec. The Bluetooth radio frequency module is used to receive a first audio data packet based on a first Bluetooth protocol from a first Bluetooth device; The controller is directly connected to the Bluetooth radio module and the codec, respectively, and is used to extract the initial audio data in the first audio data packet; The codec is used to convert the initial audio data into target audio data based on a second Bluetooth protocol; The controller is further used to generate a second audio data packet carrying the target audio data; The Bluetooth radio frequency module is further used to send the second audio data packet to a second Bluetooth device; The electronic device is specifically configured to perform link layer parsing processing on the first audio data packet based on the A2DP protocol to obtain a parsed data packet when the first Bluetooth protocol is a classic Bluetooth protocol and the second Bluetooth protocol is a low-power Bluetooth protocol; Using the parsing and encapsulation submodule, the parsed data packet is disassembled and processed according to the A2DP protocol to obtain the initial audio data; or, when the first Bluetooth protocol is a low-power Bluetooth protocol and the second Bluetooth protocol is a classic Bluetooth protocol, the first audio data packet based on the L2CAP protocol is subjected to link layer parsing processing to obtain a parsed data packet; The parsed data packet is disassembled and processed according to the L2CAP protocol by using the parsing and encapsulation submodule to obtain the initial audio data.
10. An electronic device, characterized in that: The electronic device includes a Bluetooth radio frequency module, a controller and a codec, the controller is directly connected to the Bluetooth radio frequency module and the codec respectively, and the electronic device also includes a processor and a memory storing instructions executable by the processor. When the instructions are executed by the processor, the method described in any one of claims 1 to 8 is implemented.
11. A computer-readable storage medium having a program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
