Audio transmission method, system, device and equipment and storage medium
By adding a Wi-Fi audio streaming service process to the hardware abstraction layer, the compatibility and power consumption issues of Wi-Fi headphones are resolved, enabling compatibility and power consumption optimization for transmitting audio data using Wi-Fi technology on any platform.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-25
- Publication Date
- 2026-03-10
AI Technical Summary
Existing wireless headphones suffer from poor compatibility and excessive power consumption when transmitting audio data via Wi-Fi technology, making them unusable on any platform.
A Wi-Fi audio streaming service process is added to the hardware abstraction layer to provide a Wi-Fi-based control channel and audio data transmission capability between electronic devices and audio playback devices. This avoids reliance on wired connections between the DSP and Wi-Fi hardware, dynamically decides the transmission path to optimize power consumption, and uses a dynamic path decision module to automatically select the Wi-Fi or Bluetooth path based on the characteristics of the audio scene.
It improves the compatibility of Wi-Fi technology for transmitting audio data, enabling its use on any platform, and achieves optimal power consumption while ensuring sound quality.
Smart Images

Figure CN121645581A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of communication, and particularly relates to an audio transmission method, system, device, equipment and storage medium. BACKGROUND
[0002] At present, wireless earphones on the market are usually Bluetooth earphones using Bluetooth technology. However, the Bluetooth earphones encode and decode audio data when transmitting the audio data, resulting in loss of audio quality of the audio data.
[0003] Wireless Fidelity (Wi-Fi) transmission protocol has the advantage of high bandwidth. Through Wi-Fi technology, the bandwidth limitation problem of traditional Bluetooth earphones can be broken through, and motherband-level lossless audio quality transmission can be realized. At present, there are wireless earphones that transmit audio data through Wi-Fi technology, but this scheme must use a specific chip to realize it, and the compatibility is poor. SUMMARY
[0004] The purpose of the embodiments of the present application is to provide an audio transmission method, system, device, equipment and storage medium, which can improve the compatibility of the scheme of transmitting audio data through Wi-Fi technology.
[0005] In a first aspect, the embodiments of the present application provide an audio transmission method applied to an electronic device connected with an audio playback device. The method comprises: in the case that the system framework layer receives first audio data transmitted by an application layer, transmitting the first audio data to a hardware abstraction layer through the system framework layer; in the case that it is determined through the hardware abstraction layer that a Wi-Fi transmission path is used, transmitting the first audio data to a Wi-Fi module of the electronic device through a Wi-Fi audio streaming service process in the hardware abstraction layer, and transmitting the first audio data to the audio playback device through the Wi-Fi module.
[0006] In a second aspect, the embodiments of the present application provide an audio playback system applied to an electronic device connected with an audio playback device. The audio playback system comprises: an application layer, a system framework layer, a hardware abstraction layer and a Wi-Fi module, and the hardware abstraction layer comprises a Wi-Fi audio streaming service process. The system framework layer is configured to receive first audio data transmitted by the application layer and transmit the first audio data to the hardware abstraction layer. The hardware abstraction layer is configured to determine a usable data transmission path. The Wi-Fi audio streaming service process is configured to transmit the first audio data to the Wi-Fi module in the case that the usable data transmission path is a Wi-Fi transmission path. The Wi-Fi module is configured to transmit the first audio data to the audio playback device.
[0007] In a third aspect, the embodiments of the present application provide an audio transmission device, which comprises a transmission module, configured to: in a case where the system framework layer receives first audio data transmitted by an application layer, transmit the first audio data to a hardware abstraction layer through the system framework layer; and in a case where it is determined through the hardware abstraction layer that a Wi-Fi transmission path is used, transmit the first audio data to a Wi-Fi module of the electronic device through a Wi-Fi audio streaming service process in the hardware abstraction layer, and transmit the first audio data to an audio playback device connected to the electronic device through the Wi-Fi module.
[0008] In a fourth aspect, the embodiments of the present application provide an electronic device, which comprises a processor and a memory, wherein the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the audio transmission method according to the first aspect.
[0009] In a fifth aspect, the embodiments of the present application provide a readable storage medium, which stores programs or instructions, and the programs or instructions are executed by a processor to implement the steps of the audio transmission method according to the first aspect.
[0010] In a sixth aspect, the embodiments of the present application provide a chip, which comprises a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is configured to run programs or instructions to implement the audio transmission method according to the first aspect.
[0011] In a seventh aspect, the embodiments of the present application provide a computer program product, which is stored in a storage medium, and the program product is executed by at least one processor to implement the audio transmission method according to the first aspect.
[0012] In the embodiments of the present application, when the system framework layer receives the first audio data transmitted by the application layer, the system framework layer transmits the first audio data to the hardware abstraction layer; when it is determined by the hardware abstraction layer that the wireless local area network (Wi-Fi) transmission path is used, the first audio data is transmitted to the Wi-Fi module of the electronic device by the Wi-Fi audio streaming service process in the hardware abstraction layer, and the first audio data is transmitted to the audio playback device by the Wi-Fi module. In this way, since the Wi-Fi streaming service process provides a Wi-Fi-based control channel and Wi-Fi-based audio data transmission capability between the electronic device and the audio playback device, when the audio data is transmitted between the electronic device and the audio playback device, the wired connection between the DSP and the Wi-Fi hardware is not required to support the data transmission of the Wi-Fi path, which does not limit the hardware of the electronic device and the audio playback device, so that the scheme for transmitting audio data by using the Wi-Fi technology can be used on any platform, and the compatibility of the scheme for transmitting audio data by using the Wi-Fi technology is improved. BRIEF DESCRIPTION OF DRAWINGS
[0013] Figure 1 FIG. 1 is a structural schematic diagram of an audio playback system provided by the related art;
[0014] Figure 2 FIG. 2 is a structural schematic diagram of an audio playback system provided by an embodiment of the present application;
[0015] Figure 3 FIG. 3 is a structural schematic diagram of an audio playback system provided by another embodiment of the present application;
[0016] Figure 4 FIG. 4 is a structural schematic diagram of an audio playback system provided by another embodiment of the present application;
[0017] Figure 5 FIG. 5 is a structural schematic diagram of a Wi-Fi audio service provided by an embodiment of the present application;
[0018] Figure 6 FIG. 6 is a flow schematic diagram of an audio transmission method provided by an embodiment of the present application;
[0019] Figure 7 FIG. 7 is a schematic diagram of an audio transmission device provided by an embodiment of the present application;
[0020] Figure 8 FIG. 8 is a structural schematic diagram of an electronic device provided by an embodiment of the present application;
[0021] Figure 9 FIG. 9 is a hardware structural schematic diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0022] The technical solutions in the embodiments of the present application will be clearly described below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some but not all of the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by a person of ordinary skill in the art belong to the scope of protection of the present application.
[0023] The terms "first", "second", and the like in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than that illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally a category and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in an "or" relationship.
[0024] The terms "at least one", "at least one of", and the like in the specification and claims of the present application refer to any one of the objects, a combination of any two or more of the objects. For example, at least one of a, b, and c can mean "a", "b", "c", "a and b", "a and c", "b and c", and "a, b, and c", where a, b, and c can be single or multiple. Similarly, "at least two" refers to two or more, and has a similar meaning to "at least one".
[0025] First, the technical terms and names involved in the embodiments of the present application are explained and described.
[0026] Wi-Fi earphone: an earphone device that can transmit audio data through Wi-Fi direct technology.
[0027] Wi-Fi audio hardware abstraction layer (Wi-Fi Audio Hardware Abstraction Layer, Wi-Fi Audio HAL): used to realize the interaction between the bottom layer driver and the audio framework.
[0028] RTP / RPC: Real-time Transport Protocol (Real-time Transport Protocol) and Control Protocol (Remote Procedure Call).
[0029] P2P network configuration: Wi-Fi direct Peer-to-Peer (Peer-to-Peer) networking.
[0030] Dynamic Path Decision Module: A control module that automatically selects the Wi-Fi or Bluetooth path based on the characteristics of the audio scene.
[0031] Sampling rate threshold: The audio quality threshold that triggers path switching.
[0032] Multi-application conflict arbitration: When multiple applications request audio output simultaneously, a unified path is used based on the highest audio quality requirement.
[0033] Notification tone anchoring: Locks the currently used data transmission path when playing short audio such as notification tones / typing sounds.
[0034] The audio transmission method, system, apparatus, device, and storage medium provided in this application will be described in detail below with reference to the accompanying drawings and through specific embodiments and application scenarios.
[0035] The audio transmission method provided in this application can be applied to scenarios where audio data is transmitted via Wi-Fi technology. Specifically, it can be applied to scenarios where users use Wi-Fi headphones to connect to electronic devices to listen to music.
[0036] Figure 1 This is a schematic diagram of an audio playback system provided by related technologies. The audio playback system is applied to an electronic device, which is connected to an audio playback device. The audio playback system 30 may include an application layer 11, a system framework layer 12, a hardware abstraction layer 13, and a hardware layer 14. The application layer 11 includes an audio player 111, such as Music; the system framework layer includes an audio track 121, an audio flinger 122, and an audio policy module 123; the hardware abstraction layer 13 includes an audio hardware abstraction module (Audio HAL) 131; and the hardware layer 14 includes a Bluetooth module (BT) 141, a processor 142, and a Wi-Fi module 143, with the processor 142 connected to both the Bluetooth module 141 and the Wi-Fi module 143. The processor 142 may be a digital signal processor (DSP).
[0037] The audio transmission process can specifically include: the electronic device plays audio data through the audio player 111 of the application layer 11, and transmits the audio data to the audioFlinger 122 of the system framework layer 12 through the audio track 121; the audio policy 123 of the system framework layer 12 decides to use Bluetooth transmission and sends the instruction to use Bluetooth transmission to the audio Flinger 122; the audio data is transmitted to the audio HAL 131 of the hardware abstraction layer 13 through the audio Flinger 122; the audio data is packaged and transmitted to the DSP 142 of the hardware layer 14 through the audio HAL 131; the DSP 142 of the hardware layer 14 determines whether to use Wi-Fi technology or Bluetooth technology to transmit the audio data, and transmits the received audio data to the BT module 141 or Wi-Fi module 143 of the hardware layer 14; the electronic device transmits the audio data to the audio playback device connected to the electronic device through the BT module 141 or Wi-Fi module 143.
[0038] However, the above solution relies on the hardware connection between the DSP and the Wi-Fi module, and can only be implemented with hardware from specific manufacturers. Furthermore, the audio playback device must also have the hardware from that manufacturer installed to play audio, resulting in poor compatibility and inability to adapt to all platforms. In addition, the Wi-Fi module operates continuously in this solution, with typical power consumption reaching up to 30 times that of Bluetooth, leading to excessive power consumption.
[0039] Therefore, this application provides an audio playback system. Figure 2 A schematic diagram of the audio playback system architecture is shown. The audio playback system 10 may include an application layer 11, a system framework layer 12, a hardware abstraction layer 13, and a hardware layer 14. The application layer 11 includes an audio player 111; the system framework layer 12 includes an audio track 121, an audio flinger 122, and a Wi-Fi audio policy module 124; the hardware abstraction layer 13 includes an audio hardware abstraction module (Audio HAL) 131 and a Wi-Fi audio streaming service process 133, the audio hardware abstraction module 131 including a Wi-Fi audio hardware abstraction interface (Wi-Fi Audio HAL) 132; the hardware layer 14 includes a Bluetooth (BT) module 141, a processor 142, and a Wi-Fi module 143, with the processor 142 connected to the Bluetooth module 141. The processor 142 may be a DSP.
[0040] The audio playback system provided in this application adds a Wi-Fi Audio Streaming Service to the hardware abstraction layer. Since the Wi-Fi Audio Streaming Service provides a Wi-Fi-based control channel and audio data transmission capability between the electronic device and the audio playback device, audio data can be transmitted to the Wi-Fi module via Wi-Fi Audio HAL and Wi-Fi Audio Streaming Service without relying on a DSP hardware platform. This solves the hardware limitations of related technologies, allowing the Wi-Fi-based audio data transmission solution to be used on any platform, improving compatibility. Furthermore, this solution adaptively and dynamically decides the transmission path through the Wi-Fi Audio Policy module, achieving optimal power consumption while ensuring sound quality.
[0041] Figure 3 This is a schematic diagram of the structure of an audio playback system provided in an embodiment of this application. The audio playback system is applied to an electronic device, and the electronic device 10 is connected to the audio playback device 20. For example... Figure 3 As shown, the audio playback system of the electronic device 10 includes an application layer 11, a system framework layer 12, a hardware abstraction layer 13, and a Wi-Fi module 143. The hardware abstraction layer 13 includes a Wi-Fi audio streaming service process 133.
[0042] The system framework layer 12 receives the first audio data transmitted from the application layer 11 and transmits it to the hardware abstraction layer 13. The hardware abstraction layer 13 determines the available data transmission path. The Wi-Fi audio streaming service process 133, when the available data transmission path is a Wi-Fi transmission path, transmits the first audio data to the Wi-Fi module 143. The Wi-Fi module 143 transmits the first audio data to the audio playback device 20.
[0043] In some embodiments of this application, the application layer 11 can be the Application layer, the system framework layer 12 can be the Framework layer, the hardware abstraction layer 13 can be the Native layer, and the Wi-Fi audio streaming service process 133 can be the Wi-Fi Audio Streaming Service.
[0044] In some embodiments of this application, the Wi-Fi audio streaming service process 133 described above provides a Wi-Fi-based control channel and audio streaming capability between an electronic device and an audio playback device.
[0045] In some embodiments of this application, combined with Figure 3 ,like Figure 4 As shown, the application layer 11 may include a third-party application 111, which can be used to transmit the first audio data to the system framework layer 12. For example, the third-party application 111 can be any application capable of playing audio, such as a game application, music player application, audio player, video application, or social application. For instance, the third-party application could be a music application.
[0046] In some embodiments of this application, such as Figure 4 As shown, the system framework layer 12 may include an audio track 121 and an audio renderer 122. The audio track 121 may be an Audio Track, and the audio renderer 122 may be an AudioFlinger.
[0047] In some embodiments of this application, a third-party application 111 in the application layer 11 can be used to transmit the first audio data to the audio track 121 in the system framework layer 12. The audio track 121 is used to transmit the first audio data to the audio renderer 122 in the system framework layer 12 for mixing. The audio renderer 122 is used to transmit the first audio data to the hardware abstraction layer 13.
[0048] In some embodiments of this application, after receiving the first audio data, the hardware abstraction layer 13 first determines the available data transmission path. The available data path can be the data transmission path currently in use, the data transmission path used in the last decision, or the data transmission path that needs to be switched. If it is determined that the available data transmission path is a Wi-Fi transmission path, the Wi-Fi audio streaming service process 133 in the hardware abstraction layer 13 transmits the first audio data to the Wi-Fi module 143.
[0049] In some embodiments of this application, the Wi-Fi audio streaming service process 144 can be used to package the received first audio data to obtain a first audio data packet, and transmit the first audio data packet to the Wi-Fi module 143.
[0050] In some embodiments of this application, the first audio data can be Pulse Code Modulation (PCM) data, and the first audio data packet can be an RTP data packet.
[0051] In some embodiments of this application, such asFigure 4 As shown, the audio playback system described above may further include a kernel layer 15, which may include a network stack 152. The Wi-Fi audio streaming service process 133 may be used to transmit the first audio data packet to the network stack 152 of the kernel layer 15. The network stack 152 may be used to process the first audio data packet to obtain a second audio data packet. The second audio data packet may be a Transmission Control Protocol (TCP) / Internet Protocol (IP) data packet. The network stack 152 may also be used to transmit the second audio data packet to the Wi-Fi module 143.
[0052] In some embodiments of this application, such as Figure 4 As shown, the aforementioned hardware abstraction layer 13 may also include a Wi-Fi audio hardware abstraction interface 132, which is used to receive first audio data from the system framework layer 12 and transmit the first audio data to the Wi-Fi audio streaming service process 133.
[0053] In some embodiments of this application, the aforementioned Wi-Fi audio hardware abstraction interface 132 can be a Wi-Fi AudioHAL. This solution adds a Wi-Fi Audio HAL to the Android native audio hardware abstraction module Audio HAL. This Wi-Fi Audio HAL can be used to receive the first audio data transmitted by the system framework layer 12, and package and transmit the first audio data to the streaming module of the Wi-Fi Audio Streaming Service 133, so that the first audio data can be packaged and transmitted to the Wi-Fi module 143 through the streaming module.
[0054] In some embodiments of this application, such as Figure 4 As shown, the application layer 11 includes a Wi-Fi audio control service process 114, and the system framework layer 12 further includes a Wi-Fi audio decision module 124. The Wi-Fi audio control service process 114, when the Wi-Fi and Bluetooth transmission paths of the electronic device are enabled, obtains the Wi-Fi signal quality from the system framework layer 12, and based on the Wi-Fi signal quality, sends a first instruction to the Wi-Fi audio streaming service process 133 and the Wi-Fi audio decision module 124, indicating whether to use the Wi-Fi transmission path. The Wi-Fi audio decision module 124, based on the received first instruction, sends a second instruction to the Bluetooth audio hardware abstraction interface 134 in the hardware abstraction layer 13, indicating the available data transmission path.
[0055] Among them, the Wi-Fi audio control service process 114 can be Wi-Fi Audio Control Service, the Wi-Fi audio decision module 124 can be Wi-Fi Audio Policy, and the Bluetooth audio hardware abstraction interface 134 can be BT AudioHAL.
[0056] In some embodiments of this application, the Wi-Fi audio control service process 114 is located in the Android Java application layer, i.e., the application layer 11. This Wi-Fi audio control service process 114 is used to establish P2P connections, control the output path of the audio framework, and execute playback control commands from the audio player. This Wi-Fi audio control service process 114 and the Wi-Fi audio streaming service process 133 belong to the same process, and the two can interact using the Java Native Interface (JNI).
[0057] In some embodiments of this application, the Wi-Fi audio decision module 124 described above can be used to control audio routing and decide whether to output audio data from the Wi-Fi path or the Bluetooth path.
[0058] In other words, the solution in this application adopts a dynamic path decision module, which automatically selects whether to transmit audio data through the Wi-Fi path or the Bluetooth path based on the characteristics of the audio scene.
[0059] In some embodiments of this application, the first audio data includes at least one data stream. The Wi-Fi audio decision module 124 can be used to obtain the sampling rate of the first audio data. If the sampling rate of any data stream in the first audio data is greater than a first threshold, the Wi-Fi transmission path and Bluetooth transmission path of the electronic device are activated. The first threshold, also known as the sampling rate threshold, refers to an audio quality threshold used to trigger the switching of data transmission paths.
[0060] In some embodiments of this application, the system framework layer 12 may include a Wi-Fi framework module 125 for receiving control commands from the Wi-Fi audio control service process 114. The Wi-Fi framework module 125 may be a Wi-FiFramework.
[0061] In some embodiments of this application, the Wi-Fi audio control service process 114 can send a second instruction to the Wi-Fi framework module 125. This second instruction instructs the Wi-Fi framework module 125 to acquire Wi-Fi signal quality and transmit it to the Wi-Fi audio control service process 114. The Wi-Fi audio control service process 114 generates a first instruction indicating that the Wi-Fi transmission path should not be used if the received Wi-Fi signal quality is less than a first threshold, and generates a first instruction indicating that the Wi-Fi transmission path should be used if the received Wi-Fi signal quality is greater than or equal to the first threshold. Regardless of whether the first instruction indicates the use or non-use of the Wi-Fi transmission path, the Wi-Fi audio control service process 114 can transmit the first instruction to the Wi-Fi audio streaming service process 133 and the Wi-Fi audio decision module 124.
[0062] In some embodiments of this application, the Wi-Fi audio decision module 124 can be used to send a second instruction to the audio renderer 122 in the system framework layer 12 based on the received first instruction. The audio renderer 122 can be used to send the second instruction to the Bluetooth audio hardware abstraction interface 134 in the hardware abstraction layer 13.
[0063] In some embodiments of this application, when the first instruction indicates the use of a Wi-Fi transmission path, the Wi-Fi audio decision module 124 can generate a second instruction to indicate the use of a Wi-Fi transmission path; when the first instruction indicates the use of a Wi-Fi transmission path, the Wi-Fi audio decision module 124 can generate a second instruction to indicate the use of a Bluetooth transmission path.
[0064] In some embodiments of this application, when a first instruction indicates that the Wi-Fi transmission path is not used, the Wi-Fi audio streaming service process 133 is used to stop sending audio data to the Wi-Fi module 143.
[0065] In other words, before receiving the first instruction, the electronic device uses the Wi-Fi transmission path to transmit audio data. After the Wi-Fi audio streaming service process 133 receives the first instruction, if the first instruction indicates that the Wi-Fi transmission path should not be used, the Wi-Fi audio streaming service process 133 can stop sending audio data to the Wi-Fi module 143, that is, cut off the audio data transmission of the Wi-Fi transmission path.
[0066] In some embodiments of this application, when the second instruction indicates that the available data transmission path is a Wi-Fi transmission path, the Bluetooth audio hardware abstraction interface 134 is used to stop sending audio data to the Bluetooth module 141 of the electronic device.
[0067] In other words, before receiving the second instruction, the electronic device uses the Bluetooth transmission path to transmit audio data. After the Bluetooth audio hardware abstraction interface 134 receives the second instruction, if the second instruction indicates to use the Wi-Fi transmission path, the Bluetooth audio hardware abstraction interface 134 can stop sending audio data to the Bluetooth module 141, that is, cut off the audio data transmission of the Bluetooth transmission path.
[0068] In some embodiments of this application, the Wi-Fi audio streaming service process 133 is specifically used to determine the available transmission path, and when the available transmission path is determined to be a Wi-Fi transmission path, to transmit the first audio data to the Wi-Fi module 143.
[0069] In some embodiments of this application, since the Wi-Fi audio streaming service process 133 has previously received a first instruction indicating whether to use the Wi-Fi transmission path, the Wi-Fi audio streaming service process 133 can determine whether the Wi-Fi transmission path can be used based on the first instruction. If so, the Wi-Fi audio streaming service process 133 can transmit the first audio data to the Wi-Fi module.
[0070] In some embodiments of this application, such as Figure 4 As shown, the aforementioned hardware abstraction layer 13 also includes a Bluetooth audio hardware abstraction interface 134, and the audio playback system may also include a Bluetooth module 141; the Bluetooth audio hardware abstraction interface 134 is used to transmit the first audio data to the Bluetooth module 141 when it is determined that the available transmission path is a Bluetooth transmission path; the Bluetooth module 141 is used to transmit the first audio data to the audio playback device 20 for playback.
[0071] In some embodiments of this application, since the Bluetooth audio hardware abstraction interface 134 has previously received a second instruction indicating the available transmission path, the Bluetooth audio hardware abstraction interface 134 can determine whether to use the Bluetooth transmission path based on the second instruction. If so, the Bluetooth audio hardware abstraction interface 134 can transmit the first audio data to the Bluetooth module 141.
[0072] In some embodiments of this application, the audio renderer 122 in the system framework layer 12 can transmit the first audio data to the Bluetooth audio hardware abstraction interface 134 and the Wi-Fi audio hardware abstraction interface 132 respectively after receiving the first audio data from the audio track 121.
[0073] In some embodiments of this application, after the Bluetooth audio hardware abstraction interface 134 receives the first audio data from the audio renderer 122, it can transmit the first audio data to the Bluetooth module 141 if it is determined that the available transmission path is the Bluetooth transmission path, and then the Bluetooth module 141 transmits the first audio data to the audio playback device 20.
[0074] In some embodiments of this application, the Wi-Fi audio hardware abstraction interface 132 can transmit the first audio data to the Wi-Fi audio streaming service process 133 after receiving the first audio data. The Wi-Fi audio streaming service process 133 then transmits the first audio data to the Wi-Fi module 143 if it determines that the Wi-Fi transmission path is to be used. The Wi-Fi module 143 then transmits the first audio data to the audio playback device 20.
[0075] It should be noted that, in the above content, the data transmission path used is different when the Wi-Fi signal quality is greater than the first threshold and when the Wi-Fi signal quality is not greater than the first threshold. That is, this solution dynamically switches the data transmission path according to the Wi-Fi signal quality during audio data transmission. However, in some embodiments, if the first audio data is a notification tone or touch tone, the data transmission path used remains unchanged regardless of changes in the Wi-Fi signal quality, i.e., no path switching is performed. Notification tones can include audio played when any message, information, or phone call is received, and touch tones can include audio played when the user types or clicks buttons or controls on the screen.
[0076] In other words, this solution employs a notification tone anchoring strategy. When the first audio data played is a notification tone or a touch tone, the currently used data transmission path is locked, and the data transmission path is not switched.
[0077] In some embodiments of this application, when the system framework layer 12 receives an audio control command, the system framework layer 12 can transmit the audio control command to the hardware abstraction layer 13. The hardware abstraction layer 13 can then transmit the audio control command to the Wi-Fi module 143 or the Bluetooth module 141, and further transmit the audio control command to the audio playback device 20 via the Wi-Fi module 143 or the Bluetooth module 141. The audio control command can be used to pause, play, or switch audio data.
[0078] In some embodiments of this application, the application layer 11 may further include an audio playback control application 112, which can be used to control the Wi-Fi audio switch to be turned on or off. When the Wi-Fi audio switch is on, the audio playback control application 112 can send a "Wi-Fi audio switch is on" message to the Wi-Fi audio control service process 114 in the application layer 11. After receiving the "Wi-Fi audio switch is on" message, the Wi-Fi audio control service process 114 can send the "Wi-Fi audio switch is on" message to the Wi-Fi audio streaming media service process 133 to inform the Wi-Fi audio streaming media service process 133 to start working.
[0079] It should be noted that the Wi-Fi audio control service process 114 can send a Wi-Fi audio switch enabled message to the Wi-Fi audio streaming service process 133 via JNI.
[0080] In some embodiments of this application, the audio playback device 20 may include a Wi-Fi chip 21. After receiving a first audio data packet from the Wi-Fi audio streaming service process 133, the Wi-Fi module 143 transmits the first audio data packet to the Wi-Fi chip 21 in the audio playback device 20. The Wi-Fi chip 21 receives the first audio data packet from the Wi-Fi module 143, unpacks it through the network module in the Wi-Fi chip 21 to obtain audio data and control commands, and plays the audio indicated by the audio data.
[0081] Figure 5 This is a schematic diagram of the structure of an audio playback system provided in an embodiment of this application. The audio playback system is applied to an electronic device 10, which is connected to an audio playback device 20. The audio playback system includes an application layer 11, a system framework layer 12, a hardware abstraction layer 13, a kernel layer 14, and a hardware layer 15.
[0082] In some embodiments of this application, the Application layer 11 includes a third-party application 111 (such as Music), an audio playback control application (Tws app) 112, a settings application 113, and a Wi-Fi Audio Control Service process 114. The third-party application 111 is used to play music and transmit first audio data to the Framework layer 12. The Tws app 112 is used to enable or disable Wi-Fi Audio. The Wi-Fi AudioControl Service 114 resides in the Android Java application layer and is used to establish P2P connections, control the output path of the audio framework, and execute playback control commands sent by the audio playback device.
[0083] In some embodiments of this application, the Framework layer 12 may include an audio track 121, an audio flinger 122, an audio recording module, a Wi-Fi Framework layer 125, and an audio policy module 123. The audio policy includes a Bluetooth audio policy module, an SPK audio policy module, and a Wi-Fi audio policy module 124. The audio track 121 is used to receive audio data from a third-party application 111 in the application layer and transmit the audio data to the audio flinger 122 for mixing. The Wi-Fi Framework 125 can be used to receive control commands from the Wi-Fi Audio Control Service 114 and send Wi-Fi signal quality information to the Wi-Fi Audio Control Service 114 so that the Wi-Fi Audio Control Service 114 can determine whether to use the Wi-Fi transmission path. The Wi-Fi Audio Policy 124 can be used to control audio data routing, deciding whether to use a Wi-Fi or Bluetooth transmission path.
[0084] In some embodiments of this application, the Native layer 13 includes a Hardware Abstraction Module (HAL), a Bluetooth Protocol Line (BTStack), an Advanced Linux Sound Architecture (ALSA), and a Wi-Fi Audio Streaming Service process (Wi-Fi Audio Streaming Service) 133. The HAL includes an A2DP HAL, a Bluetooth Audio Hardware Abstraction Interface (Audio HAL) 131, and a Wi-Fi Audio Hardware Abstraction Interface (Wi-Fi Audio HAL) 132. The Wi-Fi Audio HAL 132 receives audio data transmitted by the Audio Flinger 122 and packages the data for transmission to the streaming module of the Wi-Fi Audio Streaming Service 133. The Wi-Fi Audio Streaming Service 133 provides a Wi-Fi-based control channel between the electronic device and the audio player, and provides audio streaming capabilities. The Wi-Fi Audio Control Service 114 and the Wi-Fi Audio Streaming Service 133 belong to the same process and interact using JNI.
[0085] In some embodiments of this application, the Kernel layer 15 includes an Audio Driver 151 and a Network Stack 152. The Audio Driver 151 is used throughout hardware control, data transmission, and system scheduling, and is the cornerstone for ensuring the normal operation of audio functions. The Network Stack 152 is used to handle packet transmission, routing, protocol parsing, and hardware interaction.
[0086] In some embodiments of this application, the Hardware layer 14 includes a Bluetooth module (BT) 141, an audio signal processor such as an ADSP chip 142, and a Wi-Fi module 143. The ADSP chip 142 processes digital audio signals and can be directly connected to the BT module 141 to transmit audio data to Bluetooth. The Wi-Fi module 143 transmits audio data to the audio playback device 20 via wireless communication.
[0087] In some embodiments of this application, the electronic device 10 and the audio playback device 20 interact via Wi-Fi wireless transmission for data stream and control stream, with the audio data stream using the Real-time Transport Protocol (RTP) and the control stream using the Control Protocol (RPC).
[0088] In some embodiments of this application, the audio player 20 may include a Wi-Fi chip 21, a network stack 22, a depacket module 23, a synchronization module 24, a playback pipeline 25, and an audio system 26. The Wi-Fi chip 21 is used to receive audio data packets sent by the Wi-Fi module 143, depacket them through the depacket module 23, convert them into audio data and control commands, and play the sound through the audio system 26.
[0089] It should be noted that the Wi-Fi module 143 in the electronic device 10 is time-synchronized with the Wi-Fi chip 21 in the audio playback device 20. The Wi-Fi audio streaming service process 133 can transmit control commands with the audio playback device 20.
[0090] Figure 5 This is a schematic diagram of the structure of the Wi-Fi audio service provided in this application embodiment. The Wi-Fi audio service is the core component of Wi-Fi audio, used to obtain audio data from the electronic device's system and then send the audio data to the audio playback device via the Wi-Fi transmission path. Functionally, the Wi-Fi Audio Service can be divided into two parts: a Wi-Fi Audio Control Service and a Wi-Fi Audio Streaming Service.
[0091] In some embodiments of this application, the Wi-Fi Audio Control Service is configured in the Java layer of the electronic device and can be used for Wi-Fi P2P network configuration control, execution of playback control commands sent from the headset, seamless switching control, and streaming control.
[0092] In some embodiments of this application, the Wi-Fi Audio Streaming Service is configured in the Native layer of the electronic device, which can be used to send audio data to the audio playback device using the RTP protocol, and provide a control link based on RPC to receive and send control commands.
[0093] In some embodiments of this application, Figure 5The topmost dashed box is the audio playback control application (TWSapp), which displays basic information about the audio playback device. Users can turn Wi-Fi audio on and off in the TWS app and send commands to the Wi-Fi audio control service process (Java layer) in the dashed box below via AIDL.
[0094] In some embodiments of this application, Figure 5 The process interaction interface in the Wi-Fi audio control service process (Java layer) can serve as the interface between the audio playback control application and the control manager in the Wi-Fi audio control service process (Java layer). This control manager may include a thread message loop management component for managing the Audio / Video Remote Control Profile Execute (AVRCP), AudioTransport Selector, and Connect Manager, and connects to the Bluetooth command interface (BT command) and Command Delegate interface, respectively.
[0095] In some embodiments of this application, the aforementioned audio and video remote control execution module can transmit instructions with the Android Input System. The audio and video remote control execution module is used to execute instructions from the audio playback device to perform operations such as skipping to the next song, pausing, and adjusting the volume.
[0096] In some embodiments of this application, the audio transmission selector can transmit instructions with the audio framework layer. The audio transmission selector is used to determine whether to use the Wi-Fi transmission path and transmits the decision to use the Wi-Fi transmission path to the Wi-Fi Audio Policy in the system framework layer of the electronic device, so that the Wi-Fi Audio Policy can control audio routing and decide whether to use the Wi-Fi transmission path or the Bluetooth transmission path to transmit audio data.
[0097] In some embodiments of this application, the connection manager can transmit instructions with the Wi-Fi connection dock. The connection manager is responsible for sending start or exit commands to the Wi-Fi Framework of the audio playback device, obtaining the IP and MAC addresses of the audio playback device, and reading event information.
[0098] In some embodiments of this application, the Bluetooth command interface described above is used to interact with the Bluetooth module of an audio playback device.
[0099] In some embodiments of this application, the command delegation interface sends and receives instructions from the audio playback device via JNI, specifically through the Wi-Fi audio streaming service process, network stack, and Wi-Fi module.
[0100] In some embodiments of this application, Figure 6 The dashed box in the lower right corner shows the Wi-Fi audio streaming service process (Native layer). This Wi-Fi audio streaming service process (Native layer) includes a data encapsulation module (xplay), a remote procedure call wrapper (RPC wrapper), and a remote procedure call module (RPC).
[0101] The data encapsulation module encapsulates audio PCM data, status information from the Connect Manager, and the address of the audio playback device into RTP data packets, which are then transmitted to the audio playback device via the Wi-Fi module. The remote procedure call module sends and receives control commands and transmits them to the audio playback device via the Wi-Fi module.
[0102] In some embodiments of this application, the audio framework layer of the electronic device is used to send audio data and audio format parameters to the audio hardware abstraction layer, and to send audio data and audio format parameters to the Wi-Fi audio streaming media service process through the Wi-Fi audio hardware abstraction interface of the audio hardware abstraction layer. The data encapsulation module in the Wi-Fi audio streaming media service process encapsulates the audio data according to the audio format parameters to obtain audio data packets, and then transmits the audio data packets to the network stack, sends them to the Wi-Fi module through the network stack, and then transmits them to the audio player through the Wi-Fi module.
[0103] The audio playback system provided in this application embodiment provides a Wi-Fi-based control channel and audio data transmission capability between the electronic device and the audio playback device through a Wi-Fi streaming media service process. Therefore, by adding a Wi-Fi streaming media service process to the hardware abstraction layer, the transmission of audio data between the electronic device and the audio playback device does not require a wired connection between the DSP and the Wi-Fi hardware to support Wi-Fi data transmission. This places no restrictions on the hardware of the electronic device and the audio playback device, allowing the solution for transmitting audio data via Wi-Fi technology to be used on any platform, thus improving the compatibility of the solution.
[0104] The audio transmission method provided in this application can be executed by an audio transmission device. Exemplarily, the audio transmission device can be an electronic device, or a functional component or entity within that electronic device. The following will use an electronic device as an example to illustrate the audio transmission method provided in this application.
[0105] Figure 7 This is a flowchart illustrating an audio transmission method provided in an embodiment of this application. The method may include the following steps 601 and 602.
[0106] Step 601: When the system framework layer receives the first audio data transmitted from the application layer, the electronic device transmits the first audio data to the hardware abstraction layer through the system framework layer.
[0107] Step 602: When the use of Wi-Fi transmission path is determined through the hardware abstraction layer, the electronic device transmits the first audio data to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer, and transmits the first audio data to the audio playback device through the Wi-Fi module.
[0108] In some embodiments of this application, after step 601 above, the audio transmission method provided in the embodiments of this application may further include the following step 600.
[0109] Step 600: The electronic device transmits the first audio data to the Wi-Fi audio streaming service process through the Wi-Fi audio hardware abstraction interface in the hardware abstraction layer.
[0110] In some embodiments of this application, the step 602 above, "transmitting the first audio data to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer", can be specifically accomplished through the following steps 6021 and 6022.
[0111] Step 6021: The electronic device packages the first audio data through the Wi-Fi audio streaming service process to obtain the first audio data packet.
[0112] Step 6022: The electronic device transmits the first audio data packet to the Wi-Fi module through the Wi-Fi audio streaming service process.
[0113] In some embodiments of this application, the step 602 above, "when the use of a wireless local area network (Wi-Fi) transmission path is determined through the hardware abstraction layer, the first audio data is transmitted to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer", can be specifically implemented by step 6023.
[0114] Step 6023: If the Wi-Fi audio streaming service process determines that the available transmission path is a Wi-Fi transmission path, the electronic device transmits the first audio data to the Wi-Fi module through the Wi-Fi audio streaming service process.
[0115] In some embodiments of this application, the audio transmission method provided in this application may further include the following steps 603 and 604.
[0116] Step 603: If the available transmission path is determined to be a Bluetooth transmission path through the Bluetooth audio hardware abstraction interface in the hardware abstraction layer, the electronic device transmits the first audio data to the Bluetooth module of the electronic device through the Bluetooth audio hardware abstraction interface.
[0117] Step 604: The electronic device transmits the first audio data to the audio playback device via the Bluetooth module.
[0118] In some embodiments of this application, the audio transmission method provided in this application may further include the following steps 605 and 606.
[0119] Step 605: When the Wi-Fi transmission path and Bluetooth transmission path of the electronic device are enabled, the electronic device obtains the Wi-Fi signal quality from the system framework layer through the Wi-Fi audio control service process in the application layer, and sends a first instruction to the Wi-Fi audio streaming service process and the Wi-Fi audio decision module in the system framework layer based on the Wi-Fi signal quality. The first instruction is used to indicate whether to use the Wi-Fi transmission path.
[0120] Step 606: The electronic device sends a second instruction to the Bluetooth audio hardware abstraction interface in the hardware abstraction layer based on the first instruction via the Wi-Fi audio decision module. The second instruction is used to indicate the available data transmission path.
[0121] In some embodiments of this application, the Wi-Fi audio decision module incorporates a scene-adaptive dynamic path decision mechanism, which can achieve optimal power consumption while ensuring sound quality. This dynamic path decision mechanism includes a mechanism for dynamically switching playback paths based on the audio source sampling rate, an arbitration mechanism for simultaneous playback of multiple applications, and a notification tone anchoring mechanism.
[0122] In some embodiments of this application, the mechanism for dynamically switching playback paths based on the audio source sampling rate refers to enabling the Wi-Fi transmission path and the Bluetooth transmission path when the sampling rate of the first audio data is greater than a first threshold, and enabling the Bluetooth transmission path when the sampling rate of the first audio data is less than or equal to the first threshold.
[0123] In this way, in low-quality scenarios (such as voice calls and notification sounds), audio data is not transmitted through the Wi-Fi transmission path, which can reduce the waste of air interface resources and reduce power consumption.
[0124] In some embodiments of this application, the multi-application simultaneous playback arbitration mechanism refers to the following: when multiple audio sources are playing simultaneously, the sampling rate of each audio source is detected. If the sampling rate of any one audio source is greater than a first threshold, the Wi-Fi transmission path and the Bluetooth transmission path are opened; otherwise, the Bluetooth transmission path is opened. Furthermore, this solution adopts a multi-application conflict arbitration strategy, which can unify the data transmission path according to the highest sound quality requirement when multiple audio sources are playing simultaneously.
[0125] Thus, when music (high-quality audio) and games (low-latency audio) transmit audio data simultaneously, a fixed path cannot meet the differentiated needs. Adding an arbitration mechanism for simultaneous playback of multiple applications to decide whether to use the Wi-Fi or Bluetooth transmission path can meet the differentiated needs of audio data transmission.
[0126] In some embodiments of this application, the notification tone anchoring mechanism means that when the Wi-Fi audio decision module recognizes that the audio data includes a notification tone, no data transmission path is switched regardless of whether the sampling rate of the audio data is greater than a first threshold or whether the Wi-Fi signal quality is good.
[0127] Therefore, by adding a notification sound anchoring mechanism for audio data such as information prompts, screenshot sounds, typing prompts, and touch screen prompts during music playback, the transmission path of these audio data is not switched, thus avoiding stuttering issues caused by frequent switching of data transmission paths.
[0128] In some embodiments of this application, after "sending a first instruction to the Wi-Fi audio streaming media service process based on Wi-Fi signal quality" in step 605 above, the audio transmission method provided in this application embodiment may further include the following step 607.
[0129] Step 607: If the first instruction indicates that the Wi-Fi transmission path is not used, the electronic device stops sending audio data to the Wi-Fi module through the Wi-Fi audio streaming service process.
[0130] In some embodiments of this application, after step 606 above, the audio transmission method provided in the embodiments of this application may further include the following step 608.
[0131] Step 608: If the second instruction indicates that the available data transmission path is the Wi-Fi transmission path, the electronic device stops sending audio data to the Bluetooth module of the electronic device through the Bluetooth audio hardware abstraction interface.
[0132] In some embodiments of this application, the first audio data mentioned above includes at least one data channel, and the audio transmission method provided in the embodiments of this application may further include the following step 609.
[0133] Step 609: The electronic device obtains the sampling rate of the first audio data through the Wi-Fi audio decision module. If the sampling rate of any channel of the first audio data is greater than the first threshold, the Wi-Fi transmission channel and the Bluetooth transmission channel are turned on.
[0134] In some embodiments of this application, the audio transmission method provided in this application may further include the following steps 610 and 611.
[0135] Step 610: When an audio control command is received at the system framework layer, the electronic device transmits the audio control command to the hardware abstraction layer through the system framework layer. The audio control command is used to pause, play, or switch audio data.
[0136] Step 611: The electronic device transmits audio control commands to the Wi-Fi module or the Bluetooth module of the electronic device through the hardware abstraction layer, and transmits the audio control commands to the audio playback device through the Wi-Fi module or the Bluetooth module.
[0137] In some embodiments of this application, the audio transmission method provided in this application may further include the following steps 612 and 613.
[0138] Step 612: When the Wi-Fi audio switch is turned on in the audio playback control application of the electronic device, the electronic device sends the Wi-Fi audio switch turned on information to the Wi-Fi audio control service process in the application layer through the audio playback control application in the application layer of the electronic device.
[0139] Step 613: The electronic device sends a message that the Wi-Fi audio switch is turned on to the Wi-Fi audio streaming media service process through the Wi-Fi audio control service process.
[0140] This application's embodiments, through an innovative Wi-Fi Audio HAL and a dual-service layered architecture (Wi-Fi AudioControl Service and Wi-Fi Audio Streaming Service), completely bypass Qualcomm's proprietary DSP interface, enabling cross-platform operation on the Android operating system. Furthermore, this solution proposes a strategy for automatically selecting the path based on audio scene characteristics (sampling rate / application type), achieving optimal power consumption while ensuring sound quality.
[0141] It should be noted that the specific implementation process of steps 601 and 602 and other steps can be found in the relevant descriptions of the above embodiments. To avoid repetition, these will not be repeated here.
[0142] It should be noted that the various method embodiments or system embodiments described above, or the various possible implementations of the various method embodiments or system embodiments, can be executed individually or in combination of any two or more. The specific implementation can be determined according to actual usage requirements, and the embodiments of this application do not impose any restrictions on this.
[0143] The audio transmission method provided in this application can be executed by an audio transmission device. This application uses an audio transmission device executing the audio transmission method as an example to illustrate the audio transmission device provided in this application.
[0144] Figure 8 This is a schematic diagram of the structure of an audio transmission device provided in an embodiment of this application. The audio transmission device includes a transmission module 701.
[0145] The transmission module 701 is configured to, when receiving first audio data transmitted from the application layer at the system framework layer, transmit the first audio data to the hardware abstraction layer via the system framework layer; and, when determining via the hardware abstraction layer to use a Wi-Fi transmission path, transmit the first audio data to the Wi-Fi module of the electronic device via the Wi-Fi audio streaming service process in the hardware abstraction layer, and transmit the first audio data to an audio playback device connected to the electronic device via the Wi-Fi module.
[0146] In some embodiments of this application, the transmission module 701 described above is further configured to transmit the first audio data to the Wi-Fi audio streaming service process through the Wi-Fi audio hardware abstraction interface in the hardware abstraction layer.
[0147] In some embodiments of this application, the device further includes a processing module for packaging the first audio data through a Wi-Fi audio streaming service process to obtain a first audio data packet.
[0148] The aforementioned transmission module 701 is specifically used to transmit the first audio data packet to the Wi-Fi module through the Wi-Fi audio streaming media service process.
[0149] In some embodiments of this application, the transmission module 701 is specifically used to transmit the first audio data to the Wi-Fi module through the Wi-Fi audio streaming media service process when the Wi-Fi audio streaming media service process determines that the available transmission path is a Wi-Fi transmission path.
[0150] In some embodiments of this application, the transmission module 701 is further configured to transmit the first audio data to the Bluetooth module of the electronic device via the Bluetooth audio hardware abstraction interface when the usable transmission path is determined to be a Bluetooth transmission path through the Bluetooth audio hardware abstraction interface in the hardware abstraction layer; and to transmit the first audio data to the audio playback device via the Bluetooth module.
[0151] In some embodiments of this application, the transmission module 701 is further configured to, when the Wi-Fi transmission path and Bluetooth transmission path of the electronic device are enabled, obtain the Wi-Fi signal quality from the system framework layer through the Wi-Fi audio control service process in the application layer, and send a first instruction to the Wi-Fi audio streaming media service process and the Wi-Fi audio decision module in the system framework layer based on the Wi-Fi signal quality, the first instruction being used to indicate whether to use the Wi-Fi transmission path; and, through the Wi-Fi audio decision module, send a second instruction to the Bluetooth audio hardware abstraction interface in the hardware abstraction layer based on the first instruction, the second instruction being used to indicate the available data transmission path.
[0152] In some embodiments of this application, the transmission module 701 is further configured to, after sending a first instruction to the Wi-Fi audio streaming media service process based on the Wi-Fi signal quality, stop sending audio data to the Wi-Fi module through the Wi-Fi audio streaming media service process if the first instruction indicates that the Wi-Fi transmission path is not used.
[0153] In some embodiments of this application, the transmission module 701 is further configured to, after sending a second instruction to the Bluetooth audio hardware abstraction interface in the hardware abstraction layer based on the first instruction via the Wi-Fi audio decision module, stop sending audio data to the Bluetooth module of the electronic device via the Bluetooth audio hardware abstraction interface when the second instruction indicates that the available data transmission path is the Wi-Fi transmission path.
[0154] In some embodiments of this application, the first audio data includes at least one data channel. The processing module is further configured to obtain the sampling rate of the first audio data through the Wi-Fi audio decision module, and to enable the Wi-Fi transmission channel and the Bluetooth transmission channel when the sampling rate of any data channel in the first audio data is greater than a first threshold.
[0155] In some embodiments of this application, the transmission module 701 is further configured to, upon receiving an audio control command at the system framework layer, transmit the audio control command to the hardware abstraction layer via the system framework layer, wherein the audio control command is used to pause, play, or switch audio data; and transmit the audio control command to the Wi-Fi module or the Bluetooth module of the electronic device via the hardware abstraction layer, and transmit the audio control command to the audio playback device via the Wi-Fi module or the Bluetooth module.
[0156] In some embodiments of this application, the transmission module 701 is further configured to send a Wi-Fi audio switch enabled information to the Wi-Fi audio control service process in the application layer of the electronic device when the Wi-Fi audio switch in the audio playback control application of the electronic device is enabled; and to send the Wi-Fi audio switch enabled information to the Wi-Fi audio streaming media service process through the Wi-Fi audio control service process.
[0157] The audio transmission device provided in this application embodiment provides a Wi-Fi-based control channel and Wi-Fi-based audio data transmission capability between the electronic device and the audio playback device through a Wi-Fi streaming media service process. Therefore, by adding a Wi-Fi streaming media service process to the hardware abstraction layer, when transmitting audio data between the electronic device and the audio playback device, there is no need to support the data transmission of the Wi-Fi path through a wired connection between the DSP and the Wi-Fi hardware. This places no restrictions on the hardware of the electronic device and the audio playback device, making the solution for transmitting audio data via Wi-Fi technology usable on any platform and improving the compatibility of the solution.
[0158] The audio transmission device in this application embodiment can be an electronic device or a component within an electronic device, such as an integrated circuit or a chip. The electronic device can be a terminal or other devices besides a terminal. For example, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device, augmented reality / virtual reality device, robot, wearable device, super mobile personal computer, netbook, or personal digital assistant, etc. It can also be a server, network attached storage (NAS), personal computer (PC), television (TV), ATM, or self-service machine, etc. This application embodiment does not specifically limit the specific implementation.
[0159] The audio transmission device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.
[0160] The audio transmission device provided in this application can implement the various processes implemented in the various embodiments of the above-described audio transmission method. To avoid repetition, it will not be described again here.
[0161] Optionally, such as Figure 9 As shown, this application embodiment also provides an electronic device 900, including a processor 901 and a memory 902. The memory 902 stores a program or instructions that can run on the processor 901. When the program or instructions are executed by the processor 901, they implement the various steps of the above-described audio transmission method embodiment and can achieve the same technical effect. To avoid repetition, they will not be described again here.
[0162] It should be noted that the electronic devices in the embodiments of this application include the mobile electronic devices and non-mobile electronic devices described above.
[0163] Figure 9 A schematic diagram of the hardware structure of an electronic device to implement an embodiment of this application.
[0164] The electronic device 1000 includes, but is not limited to, components such as: radio frequency unit 1001, network module 1002, audio output unit 1003, input unit 1004, sensor 1005, display unit 1006, user input unit 1007, interface unit 1008, memory 1009, and processor 1010.
[0165] Those skilled in the art will understand that the electronic device 1000 may also include a power supply (such as a battery) for supplying power to various components. The power supply may be logically connected to the processor 1010 through a power management system, thereby enabling functions such as managing charging, discharging, and power consumption through the power management system. The electronic device structure shown does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown, or combine certain components, or have different component arrangements, which will not be elaborated here.
[0166] The radio frequency unit 1001 is configured to, when receiving first audio data transmitted from the application layer at the system framework layer, transmit the first audio data to the hardware abstraction layer through the system framework layer; and, when determining through the hardware abstraction layer to use a wireless local area network (Wi-Fi) transmission path, transmit the first audio data to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer, and transmit the first audio data to an audio playback device connected to the electronic device through the Wi-Fi module.
[0167] In some embodiments of this application, the radio frequency unit 1001 described above is also used to transmit the first audio data to the Wi-Fi audio streaming service process through the Wi-Fi audio hardware abstraction interface in the hardware abstraction layer.
[0168] In some embodiments of this application, the processor 1010 is configured to package the first audio data through a Wi-Fi audio streaming service process to obtain a first audio data packet.
[0169] The aforementioned radio frequency unit 1001 is specifically used to transmit the first audio data packet to the Wi-Fi module through the Wi-Fi audio streaming media service process.
[0170] In some embodiments of this application, the radio frequency unit 1001 is specifically used to transmit the first audio data to the Wi-Fi module through the Wi-Fi audio streaming media service process when the available transmission path is determined to be a Wi-Fi transmission path through the Wi-Fi audio streaming media service process.
[0171] In some embodiments of this application, the radio frequency unit 1001 is further configured to transmit the first audio data to the Bluetooth module of the electronic device via the Bluetooth audio hardware abstraction interface when the usable transmission path is determined to be a Bluetooth transmission path through the Bluetooth audio hardware abstraction interface in the hardware abstraction layer; and to transmit the first audio data to the audio playback device via the Bluetooth module.
[0172] In some embodiments of this application, the radio frequency unit 1001 is further configured to, when the Wi-Fi transmission path and Bluetooth transmission path of the electronic device are enabled, obtain the Wi-Fi signal quality from the system framework layer through the Wi-Fi audio control service process in the application layer, and send a first instruction to the Wi-Fi audio streaming media service process and the Wi-Fi audio decision module in the system framework layer based on the Wi-Fi signal quality, the first instruction being used to indicate whether to use the Wi-Fi transmission path; and, through the Wi-Fi audio decision module, send a second instruction to the Bluetooth audio hardware abstraction interface in the hardware abstraction layer based on the first instruction, the second instruction being used to indicate the available data transmission path.
[0173] In some embodiments of this application, the radio frequency unit 1001 is further configured to, after sending a first instruction to the Wi-Fi audio streaming media service process based on the Wi-Fi signal quality, stop sending audio data to the Wi-Fi module through the Wi-Fi audio streaming media service process when the first instruction indicates that the Wi-Fi transmission path is not used.
[0174] In some embodiments of this application, the radio frequency unit 1001 is further configured to, after sending a second instruction to the Bluetooth audio hardware abstraction interface in the hardware abstraction layer based on a first instruction via the Wi-Fi audio decision module, stop sending audio data to the Bluetooth module of the electronic device via the Bluetooth audio hardware abstraction interface when the second instruction indicates that the available data transmission path is a Wi-Fi transmission path.
[0175] In some embodiments of this application, the first audio data includes at least one data channel. The processor 1010 is further configured to obtain the sampling rate of the first audio data through the Wi-Fi audio decision module, and to enable the Wi-Fi transmission channel and the Bluetooth transmission channel when the sampling rate of any data channel in the first audio data is greater than a first threshold.
[0176] In some embodiments of this application, the radio frequency unit 1001 is further configured to, upon receiving an audio control command at the system framework layer, transmit the audio control command to the hardware abstraction layer via the system framework layer, wherein the audio control command is used to pause, play, or switch audio data; and transmit the audio control command to the Wi-Fi module or the Bluetooth module of the electronic device via the hardware abstraction layer, and transmit the audio control command to the audio playback device via the Wi-Fi module or the Bluetooth module.
[0177] In some embodiments of this application, the radio frequency unit 1001 is further configured to send a Wi-Fi audio switch enabled information to the Wi-Fi audio control service process in the application layer of the electronic device through the audio playback control application in the application layer when the Wi-Fi audio switch is enabled; and to send the Wi-Fi audio switch enabled information to the Wi-Fi audio streaming media service process through the Wi-Fi audio control service process.
[0178] The electronic device provided in this application embodiment provides a Wi-Fi-based control channel and Wi-Fi-based audio data transmission capability between the electronic device and the audio playback device through a Wi-Fi streaming media service process. Therefore, by adding a Wi-Fi streaming media service process to the hardware abstraction layer, when transmitting audio data between the electronic device and the audio playback device, there is no need to support the data transmission of the Wi-Fi path through a wired connection between the DSP and the Wi-Fi hardware. This places no restrictions on the hardware of the electronic device and the audio playback device, making the solution for transmitting audio data through Wi-Fi technology usable on any platform and improving the compatibility of the solution for transmitting audio data through Wi-Fi technology.
[0179] It should be understood that, in this embodiment, the input unit 1004 may include a graphics processing unit (GPU) 10041 and a microphone 10042. The GPU 10041 processes image data of still images or videos obtained by an image capture device (such as a camera) in video capture mode or image capture mode. The display unit 1006 may include a display panel 10061, which may be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes at least one of a touch panel 10071 and other input devices 10072. The touch panel 10071 is also called a touch screen. The touch panel 10071 may include a touch detection device and a touch controller. Other input devices 10072 may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, joysticks, etc., which will not be described in detail here.
[0180] The memory 1009 can be used to store software programs and various data. The memory 1009 may primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area may store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, the memory 1009 may include volatile memory or non-volatile memory, or both. The non-volatile memory may be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous link dynamic random access memory (SLDRAM), and direct memory bus RAM (DRRAM). The memory 1009 in this embodiment includes, but is not limited to, these and any other suitable types of memory.
[0181] The processor 1010 may include one or more processing units; optionally, the processor 1010 integrates an application processor and a modem processor, wherein the application processor mainly handles operations involving the operating system, user interface, and applications, and the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor 1010.
[0182] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described audio transmission method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.
[0183] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.
[0184] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above-described audio transmission method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0185] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.
[0186] This application provides a computer program product, which is stored in a storage medium and executed by at least one processor to implement the various processes of the audio transmission method embodiments described above, and can achieve the same technical effect. To avoid repetition, it will not be described again here.
[0187] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.
[0188] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a computer software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0189] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.
Claims
1. An audio transmission method, characterized by, The method is applied to an electronic device connected with an audio playing device, and comprises the following steps: In the case that the system framework layer receives the first audio data transmitted by the application layer, transmitting the first audio data to the hardware abstraction layer through the system framework layer; In the case that the hardware abstraction layer determines to use a wireless local area network (Wi-Fi) transmission path, transmitting the first audio data to a Wi-Fi module of the electronic device through a Wi-Fi audio streaming service process in the hardware abstraction layer, and transmitting the first audio data to the audio playing device through the Wi-Fi module.
2. The method of claim 1, wherein, After the step of transmitting the first audio data to the hardware abstraction layer through the system framework layer, the method further comprises the following steps: Transmitting the first audio data to the Wi-Fi audio streaming service process through a Wi-Fi audio hardware abstraction interface in the hardware abstraction layer.
3. The method of claim 1, wherein, The step of transmitting the first audio data to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer comprises the following steps: Packing the first audio data through the Wi-Fi audio streaming service process to obtain a first audio data packet; Transmitting the first audio data packet to the Wi-Fi module through the Wi-Fi audio streaming service process.
4. The method of claim 1, wherein, The step of transmitting the first audio data to the Wi-Fi module of the electronic device through the Wi-Fi audio streaming service process in the hardware abstraction layer comprises the following steps: In the case that the Wi-Fi audio streaming service process determines that the available transmission path is a Wi-Fi transmission path, transmitting the first audio data to the Wi-Fi module through the Wi-Fi audio streaming service process.
5. The method of claim 1, wherein, The method further comprises the following steps: In the case that a Bluetooth audio hardware abstraction interface in the hardware abstraction layer determines that the available transmission path is a Bluetooth transmission path, transmitting the first audio data to a Bluetooth module of the electronic device through the Bluetooth audio hardware abstraction interface; Transmitting the first audio data to the audio playing device through the Bluetooth module.
6. The method according to claim 4 or 5, characterized in that, The method further comprises the following steps: In the case that the Wi-Fi transmission path and the Bluetooth transmission path of the electronic device are turned on, acquiring a Wi-Fi signal quality from the system framework layer through a Wi-Fi audio control service process in the application layer, and based on the Wi-Fi signal quality, sending a first instruction to a Wi-Fi audio streaming service process and a Wi-Fi audio decision module in the system framework layer, the first instruction being used to indicate whether to use the Wi-Fi transmission path; Based on the first instruction, sending a second instruction to a Bluetooth audio hardware abstraction interface in the hardware abstraction layer through the Wi-Fi audio decision module, the second instruction being used to indicate the available data transmission path.
7. The method of claim 6, wherein, The method further comprises the following steps: stop sending audio data to the Wi-Fi module through the Wi-Fi audio streaming service process in a case where the first instruction indicates that the Wi-Fi transmission path is not to be used; stop sending audio data to the Bluetooth module of the electronic device through the Bluetooth audio hardware abstraction interface in a case where the second instruction indicates that the Wi-Fi transmission path is available.
8. The method of claim 6, wherein, The first audio data includes at least one piece of data, and the method further includes: acquiring a sampling rate of the first audio data through the Wi-Fi audio decision module, and starting the Wi-Fi transmission path and the Bluetooth transmission path in a case where the sampling rate of any piece of data in the first audio data is greater than a first threshold.
9. The method of claim 1, wherein, The method further includes: receiving an audio control instruction at the system framework layer, and transmitting the audio control instruction to the hardware abstraction layer through the system framework layer, wherein the audio control instruction is used to pause, play, or switch audio data; transmitting the audio control instruction to the Wi-Fi module or the Bluetooth module of the electronic device through the hardware abstraction layer, and transmitting the audio control instruction to the audio playback device through the Wi-Fi module or the Bluetooth module.
10. The method of claim 1, wherein, The method further includes: in a case where a Wi-Fi audio switch in an audio playback control application of the electronic device is turned on, sending Wi-Fi audio switch turned on information to a Wi-Fi audio control service process in the application layer through the audio playback control application in the application layer of the electronic device; sending the Wi-Fi audio switch turned on information to the Wi-Fi audio streaming service process through the Wi-Fi audio control service process.
11. An audio transmission system characterized by The electronic device is connected with an audio playback device, and the audio playback system includes an application layer, a system framework layer, a hardware abstraction layer, and a wireless local area network (Wi-Fi) module. The hardware abstraction layer includes a Wi-Fi audio streaming service process. The system framework layer is configured to receive first audio data transmitted by the application layer and transmit the first audio data to the hardware abstraction layer. The hardware abstraction layer is configured to determine an available data transmission path. The Wi-Fi audio streaming service process is configured to transmit the first audio data to the Wi-Fi module in a case where the available data transmission path is a Wi-Fi transmission path. The Wi-Fi module is configured to transmit the first audio data to the audio playback device.
12. The system of claim 11, wherein, The hardware abstraction layer further includes a Wi-Fi audio hardware abstraction interface. The Wi-Fi audio hardware abstraction interface is configured to receive the first audio data from the system framework layer and transmit the first audio data to the Wi-Fi audio streaming service process.
13. The system of claim 11, wherein, The Wi-Fi audio streaming service process is specifically configured to determine an available transmission path, and transmit the first audio data to the Wi-Fi module in a case where the available transmission path is a Wi-Fi transmission path.
14. The system of claim 11, wherein, The hardware abstraction layer comprises a Bluetooth audio hardware abstraction interface, and the audio playback system comprises a Bluetooth module; The Bluetooth audio hardware abstraction interface is configured to, in a case where it is determined that the available transmission channel is a Bluetooth transmission channel, transmit the first audio data to the Bluetooth module. The Bluetooth module is configured to transmit the first audio data to the audio playback device.
15. The system of claim 13 or 14, characterized in that, The application layer comprises a Wi-Fi audio control service process, and the system framework layer further comprises a Wi-Fi audio decision module; The Wi-Fi audio control service process is configured to, in a case where a Wi-Fi transmission channel and a Bluetooth transmission channel of the electronic device are enabled, acquire a Wi-Fi signal quality from the system framework layer, and based on the Wi-Fi signal quality, send a first instruction to the Wi-Fi audio streaming service process and the Wi-Fi audio decision module, the first instruction being configured to indicate whether to use the Wi-Fi transmission channel. The Wi-Fi audio decision module is configured to, based on the received first instruction, send a second instruction to a Bluetooth audio hardware abstraction interface in the hardware abstraction layer, the second instruction being configured to indicate an available data transmission channel.
16. An audio transmission device, characterized by The apparatus comprises a transmission module configured to: In a case where the system framework layer receives first audio data transmitted by the application layer, transmit the first audio data to the hardware abstraction layer through the system framework layer; In a case where it is determined through the hardware abstraction layer that a wireless local area network (Wi-Fi) transmission channel is used, transmit the first audio data to a Wi-Fi module of the electronic device through a Wi-Fi audio streaming service process in the hardware abstraction layer, and transmit the first audio data to an audio playback device connected to the electronic device through the Wi-Fi module.
17. An electronic device, comprising: A processor and a memory are included, the memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the audio transmission method according to any one of claims 1 to 10.
18. A readable storage medium, characterized by, A readable storage medium stores programs or instructions, and the programs or instructions are executed by a processor to implement the steps of the audio transmission method according to any one of claims 1 to 10.