Audio data transmission method and electronic equipment
By receiving the unpacking capability message of the second electronic device in the first electronic device and processing the audio data stream according to its own packetization capability, the transmission error problem caused by different versions of audio data transmission technology is solved, and the normal transmission and playback of audio data is achieved.
Patent Information
- Application Number
- CN202311583408.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-24
- Publication Date
- 2025-06-03
- Estimated Expiration
- 2043-11-24
AI Technical Summary
In the interconnection scenario of two electronic devices, when different versions of audio data transmission technology are used, it may cause an error in the audio data transmission and the audio cannot be played normally.
By receiving the data channel establishment message sent by the second electronic device in the first electronic device, the unpacking capability of the second electronic device is determined, and the audio data packet adapted to the unpacking capability of the second electronic device is determined based on its own packaging capability, and an audio data packet adapted to the unpacking capability of the second electronic device is generated.
It realizes compatibility between different versions of audio data transmission technologies, ensures that the audio data can be transmitted and played normally, and improves the reliability of data transmission in interconnected scenarios.
Smart Images

Figure CN120091359A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the technical field of terminals, and particularly relates to an audio data transmission method and an electronic device. Background Art
[0002] In the scenario of interconnection between two electronic devices (for example, the interconnection scenario between a mobile phone and a car radio or the interconnection scenario between a mobile phone and a tablet computer), one electronic device can stream audio to another electronic device to play the audio through the other electronic device.
[0003] Among them, the audio data transmission technologies adopted by the two electronic devices may include different versions. For example, for the new version of the audio data transmission technology, it has the ability to packetize and depacketize audio data. For the old version of the audio data transmission technology, it does not have the ability to packetize and depacketize audio data.
[0004] In this way, if the two interconnected electronic devices adopt different versions of the audio data transmission technology, during the audio data transmission process, it may cause an error in the audio data transmission due to the incompatibility of the audio data transmission technology versions, resulting in the inability to play the audio normally. Summary of the Invention
[0005] This application provides an audio data transmission method and an electronic device, which can be compatible with the scenario of audio data transmission using different versions of audio data transmission technologies.
[0006] In a first aspect, this application provides an audio data transmission method, which is applied to a first electronic device. The method includes: when establishing an audio data channel, the first electronic device receives a data channel establishment message sent by a second electronic device; the data channel establishment message is used to indicate the depacketization ability of the second electronic device; the first electronic device processes at least one audio data stream to obtain an audio data packet according to the packetization ability of the first electronic device and the data channel establishment message; wherein, in the case that the second electronic device does not have the depacketization ability, the audio data packet is a single-packet data packet; in the case that the first electronic device has the packetization ability and the second electronic device has the depacketization ability, the audio data packet is a packetized data packet; the first electronic device sends the audio data packet to the second electronic device.
[0007] In this way, the first electronic device can decide whether to perform packetization processing on the audio data stream based on the depacketization ability of the second electronic device and the packetization ability of the first electronic device, so as to ensure that the data packet type of the obtained audio data packet can be adapted to the depacketization ability of the second electronic device.
[0008] In one implementable manner, the first electronic device processes at least one audio data stream to be sent according to the packet combining ability of the first electronic device and the data channel establishment message, to obtain audio data packets, including: when the first electronic device has the packet combining ability and the second electronic device has the packet splitting ability, the first electronic device performs packet combining processing on at least one audio data stream to be sent, to obtain audio data packets; wherein, the audio data packets include a packet combining type identifier, and the packet combining type identifier is used to identify the audio data packets as packet combined data packets.
[0009] In this way, after receiving the audio data packets, the second electronic device can determine that the audio data packets are packet combined data packets based on the packet combining type identifier in the audio data packets. Furthermore, based on the fact that the audio data packets are packet combined data packets, the second electronic device can perform packet splitting processing on the audio data packets. In this way, since the second electronic device has the packet splitting ability and the audio data packets received by the second electronic device are packet combined data packets. Therefore, the second electronic device can perform a normal packet splitting processing procedure on the received packet combined data packets.
[0010] In one implementable manner, the first electronic device processes at least one audio data stream to be sent according to the packet combining ability of the first electronic device and the data channel establishment message, to obtain audio data packets, including: when the first electronic device does not have the packet combining ability or the second electronic device does not have the packet splitting ability, the first electronic device performs single packet processing on at least one audio data stream to be sent, to obtain at least one audio data packet; wherein, each of the at least one audio data packets includes a single packet type identifier, and the single packet type identifier is used to identify each audio data packet as a single packet data packet.
[0011] In this way, the first electronic device can, based on the fact that the first electronic device does not have the packet combining ability or the second electronic device does not have the packet splitting ability, not perform packet combining processing on the audio data stream. Correspondingly, after receiving the audio data packets, the second electronic device can determine that the audio data packets are single packet data packets based on the single packet type identifier in the audio data packets. Furthermore, based on the fact that the audio data packets are single packet data packets, the second electronic device does not perform packet splitting processing on the audio data packets. In this way, the second electronic device can perform a normal single packet receiving processing procedure on the received single packet data packets.
[0012] In one implementable manner, the single packet type identifier is the audio stream type of the audio data stream in the audio data packet.
[0013] In one implementable manner, when the second electronic device has the packet splitting ability, the data channel establishment message includes a packet splitting ability identifier; when the second electronic device does not have the packet splitting ability, the data channel establishment message does not include a packet splitting ability identifier.
[0014] In this way, after the first electronic device receives the data channel establishment message, if the data channel establishment message includes an unpacking ability identifier, the first electronic device can determine that the second electronic device has the unpacking ability. If the data channel establishment message does not include an unpacking ability identifier, the first electronic device can determine that the second electronic device does not have the unpacking ability.
[0015] In an implementable manner, when the second electronic device has the unpacking ability, the data channel establishment message includes a first unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message includes a second unpacking ability identifier; the first unpacking ability identifier is different from the second unpacking ability identifier.
[0016] In this way, after the first electronic device receives the data channel establishment message, if the data channel establishment message includes the first unpacking ability identifier, the first electronic device can determine that the second electronic device has the unpacking ability. If the data channel establishment message does not include the second unpacking ability identifier, the first electronic device can determine that the second electronic device does not have the unpacking ability.
[0017] In an implementable manner, when establishing an audio data channel, the first electronic device receives the data channel establishment message sent by the second electronic device, including: when the service type of the data channel is a speaker and the transmission type of the data channel is Magic Link, the first electronic device receives the data channel establishment message sent by the second electronic device.
[0018] In an implementable manner, the header of each audio data stream to be sent in at least one audio data stream to be sent carries version information. When the version information is the first version, the header of the audio data stream to be sent carries a channel number; the first electronic device performs packet combining processing on at least one audio data stream to be sent to obtain an audio data packet, including: when the version information carried in the header of the audio data stream to be sent is the first version, the first electronic device generates an audio stream type corresponding to each audio data stream to be sent; the first electronic device creates an audio encoder corresponding to each channel number according to the channel number; the first electronic device uses each audio encoder to perform encoding processing on the audio data stream to be sent with each channel number to obtain at least one encoded audio data stream; the first electronic device performs single-packet processing on at least one encoded audio data to obtain at least one single-packet data packet; wherein, the header of each single-packet data packet in at least one single-packet data packet includes the corresponding audio stream type; the first electronic device performs packet combining processing on at least one single-packet data packet to obtain a combined packet data packet.
[0019] In this way, the first electronic device can dynamically create an audio encoder and determine the number of dynamically created audio encoders based on the version information carried by the audio data stream to be sent being the first version.
[0020] In an implementable manner, the packet header of each audio data stream to be sent in at least one audio data stream to be sent carries version information. When the version information is the second version, the packet header of the audio data stream to be sent carries an audio stream type. The first electronic device performs single-packet processing on at least one audio data to be sent to obtain at least one audio data packet, including: when the version information carried by the packet header of the audio data stream to be sent is the second version, the first electronic device calls a static audio encoder; the first electronic device uses the static audio encoder to perform encoding processing on at least one audio data to be sent to obtain at least one encoded audio data stream; the first electronic device performs single-packet processing on at least one encoded audio data stream to obtain at least one single-packet data packet; wherein, the packet header of each single-packet data packet in at least one single-packet data packet includes the respective corresponding audio stream type.
[0021] In this way, the first electronic device can directly call a static audio encoder based on the version information carried by the audio data stream to be sent being the second version, without the need to dynamically create an audio encoder.
[0022] In a second aspect, the present application provides an audio data transmission method applied to a second electronic device. The method includes: when establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device; the data channel establishment message is used to indicate the unpacking ability of the second electronic device; the second electronic device receives the audio data packet sent by the first electronic device; the second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played.
[0023] In this way, when establishing an audio data channel, the second electronic device can inform the first electronic device of its unpacking ability through the data channel establishment message for the first electronic device to decide whether to perform packet combining processing on the audio data stream. After receiving the audio data packet, the second electronic device can decide whether to perform unpacking processing on the audio data packet based on the data packet type of the audio data packet. Specifically, if the audio data packet is a combined packet, the second electronic device performs unpacking processing on the audio data packet. If the audio data packet is a single-packet data packet, the second electronic device does not perform unpacking processing on the audio data packet.
[0024] In one implementable manner, the second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played, including: when the audio data packet includes a packet combining type identifier, the second electronic device unpacks the audio data to obtain at least one audio data stream to be played.
[0025] In one implementable manner, the second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played, including: when the audio data packet includes a single packet type identifier, the second electronic device performs single packet reception processing on the audio data to obtain the audio data stream to be played.
[0026] In one implementable manner, when the second electronic device has the unpacking ability, the data channel establishment message includes an unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message does not include the unpacking ability identifier.
[0027] In one implementable manner, when the second electronic device has the unpacking ability, the data channel establishment message includes a first unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message includes a second unpacking ability identifier; the first unpacking ability identifier is different from the second unpacking ability identifier.
[0028] In one implementable manner, when establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device, including: when the service type of the data channel is a speaker and the transmission type of the data channel is Magic Link, the second electronic device sends a data channel establishment message to the first electronic device.
[0029] In a third aspect, the present application provides an electronic device, which includes a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes the method according to any one of the first aspect or the second aspect.
[0030] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer programs or instructions are stored. When the computer programs or instructions run on a computer, the computer executes the method according to any one of the first aspect or the second aspect. Description of the Drawings
[0031] Figure 1 It is an application scenario diagram for the interconnection between the first electronic device 10 and the second electronic device 20 provided by the embodiments of the present application;
[0032] Figure 2Interconnection scenario diagram of the first electronic device 10 and the second electronic device 20 using different version audio data transmission technologies provided by the embodiments of the present application;
[0033] Figure 3 Schematic diagram of the hardware structure of an electronic device provided by the embodiments of the present application;
[0034] Figure 4 Software structure framework of an electronic device provided by the embodiments of the present application;
[0035] Figure 5 Module interaction diagram of an audio data transmission method provided by the embodiments of the present application;
[0036] Figure 6 Module interaction diagram of another audio data transmission method provided by the embodiments of the present application;
[0037] Figure 7A Schematic diagram of the shunt processing of the audio data stream by the first electronic device provided by the embodiments of the present application;
[0038] Figure 7B Schematic diagram of the non - shunt processing of the audio data stream by the first electronic device provided by the embodiments of the present application;
[0039] Figure 8 Workflow diagram of an audio data transmission method applied to the first electronic device provided by the embodiments of the present application;
[0040] Figure 9 Workflow diagram of an audio data transmission method applied to the second electronic device provided by the embodiments of the present application;
[0041] Figure 10 Structure block diagram of a chip provided by the embodiments of the present application. Detailed implementation manners
[0042] To facilitate the understanding of the technical solutions of the present application, the application scenarios of the present application are first described below.
[0043] Figure 1 Application scenario diagram of the interconnection between the first electronic device 10 and the second electronic device 20 provided by the embodiments of the present application. As Figure 1 shown, in the scenario of the interconnection between the first electronic device 10 and the second electronic device 20, after the first electronic device 10 and the second electronic device 20 establish a communication connection, the first electronic device 10 can stream audio to the second electronic device 20 for playing the audio through the speaker of the second electronic device 20. For example, the first electronic device 10 can transmit different types of audio data streams such as navigation, music, notifications, calls, etc. to the second electronic device 20.
[0044] Among them, the audio data transmission technologies adopted by the first electronic device 10 and the second electronic device 20 may include different versions.
[0045] Exemplarily, taking the first electronic device 10 as a mobile phone and the second electronic device 20 as a car head unit as an example. In the new version of the audio data transmission technology, when the first electronic device 10 transmits different types of audio data streams to the second electronic device 20, the first electronic device 10 has the shunt ability. In this way, the first electronic device 10 can transmit different types of audio data streams to the second electronic device 20 according to the audio stream type. The second electronic device 20 can extract different types of audio data streams such as navigation, music, and calls. When the first electronic device 10 shunt-transmits audio data streams of different audio stream types to the second electronic device 20, the first electronic device 10 can perform packet combining processing on the audio data streams of different audio stream types to obtain a combined packet data packet. Then, it sends the combined packet data packet to the second electronic device 20. Correspondingly, the second electronic device 20 can perform packet splitting processing on the combined packet data packet to obtain the audio data to be played. In this way, by transmitting the audio data streams of different audio stream types in the form of combined packet data packets, the data transmission efficiency can be improved. That is to say, the first electronic device 10 adopting the new version of the audio data transmission technology has the packet combining ability, and the second electronic device 20 adopting the new version of the audio data transmission technology has the packet splitting ability.
[0046] Another exemplarily, taking the first electronic device 10 as a mobile phone and the second electronic device 20 as a tablet computer as an example. In the old version of the audio data transmission technology, when the first electronic device 10 transmits different types of audio data streams to the second electronic device 20, the first electronic device 10 does not have the shunt ability. Therefore, the audio data stream sent by the first electronic device 10 to the second electronic device 20 is mixed audio data. In this case, the first electronic device 10 performs single-packet processing on the audio data stream to obtain a single-packet data packet. Then, it sends the single-packet data packet to the second electronic device 20. It can be seen that the first electronic device 10 does not need to perform packet combining processing on the audio data stream, and the second electronic device 20 does not need to perform packet splitting processing on the audio data stream. That is to say, the first electronic device 10 adopting the old version of the audio data transmission technology does not have the packet combining ability, and the second electronic device 20 adopting the old version of the audio data transmission technology does not have the packet splitting ability.
[0047] Among them, single-packet processing means encapsulating the mixed audio data stream into a small packet to form a single-packet data packet; or encapsulating the audio data stream of one audio stream type into a small packet to form a single-packet data packet.
[0048] Packet combining processing means that the audio data streams of each audio stream type are respectively encapsulated into a small packet, that is, a single-packet data packet. Then, all the single-packet data packets are encapsulated into a large packet to form a combined-packet data packet. That is to say, a combined-packet data packet can encapsulate one or more single-packet data packets.
[0049] In practical applications, the interconnected first electronic device 10 and second electronic device 20 may present four scenarios as Figure 2 shown. As Figure 2 shown in (a), both the first electronic device 10 and the second electronic device 20 adopt the new version of the audio data transmission technology. In this way, the first electronic device 10 has the ability to combine packets, and the second electronic device 20 has the ability to unpack packets. As Figure 2 shown in (b), both the first electronic device 10 and the second electronic device 20 adopt the old version of the audio data transmission technology. In this way, the first electronic device 10 does not have the ability to combine packets, and the second electronic device 20 does not have the ability to unpack packets. As Figure 2 shown in (c), the first electronic device 10 adopts the new version of the audio data transmission technology, and the second electronic device 20 adopts the old version of the audio data transmission technology. In this way, the first electronic device 10 has the ability to combine packets, and the second electronic device 20 does not have the ability to unpack packets. As Figure 2 shown in (d), the first electronic device 10 adopts the old version of the audio data transmission technology, and the second electronic device 20 adopts the new version of the audio data transmission technology. In this way, the first electronic device 10 does not have the ability to combine packets, and the second electronic device 20 has the ability to unpack packets.
[0050] Among them, Figure 2 in the scenarios shown in (a) and (b), since the audio data transmission technologies adopted by the two interconnected electronic devices are compatible, the audio data transmission is relatively reliable, and generally there will be no problem that the second electronic device 20 cannot play the audio normally due to audio data transmission problems. However, Figure 2 in the scenarios shown in (c) and (d), since the audio data transmission technologies adopted by the two interconnected electronic devices are not compatible, there may be a problem that the second electronic device 20 cannot play the audio normally due to incompatibility of the audio data transmission technology. For example, as Figure 2 shown in (c), after the first electronic device 10 performs packet combining processing on the audio data stream and sends it to the second electronic device 20. Since the second electronic device 20 does not have the ability to unpack packets, the second electronic device 20 cannot disassemble to obtain the audio data, resulting in the second electronic device 20 being unable to play the audio normally. Another example is, as Figure 2In the scenario shown in (d), since the first electronic device 10 does not have the ability to combine packets, the audio data packets sent by the first electronic device 10 to the second electronic device 20 are single-packet data packets. However, since the second electronic device 20 has the ability to unpack packets, after receiving the single-packet data packet, the second electronic device 20 automatically performs unpacking processing. In this way, since the second electronic device 20 cannot perform a normal unpacking procedure, an error will be reported, resulting in the second electronic device 20 being unable to play the audio normally.
[0051] An embodiment of the present application provides an audio data transmission method. When establishing an audio data channel, the second electronic device can send a data channel establishment message that can indicate the unpacking ability of the second electronic device to the first electronic device. In the audio data transmission stage, the first electronic device can decide whether to perform packet combination processing or single-packet processing on the audio data stream to be sent according to the packet combination ability of the first electronic device and the unpacking ability of the second electronic device. Among them, the audio data packet obtained after packet combination processing is a combined packet data packet, and the audio data packet obtained after single-packet processing is a single-packet data packet. After the second electronic device receives the audio data packet sent by the first electronic device, the second electronic device can decide whether to perform unpacking processing on the audio data packet based on the packet type of the audio data packet. In this way, the data transmission method provided by the embodiment of the present application can be compatible with different versions of data transmission technologies in electronic devices, and improve the reliability of data transmission between two electronic devices in various interconnection scenarios.
[0052] It should be noted that the specific forms of the first electronic device and the second electronic device interconnected in the embodiment of the present application are not limited. Among them, the types of the first electronic device and the second electronic device can be the same or different. For example, the first electronic device can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a computer, a car machine, etc., and the second electronic device can be an electronic device such as a mobile phone, a tablet computer, a laptop computer, a computer, a car machine, etc.
[0053] Figure 3 It is a schematic diagram of the hardware structure of an electronic device 100 provided by an embodiment of the present application. Among them, for the specific structures of the first electronic device 10 and the second electronic device 20, reference can be made to Figure 3 the schematic diagram of the structure of the electronic device 100 shown.
[0054] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, a headphone jack 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, a barometric pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0055] It can be understood that the structure schematically shown in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than those shown in the figure, or combine certain components, or split certain components, or have different component arrangements. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0056] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated in one or more processors.
[0057] The controller may generate operation control signals according to the instruction operation code and timing signals to complete the control of fetching instructions and executing instructions.
[0058] A memory can also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can hold the instructions or data that the processor 110 has just used or recycled. If the processor 110 needs to use the instruction or data again, it can directly call it from the said memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.
[0059] In some embodiments, the processor 110 may include one or more interfaces. The interfaces can include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.
[0060] It can be understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are only illustrative descriptions and do not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0061] The charging management module 140 is used to receive a charging input from a charger. Herein, the charger can be a wireless charger or a wired charger. In some embodiments of wired charging, the charging management module 140 can receive the charging input from a wired charger through the USB interface 130. In some embodiments of wireless charging, the charging management module 140 can receive the wireless charging input through the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also supply power to the electronic device through the power management module 141.
[0062] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives the inputs from the battery 142 and / or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, the wireless communication module 160, etc. The power management module 141 can also be used to monitor parameters such as the battery capacity, the number of battery cycles, and the battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be disposed in the processor 110. In some other embodiments, the power management module 141 and the charging management module 140 can also be disposed in the same device.
[0063] The wireless communication function of the electronic device 100 can be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, and the baseband processor, etc.
[0064] The antenna 1 and the antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be multiplexed to improve the utilization rate of the antennas. For example, the antenna 1 can be multiplexed as the diversity antenna of the wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.
[0065] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc. applied to the electronic device 100. The mobile communication module 150 can include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves by the antenna 1, filter, amplify, etc. the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves through the antenna 1 and radiate it out. In some embodiments, at least some functional modules of the mobile communication module 150 can be disposed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 can be disposed in the same device.
[0066] The modulation and demodulation processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. Subsequently, the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.), or displays an image or video through the display screen 194. In some embodiments, the modulation and demodulation processor may be an independent device. In other embodiments, the modulation and demodulation processor may be independent of the processor 110 and be provided in the same device as the mobile communication module 150 or other functional modules.
[0067] The wireless communication module 160 may provide solutions for wireless communications applied to the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite systems (GNSS), frequency modulation (FM), near field communication (NFC), infrared technology (IR), etc. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, performs frequency modulation and filtering processing on the electromagnetic wave signals, and transmits the processed signals to the processor 110. The wireless communication module 160 may also receive the signal to be transmitted from the processor 110, perform frequency modulation on it, amplify it, and convert it into electromagnetic waves through the antenna 2 and radiate it out.
[0068] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, such that the electronic device 100 can communicate with the network and other devices through wireless communication technologies. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include global positioning system (GPS), global navigation satellite system (GLONASS), beidou navigation satellite system (BDS), quasi-zenith satellite system (QZSS), and / or satellite based augmentation systems (SBAS).
[0069] The electronic device 100 implements the display function through the GPU, the display screen 194, and the application processor, etc. The GPU is a microprocessor for image processing, and is connected to the display screen 194 and the application processor. The GPU is used to execute mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs, which execute program instructions to generate or change the display information.
[0070] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-OLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include one or N display screens 194, where N is a positive integer greater than 1.
[0071] The electronic device 100 can implement the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194, and the application processor, etc.
[0072] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and light passes through the lens and is transmitted to the camera sensor. The light signal is converted into an electrical signal, and the camera sensor transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. The ISP can also optimize parameters such as the exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0073] The camera 193 is used to capture static images or videos. An object generates an optical image through the lens and projects it onto the sensor. The sensor can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The sensor converts the light signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV, etc. format. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.
[0074] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc.
[0075] The video codec is used to compress or decompress digital videos. The electronic device 100 can support one or more video codecs. In this way, the electronic device 100 can play or record videos in multiple encoding formats, such as: Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.
[0076] The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission pattern between human brain neurons, it can quickly process input information and can also continuously self-learn. Through the NPU, applications such as intelligent cognition of the electronic device 100 can be realized, such as: image recognition, face recognition, speech recognition, text understanding, etc.
[0077] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to achieve the data storage function. For example, files such as music and videos are saved in the external memory card.
[0078] The internal memory 121 can be used to store computer-executable program code, and the executable program code includes instructions. The internal memory 121 can include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as the sound playback function, image playback function, etc.). The data storage area can store data created during the use of the electronic device 100 (such as audio data, phone book, etc.). In addition, the internal memory 121 can include high-speed random access memory and can also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121 and / or the instructions stored in the memory provided in the processor.
[0079] The electronic device 100 can implement audio functions through the audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and the application processor, etc. For example, music playback, recording, etc.
[0080] The audio module 170 is used to convert digital audio information into an analog audio signal for output, and is also used to convert an analog audio input into a digital audio signal. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 can be disposed in the processor 110, or some functional modules of the audio module 170 can be disposed in the processor 110.
[0081] The speaker 170A, also known as a "loudspeaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or hands-free calls through the speaker 170A. Multiple speakers 170A can be provided in the electronic device 100. For example, one speaker 170A can be provided at the top of the electronic device 100, and one speaker 170A can also be provided at the bottom, etc.
[0082] The receiver 170B, also known as an "earpiece", is used to convert an audio electrical signal into a sound signal. When the electronic device 100 answers a call or a voice message, the voice can be listened to by bringing the receiver 170B close to the human ear. In some embodiments, the speaker 170A and the receiver 170B can also be set as one component, and the present application does not limit this.
[0083] The microphone 170C, also known as a "microphone" or "transmitter", is used to convert a sound signal into an electrical signal. When making a call or sending a voice message, the user can speak by bringing the mouth close to the microphone 170C to input the sound signal into the microphone 170C. At least one microphone 170C can be provided in the electronic device 100. In some other embodiments, two microphones 170C can be provided in the electronic device 100, which can not only collect sound signals but also implement a noise reduction function. In some other embodiments, three, four or more microphones 170C can also be provided in the electronic device 100 to collect sound signals, reduce noise, identify the sound source, and implement functions such as directional recording.
[0084] The headphone jack 170D is used to connect a wired headphone. The headphone jack 170D can be a USB interface 130, or a 3.5 mm open mobile terminal platform (OMTP) standard interface, or a cellular telecommunications industry association of the USA (CTIA) standard interface.
[0085] The button 190 includes a power-on button, volume buttons, etc. The button 190 can be a mechanical button or a touch button. The electronic device 100 can receive button inputs and generate key signal inputs related to the user settings and function controls of the electronic device 100.
[0086] The motor 191 can generate vibration prompts. The motor 191 can be used for incoming call vibration prompts and also for touch vibration feedback. For example, touch operations on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. For touch operations on different areas of the display screen 194, the motor 191 can also correspond to different vibration feedback effects. Different application scenarios (such as time reminder, receiving messages, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
[0087] The indicator 192 can be an indicator light and can be used to indicate the charging state, power change, and can also be used to indicate messages, missed calls, notifications, etc.
[0088] The SIM card interface 195 is used to connect the SIM card. The SIM card can be in contact with and separated from the electronic device 100 by inserting into or pulling out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, etc. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the electronic device 100 and cannot be separated from the electronic device 100.
[0089] Figure 4 It is the software structure block diagram of the electronic device 100 in the embodiments of the present application.
[0090] The layered architecture divides the software into several layers, and each layer has a clear role and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom are the application layer, application framework layer, Android runtime and system libraries, hardware abstraction layer (HAL), and kernel layer.
[0091] The application layer may include a series of application packages. The application layer may run applications by invoking the application programming interfaces (APIs) provided by the application framework layer.
[0092] As Figure 4 shown, the application packages may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message, etc.
[0093] The application framework layer provides application programming interfaces (APIs) and programming frameworks for the applications in the application layer. The application framework layer includes some predefined functions.
[0094] As Figure 4 shown, the application framework layer may include a window manager, a content provider, a view system, a telephone manager, a resource manager, a notification manager, etc. The application framework layer may also include an audio virtualization module, a service management module, a data transmission module, etc.
[0095] The window manager is used to manage window programs. The window manager may obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0096] The content provider is used to store and obtain data, and make this data accessible to applications. The data may include video, image, audio, dialed and answered calls, browsing history and bookmarks, phone book, etc.
[0097] The view system includes visible controls, such as controls for displaying text, controls for displaying pictures, etc. The view system can be used to build applications. The display interface may be composed of one or more views. For example, a display interface including a short message notification icon may include a view for displaying text and a view for displaying pictures.
[0098] The telephone manager is used to provide the communication function of the electronic device 100. For example, the management of call states (including connection, disconnection, etc.).
[0099] The resource manager provides various resources for applications, such as localized strings, icons, pictures, layout files, video files, etc.
[0100] The notification manager enables an application to display notification information in the status bar. It can be used to convey messages of the notification type, and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to inform that a download is completed, a message reminder, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or a scrolling text, such as a notification of a background running application, or a notification that appears on the screen in the form of a dialogue window. For example, it prompts text information in the status bar, emits a prompt tone, the electronic device vibrates, the indicator light flashes, etc.
[0101] In the scenario where a first electronic device is interconnected with a second electronic device, taking the first electronic device as the audio data sender and the second electronic device as the audio data receiver as an example. The audio virtualization module of the first electronic device can be used to initiate a request to establish an audio data channel, and the audio virtualization module of the second electronic device can be used to output audio data. The service management module of the first electronic device can be used to send information including packet combining capabilities to the service management module of the second electronic device, and can be used to receive information including packet splitting capabilities sent by the service management module of the second electronic device. The data transmission module of the first electronic device can be used to decide whether to perform packet combining processing on the audio data stream, and the data transmission module of the second electronic device can be used to decide whether to perform packet splitting processing on the audio data stream.
[0102] Exemplarily, the audio virtualization module, the service management module, and the data transmission module can be implemented through different classes. For example, the audio virtualization module of the first electronic device can be the ServiceAudioWrapper class, and the audio virtualization module of the second electronic device can be the AudioSteam class. The service management module of the first electronic device can be the RemoteVirtualServiceSource class, and the service management module of the second electronic device can be the VirtualServiceSink class. The data transmission module of the first electronic device can be the RemoteDataSession class, and the data transmission module of the second electronic device can be the DataSession class.
[0103] Android Runtime includes a core library and a virtual machine. Android runtime is responsible for the scheduling and management of the Android system.
[0104] The core library consists of two parts: one part is the functional functions that the Java language needs to call, and the other part is the core library of Android.
[0105] The application layer and the application framework layer run in the virtual machine. The virtual machine executes the Java files in the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object lifecycle management, stack management, thread management, security and exception management, and garbage collection.
[0106] The system library can include multiple functional modules. For example: surface manager, Media Libraries, 3D graphics processing library (e.g., OpenGL ES), 2D graphics engine (e.g., SGL), etc.
[0107] The surface manager is used to manage the display subsystem and provides the fusion of 2D and 3D layers for multiple applications.
[0108] The media library supports the playback and recording of multiple common audio and video formats, as well as static image files, etc. The media library can support multiple audio and video coding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0109] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis, and layer processing, etc.
[0110] The 2D graphics engine is a drawing engine for 2D drawing.
[0111] HAL is an abstract interface for device kernel drivers, which realizes an application programming interface for accessing the underlying devices to a higher-level Java API framework. The hardware abstraction layer can include multiple library modules, such as a display module, an audio module, a Bluetooth module, a Wi-Fi module, etc. Each module can implement an interface for a specific type of hardware component. When the framework API requests access to device hardware, the Android system will load the library module for this hardware component.
[0112] The kernel layer is the layer between hardware and software. The kernel layer at least includes a display driver, a camera driver, an audio driver, and a sensor driver.
[0113] Figure 5 It is a module interaction diagram of an audio data transmission method according to an embodiment of the present application. As Figure 5 shown, taking the first electronic device including a first audio virtualization module, a first service management module, and a first data transmission module, and the second electronic device including a second audio virtualization module, a second service management module, and a second data transmission module as an example, an audio data transmission method according to an embodiment of the present application is exemplarily described. As Figure 5 shown, the method may include the following steps:
[0114] S201, the first audio virtualization module sends a request to establish a data channel to the first data transmission module.
[0115] S202, after receiving the request to establish a data channel, the first data transmission module starts to establish a data channel.
[0116] S203, when the service type of the currently established data channel is speaker, the first service management module sends the first information to the second service management module.
[0117] After the first electronic device and the second electronic device establish a basic communication connection, the first electronic device and the second electronic device further establish a data channel. A data channel refers to a channel used for transmitting data between the first electronic device and the second electronic device.
[0118] Exemplarily, after the first electronic device and the second electronic device establish a basic communication connection, if the first electronic device identifies that the second electronic device includes a speaker, a microphone, and a camera, the first electronic device usually requests to establish a data channel corresponding to the speaker, a data channel corresponding to the microphone, and a data channel corresponding to the camera respectively. Among them, the service type of the data channel corresponding to the speaker is speaker, the service type of the data channel corresponding to the microphone is microphone, and the service type of the data channel corresponding to the camera is camera.
[0119] When the first service management module determines that the service type of the currently established data channel is speaker, it can send the first information to the second service management module. The first message can be used to indicate whether data transmission needs to be encrypted or decrypted. For example, the first message can be a trigger_options message.
[0120] In some embodiments, the first electronic device can send the packet combining ability of the first electronic device to the second electronic device. In this way, the first message can also be used to indicate the packet combining ability of the first electronic device. Among them, the packet combining ability of the first electronic device includes that the first electronic device has the packet combining ability or the first electronic device does not have the packet combining ability.
[0121] In one implementable manner, when the first electronic device has the packet combining ability, a packet combining ability identifier can be carried in the first message. When the first electronic device does not have the packet combining ability, the packet combining ability identifier can not be carried in the first message. In this way, after receiving the first message, the second electronic device can determine the packet combining ability of the first electronic device based on whether the packet combining ability identifier is carried in the first message.
[0122] In another possible implementation, when the first electronic device has the ability to package, the first package capability identifier may be carried in the first message. When the second electronic device does not have the ability to unpack, the second package capability identifier may be carried in the first message. The first package capability identifier is different from the second package capability identifier. In this way, after receiving the first message, the second electronic device may determine the package capability of the first electronic device based on whether the package capability identifier carried in the first message is the first package capability identifier or the second package capability identifier.
[0123] In some embodiments, the first electronic device may not send the co-packaging capability of the first electronic device to the second electronic device. In this way, the first message is not used to indicate the co-packaging capability of the first electronic device.
[0124] In some embodiments, when the first service management module determines that the service type of the currently established data channel is a speaker and the transmission type of the data channel is a target transmission type, the first information may be sent to the second service management module, wherein the target transmission type includes a MagicLink.
[0125] The transmission types of data channels can include Huawei share OneHop, MagicLink and other transmission types. Both OneHop and MagicLink can realize the interconnection between two electronic devices, and can transmit data between two electronic devices without using data cables or other external devices. Among them, OneHop has a limit on the amount of data transmitted, and is usually used to transmit files, pictures, etc. with a small amount of data. MagicLink has no limit on the amount of data transmitted, and can be used to transmit large data packets after packaging.
[0126] Based on this, the embodiment of the present application can send the first information to the second service management module when the service type of the currently established data channel is speaker and the transmission type of the data channel is MagicLink. In this way, it can be ensured that the combined audio data packet is sent to the second electronic device.
[0127] S204: After receiving the first message, the second service management module analyzes the packaging capability of the first electronic device based on the first message.
[0128] S205: The second service management module sends the packaging capability of the first electronic device to the second audio virtualization module.
[0129] S206: The second audio virtualization module saves the packaging capability of the first electronic device.
[0130] Exemplarily, if the second service management module identifies that the first message includes a packet combining capability identifier, it determines that the first electronic device has the packet combining capability. On the contrary, if the second service management module identifies that the first message does not include a packet combining capability identifier, it determines that the first electronic device does not have the packet combining capability.
[0131] Another exemplarily, if the second service management module identifies that the first message includes a first packet combining capability identifier, it determines that the first electronic device has the packet combining capability. On the contrary, if the second service management module identifies that the first message includes a second packet combining capability identifier, it determines that the first electronic device does not have the packet combining capability.
[0132] It should be understood that if the first information is not used to indicate the packet combining capability of the first electronic device, that is, the first electronic device does not send the packet combining capability of the first electronic device to the second electronic device, the above steps S204 to S206 may not be executed.
[0133] S207, the second service management module sends a second message to the first service management module.
[0134] In some embodiments, the second service management module may send a second message to the first service management module when receiving the first message.
[0135] In some embodiments, the second service management module may also send a second message to the first service management module when determining that the service type of the currently established data channel is a speaker.
[0136] In some embodiments, the second service management module may also send a second message to the first service management module when determining that the service type of the currently established data channel is a speaker and the transmission type of the data channel is a target transmission type. Wherein, the target transmission type includes Magic Link.
[0137] The second message may be a SendSetup message (also referred to as a data channel establishment message). The second message may be used to indicate whether data transmission needs to be encrypted or decrypted. The second message may also be used to indicate the unpacking capability of the second electronic device. Wherein, the unpacking capability of the second electronic device includes that the second electronic device has the unpacking capability or the second electronic device does not have the unpacking capability.
[0138] In one implementable manner, when the second electronic device has unpacking capability, an unpacking capability identifier may be carried in the second message. When the second electronic device does not have unpacking capability, the unpacking capability identifier may not be carried in the first message. In this way, after receiving the second message, the first electronic device may determine the unpacking capability of the second electronic device based on whether the unpacking capability identifier is carried in the second message.
[0139] In another implementable manner, when the second electronic device has unpacking capability, a first unpacking capability identifier may be carried in the second message. When the second electronic device does not have unpacking capability, a second unpacking capability identifier may not be carried in the first message. Here, the first unpacking capability identifier is different from the second unpacking capability identifier. In this way, after receiving the second message, the first electronic device may determine the unpacking capability of the second electronic device based on whether the unpacking capability identifier carried in the second message is the first unpacking capability identifier or the second unpacking capability identifier.
[0140] S208. After the first service management module receives the second message, it parses the unpacking capability of the second electronic device based on the second message.
[0141] The above steps S201 to S208 are the audio data channel establishment phase provided by the embodiments of this application. After the audio data channel is established, the first service management module of the first electronic device may save the unpacking capability of the second electronic device, and the second audio virtualization module of the second electronic device may save the packing capability of the first electronic device.
[0142] The process of audio data transmission based on the established audio data channel is described below.
[0143] S209. The HAL sends at least one audio data stream to the first data transmission module.
[0144] S210. The first data transmission module obtains the unpacking capability of the second electronic device from the first service management module.
[0145] After the first data transmission module obtains the unpacking capability of the second electronic device, the first data transmission module may determine that the second electronic device has unpacking capability or does not have unpacking capability. Further, the first data transmission module may make a decision on whether to perform packing processing on at least one audio data stream based on the unpacking capability of the second electronic device and the packing capability of the first electronic device. For details, please refer to the descriptions in steps S211a to S213b below.
[0146] S211a, when the first electronic device has the ability to combine packets and the second electronic device has the ability to unpack packets, the first data transmission module performs packet combination processing on at least one audio data stream to obtain an audio data packet, and the audio data packet is a combined packet data packet.
[0147] S212a, the first data transmission module sends the audio data packet to the second data transmission module.
[0148] S213a, the second data transmission module sends the audio data packet to the second audio virtualization module.
[0149] In some embodiments, the first data transmission module can perform packet combination processing on at least one audio data stream in the following manner: the first data transmission module can first perform single-packet processing on each audio data stream in at least one audio data stream to obtain at least one single-packet data packet. Then, perform packet combination processing on multiple single-packet data packets to obtain a combined packet data packet.
[0150] Exemplarily, the first data transmission module receives a music audio data stream at a first moment and a navigation audio data stream at a second moment. In this way, the first data transmission module can perform single-packet packaging processing on the music audio data stream and the navigation audio data stream respectively to obtain two single-packet data packets. Among them, the first moment and the second moment can be the same moment or different moments.
[0151] Furthermore, the two single-packet data packets can be cached in their respective output queues respectively. Then, every preset time, the first data transmission module traverses each output queue, further packages the single-packet data packets in each output queue into a large packet to obtain a combined packet data packet. Then, send the combined packet data packet to the second data transmission module.
[0152] To distinguish between single-packet data packets and combined packet data packets, different identifiers can be set in the audio data packet. For example, in the embodiments of the present application, the single-packet data packet can include a single-packet type identifier, and the combined packet data packet can include a combined-packet type identifier. Among them, the single-packet type identifier is used to identify that the data packet type of the audio data packet is a single-packet data packet, and the combined-packet type identifier is used to identify that the data packet type of the audio data packet is a combined packet data packet.
[0153] In one implementable manner, the single-packet type identifier may be the actual audio stream type (streamtype) of each audio data stream. Specifically, the actual audio stream type (streamtype) of each audio data stream may be filled in the ssrc field of the header of each single-packet data packet. For example, the ssrc field of the header of the music single-packet data packet may be streamtype_music (music), and the ssrc field of the header of the navigation single-packet data packet may be streamtype_navigation (navigation). The combined-packet type identifier may be streamtype_All. Specifically, streamtype_All may be filled in the ssrc field of the header of the combined-packet data packet.
[0154] In this way, since the second electronic device has the unpacking ability, the first data transmission module sends a combined-packet data packet adapted to the unpacking ability to the second audio virtualization module. In this way, after receiving the audio data combined packet, the second audio virtualization module can perform normal unpacking processing on the audio data combined packet, thereby ensuring the normal transmission of the audio data.
[0155] S211b. When the first electronic device does not have the combined-packet ability or the second electronic device does not have the unpacking ability, the first data transmission module performs single-packet processing on at least one audio data stream to obtain at least one audio data packet, and the audio data packet is a single-packet data packet.
[0156] S212b. The first data transmission module sends at least one audio data packet to the second data transmission module.
[0157] S213b. The second data transmission module sends at least one audio data packet to the second audio virtualization module.
[0158] In some embodiments, when the first electronic device has the combined-packet ability and the second electronic device does not have the unpacking ability, the first data transmission module can perform single-packet processing on at least one audio data stream in the following manner: The first data transmission module performs single-packet processing on each of at least one audio data stream to obtain at least one single-packet data packet. Further, the actual audio stream type (streamtype) of each audio data stream may be used as the ssrc field of the header of each single-packet data packet. Further, the first data transmission module separately sends each single-packet data packet to the second data transmission module. Correspondingly, what the second data transmission module receives are multiple independent single-packet data packets.
[0159] In some embodiments, when the first electronic device does not have the ability to combine packets, the audio data stream received by the first data transmission module may be a mixed audio data stream. In this case, the first data transmission module can process the audio data stream into a single packet to obtain a single-packet data packet, and can use any audio stream type (streamtype) in the audio data stream as the ssrc field of the packet header of the single-packet data packet.
[0160] In this way, since the second electronic device does not have the ability to unpack packets, the first data transmission module sends a single-packet data packet adapted to the lack of unpacking ability to the second audio virtualization module. In this way, the second audio virtualization module does not need to unpack the received single-packet data packets, and can perform normal single-packet reception processing on the single-packet data packets, thus ensuring the normal transmission of audio data.
[0161] In summary, the audio data packets received by the second audio virtualization module are single-packet data packets or combined-packet data packets. Therefore, the second audio virtualization module can decide whether to unpack the received audio data packets based on the packet type of the received audio data packets.
[0162] The processing flow of the second audio virtualization module for the received audio data packets will be described below.
[0163] S214a, when the packet type of the audio data packet is a combined-packet data packet, the second audio virtualization module unpacks the audio data packet to obtain at least one audio data stream.
[0164] S214b, when the packet type of the audio data packet is a single-packet data packet, the second audio virtualization module performs single-packet reception processing on the audio data packet.
[0165] In one implementable manner, the second audio virtualization module can determine the packet type of the audio data packet by determining whether the packet type identifier of the audio data packet is a combined-packet type identifier or a single-packet type identifier. If the audio data packet includes a combined-packet type identifier, it can be determined that the packet type of the audio data packet is a combined-packet data packet. If the audio data packet includes a single-packet type identifier, it can be determined that the packet type of the audio data packet is a single-packet data packet.
[0166] Exemplarily, if the second audio virtualization module determines that the ssrc field of the packet header of the audio data packet is streamtype_All, it can be determined that the audio data packet is a combined-packet data packet. If the second audio virtualization module determines that the ssrc field of the packet header of the audio data packet is streamtype_music, streamtype_navigation, or streamtype_other, it can be determined that the audio data packet is a single-packet data packet.
[0167] In this way, when the second audio virtualization module determines that the received audio data packet is a combined packet, the audio data packet is unpacked. When the second audio virtualization module determines that the received audio data packet is a single packet, the audio data packet is processed for single-packet reception.
[0168] Among them, after the second audio virtualization module unpacks the combined packet, one or more single packets can be obtained. After obtaining one or more single packets, the single-packet reception processing can be further performed on each single packet to obtain audio data streams of different audio stream types.
[0169] When the first electronic device has the combined packet capability, the audio data stream obtained after the second audio virtualization module processes the single packet for single-packet reception can be a single-tone data stream (i.e., an audio data stream of one audio stream type). When the first electronic device does not have the combined packet capability, the audio data stream obtained after the second audio virtualization module processes the single packet for single-packet reception may be a mixed data stream.
[0170] In summary, for the audio data transmission method provided in the embodiments of the present application, the first electronic device can decide whether to perform combined packet processing on the audio data stream based on the unpacking capability of the second electronic device and the combined packet capability of the first electronic device. The second electronic device can decide whether to unpack the audio data packet based on the packet type of the received audio data packet. In this way, even if the interconnected first electronic device and second electronic device adopt different versions of audio data transmission technologies, the normal transmission of audio data can be ensured.
[0171] It should be noted that in the above embodiments, the second electronic device decides whether to unpack the audio data packet based on the packet type of the received audio data packet. In this way, the second electronic device does not need to consider the combined packet capability of the first electronic device. Therefore, in the stage of establishing the audio data channel, the first information sent by the first electronic device to the second electronic device may not carry any identifier for indicating the combined packet capability of the first electronic device. That is to say, the embodiments of the present application may also not include steps S203 to S206.
[0172] In some embodiments, to enhance the reliability of audio data transmission, the above steps S203 to S206 may also be included. Correspondingly, the second electronic device may also decide whether to unpack the audio data packet based on the packet type of the received audio data packet and the packet combining ability of the first electronic device. For example, when the first electronic device has the packet combining ability and the packet type of the received audio data packet is a combined packet, the second electronic device unpacks the audio data packet. When the first electronic device does not have the packet combining ability or the packet type of the received audio data packet is a single packet, the second electronic device does not unpack the audio data packet.
[0173] The following Figure 2 illustrates the audio data transmission method provided by the embodiments of the present application in conjunction with
[0174] As Figure 2 shown in (a) below, the first electronic device has the packet combining ability and the second electronic device has the unpacking ability. In this way, based on the fact that the first electronic device has the packet combining ability and the second electronic device has the unpacking ability, the first electronic device can perform packet combining processing on the audio data stream. Correspondingly, after receiving the audio data packet, the second electronic device can determine to perform unpacking processing on the audio data packet based on the fact that the audio data packet includes a combined packet type identifier. It can be seen that in this scenario, the second electronic device has the unpacking ability, and the audio data packet received by the second electronic device is a combined packet. Therefore, the second electronic device can perform a normal unpacking processing procedure on the received combined packet.
[0175] As Figure 2 shown in (b) below, the first electronic device does not have the packet combining ability and the second electronic device does not have the unpacking ability. In this way, based on the fact that the first electronic device does not have the packet combining ability or the second electronic device does not have the unpacking ability, the first electronic device can perform single packet processing on the audio data stream. Correspondingly, after receiving the audio data packet, the second electronic device can determine to perform single packet receiving processing on the audio data packet based on the fact that the audio data packet includes a single packet type identifier. It can be seen that in this scenario, the second electronic device does not have the unpacking ability, and the audio data packet received by the second electronic device is a single packet. Therefore, the second electronic device can perform a normal single packet receiving processing procedure on the received single packet.
[0176] As Figure 2As shown in (c), the first electronic device has the ability to combine packets, and the second electronic device does not have the ability to unpack packets. In this way, based on the fact that the first electronic device has the ability to combine packets but the second electronic device does not have the ability to unpack packets, the first electronic device can perform single-packet processing on the audio data stream. Correspondingly, after receiving the audio data packet, the second electronic device can determine to perform single-packet reception processing on the audio data packet based on the fact that the audio data packet includes a single-packet type identifier. It can be seen that in this scenario, although the first electronic device has the ability to combine packets, the first electronic device will not perform packet combination processing on the audio data stream but perform single-packet processing on the audio data stream based on the fact that the second electronic device does not have the ability to unpack packets. In this way, the audio data packet received by the second electronic device is a single-packet data packet. Therefore, the second electronic device without the ability to unpack packets can perform a normal single-packet reception processing procedure on the received single-packet data packet.
[0177] As Figure 2 shown in (d), the first electronic device does not have the ability to combine packets, and the second electronic device has the ability to unpack packets. In this way, based on the fact that the first electronic device does not have the ability to combine packets, the first electronic device can perform single-packet processing on the audio data stream. Correspondingly, after receiving the audio data packet, the second electronic device can determine to perform single-packet reception processing on the audio data packet based on the fact that the audio data packet includes a single-packet type identifier. It can be seen that in this scenario, although the second electronic device has the ability to unpack packets, the second electronic device can perform a single-packet reception processing procedure on the received audio data packet based on the fact that the audio data packet includes a single-packet type identifier, instead of performing unpacking processing.
[0178] It can be seen that the audio data transmission method provided by the embodiments of the present application can be compatible with the above four audio data transmission scenarios, ensuring that in the above four audio data transmission scenarios, the first electronic device can correctly decide whether to perform packet combination processing on the audio data stream, and the second electronic device can correctly decide whether to perform unpacking processing on the audio data packet, improving the reliability of audio data transmission between the two electronic devices.
[0179] In some embodiments, before the first data transmission module decides whether to perform packet combination processing on the audio data stream, as Figure 6 shown, the following steps may further be included:
[0180] S301, the HAL receives at least one audio data stream sent by the framework layer.
[0181] Application programs such as music, navigation, and calls in the application layer can send their respective audio data streams to the framework layer. The framework layer can perform splitting processing or not perform splitting processing on the audio data stream based on whether it has the splitting ability itself. For example, in the new version of the audio data transmission technology, the framework layer has the splitting ability. In the old version of the audio data transmission technology, the framework layer does not have the splitting ability.
[0182] Exemplarily, as Figure 7A shown, if the first electronic device has the shunting ability, the framework layer of the first electronic device can provide multiple channels to shunt the audio data stream through the multiple channels and write the shunted audio data stream into the HAL. For example, the first electronic device can divide the audio data stream into three types of audio streams, namely music, navigation, and other types. Among them, the other types can include audio data streams such as notifications and calls. The framework layer of the first electronic device sets three audio data transmission channels corresponding to the above three types of audio streams, and each audio data transmission channel corresponds to a channel number (routeNo). For example, routeNo1 is used to transmit the music audio data stream, routeNo2 is used to transmit the navigation audio data stream, and routeNo3 is used to transmit other audio data streams.
[0183] Another exemplarily, as Figure 7B shown, if the first electronic device does not have the shunting ability, the framework layer of the first electronic device provides only one channel, and the audio data streams of all audio stream types are written into the HAL through this channel.
[0184] S302, the HAL generates the header parameters of each audio data stream.
[0185] As Figure 7A shown, if the first electronic device has the shunting ability, the header parameters of the audio data stream generated by the HAL can include routeNo and the first version information. Among them, the first version (version1) indicates that the first electronic device has the shunting ability, and the second version (version0) indicates that the first electronic device does not have the shunting ability.
[0186] Exemplarily, as Figure 7A shown, the music audio data stream written into the HAL, after being processed by the HAL, carries the header parameters: routeNo1, version1. The navigation audio data stream written into the HAL, after being processed by the HAL, carries the header parameters: routeNo2, version1. The other audio data streams written into the HAL, after being processed by the HAL, carry the header parameters: routeNo3, version1.
[0187] As Figure 7B shown, if the first electronic device does not have the shunting ability, the header parameters of the audio data stream generated by the HAL can include the audio stream type and the second version information.
[0188] Exemplarily, as Figure 7BAs shown, the first electronic device of the second version does not have the shunting ability, and the framework layer outputs a mixed audio data stream. The mixed audio data stream is written into the HAL, and the packet header parameters carried after being processed by the HAL can be: music / navigation / other, version0.
[0189] S303, the HAL sends at least one audio data stream to the first data transmission module, where each audio data stream carries packet header parameters.
[0190] S304, the first data transmission module determines the version information in the packet header parameters.
[0191] S305a, when the version information is the first version, the first data transmission module generates audio stream types corresponding to the respective audio data streams.
[0192] Combined Figure 7A , if the version information is the first version, the packet header parameters carried by each audio data stream do not include the audio stream type. Therefore, in the embodiment of the present application, when the version information is the first version, the audio stream types corresponding to the respective audio data streams can be generated for subsequent filling of the packet headers of each single-packet audio data packet.
[0193] Exemplarily, since different routeNos respectively correspond to different audio stream types, the first data transmission module can generate corresponding audio stream types based on the routeNos of the respective audio data streams. For example, the audio stream type corresponding to routeNo1 is music, the audio stream type corresponding to routeNo2 is navigation, and the audio stream type corresponding to routeNo3 is other.
[0194] Another exemplarily, the first data transmission module can generate the data stream types corresponding thereto based on the usage parameters in the respective audio data streams. The usage parameters include information for characterizing the data stream type of the audio data stream.
[0195] S306a, the first data transmission module creates audio encoders corresponding to the respective channel numbers based on the channel numbers.
[0196] S307a, using the respective audio encoders, the audio data streams corresponding to the respective channel numbers are respectively encoded to obtain at least one encoded audio data stream.
[0197] For audio data streams of different audio stream types, different audio encoders can be used to encode the audio data streams of different audio stream types, that is, audio compression processing is performed on the audio data streams.
[0198] For the first electronic device with shunting capabilities, there is no pre-configured audio encoder in the first electronic device. Therefore, after the first data transmission module receives the audio data stream, it needs to dynamically create the corresponding audio encoder.
[0199] S305b, in the case where the version information is the second version, the first data transmission module calls the static audio encoder.
[0200] S306b, using the static audio encoder, encodes the audio data stream to obtain the encoded audio data stream.
[0201] For the first electronic device without shunting capabilities, the first electronic device is pre-configured with a static audio encoder. Therefore, after the first data transmission module receives the audio data stream, it does not need to recreate the audio encoder and can directly call the static audio encoder.
[0202] In some embodiments, the first electronic device may be pre-configured with static audio encoders corresponding to each audio stream type. In this way, after the first data transmission module receives the audio data stream, it can directly call the static audio encoder corresponding to the audio stream type.
[0203] It should be noted that for the first electronic device without shunting capabilities, the audio data stream that needs to be encoded may be a mixed audio data stream or a single-tone audio data stream. After the corresponding encoding process, an encoded audio data stream is obtained.
[0204] Furthermore, embodiments of the present application may perform packet combining or single-packet processing on the encoded audio data stream to obtain audio data packets.
[0205] It can be seen that the above steps S301 to S306b introduce the encoding process of the audio data stream for the first electronic device of different versions. Correspondingly, after the second electronic device performs unpacking processing or single-packet receiving processing on the audio data packet, the obtained audio data stream is the encoded audio data stream. Therefore, the second electronic device may further include steps for decoding the obtained encoded audio data stream.
[0206] The following introduces the decoding process of the audio data stream for the second electronic device of different versions.
[0207] Please continue to refer to Figure 6 As shown, the decoding process of the audio data stream for the second electronic device may include the following steps:
[0208] S401, the second audio virtualization module determines whether the packet header parameters of each audio data stream obtained after unpacking processing or single-packet receiving processing include a channel number (routeNo).
[0209] S402. When the packet header parameter includes a channel number, the second audio virtualization module creates an audio decoder corresponding to each channel number based on the channel number.
[0210] Exemplarily, when the packet header parameter includes a channel number, three audio decoders can be created, and the three audio decoders are respectively used to decode the audio data streams under three channel numbers.
[0211] In some embodiments, when the packet header parameter includes a channel number, three receiving threads can also be created. Each receiving thread can be respectively used to receive the audio data streams of different audio stream types after decoding.
[0212] S403. When the packet header parameter does not include a channel number, the second audio virtualization module creates one audio decoder.
[0213] When the packet header parameter does not include a channel number, it indicates that the first electronic device does not have the shunting ability. Therefore, the audio data stream obtained after single-packet reception processing is one audio data stream, and this one audio data stream is a mixed audio data stream or a single-tone audio data stream. Therefore, in the embodiment of the present application, when it is determined that the packet header parameter does not include a channel number, the second audio virtualization module can create only one audio decoder.
[0214] In some embodiments, when the packet header parameter does not include a channel number, one receiving thread can also be created. This one receiving thread can be used to receive the audio data stream after decoding.
[0215] Finally, the decoded audio data stream can be played through the speaker of the second electronic device.
[0216] It should be noted that the above embodiments are only used for exemplary illustration of implementing the audio data transmission method provided by the embodiments of the present application through the first audio virtualization module, the first service management module, and the first data transmission module in the first electronic device, and the second audio virtualization module, the second service management module, and the second data transmission module in the second electronic device, and do not represent a limitation on the internal implementation manner of the audio data transmission method provided by the embodiments of the present application.
[0217] Figure 8 The present application provides an audio data transmission method, which can be applied to a first electronic device (the first electronic device is the electronic device for sending audio data packets among two interconnected electronic devices), and the method can include the following steps:
[0218] S501. When establishing an audio data channel, the first electronic device receives a data channel establishment message sent by the second electronic device; the data channel establishment message is used to indicate the unpacking ability of the second electronic device.
[0219] In one implementable manner, when the service type of the data channel is a speaker and the transmission type of the data channel is Magic Link, the first electronic device receives a data channel establishment message sent by the second electronic device.
[0220] In one implementable manner, when the second electronic device has unpacking capability, the data channel establishment message includes an unpacking capability identifier. When the second electronic device does not have unpacking capability, the data channel establishment message does not include an unpacking capability identifier.
[0221] In one implementable manner, when the second electronic device has unpacking capability, the data channel establishment message includes a first unpacking capability identifier. When the second electronic device does not have unpacking capability, the data channel establishment message includes a second unpacking capability identifier. The first unpacking capability identifier is different from the second unpacking capability identifier.
[0222] Among them, for step S502, reference can be made to the descriptions of steps S201 to S208, which will not be elaborated here.
[0223] S502, the first electronic device processes at least one audio data stream to be sent according to the packet combining capability of the first electronic device and the data channel establishment message to obtain audio data packets; among them, when the second electronic device does not have unpacking capability, the audio data packet is a single-packet data packet; when the first electronic device has packet combining capability and the second electronic device has unpacking capability, the audio data packet is a combined packet data packet.
[0224] In one implementable manner, when the first electronic device has packet combining capability and the second electronic device has unpacking capability, the first electronic device performs packet combining processing on at least one audio data stream to be sent to obtain an audio data packet; among them, the audio data packet includes a packet combining type identifier, and the packet combining type identifier is used to identify that the audio data packet is a combined packet data packet.
[0225] In one implementable manner, when the first electronic device does not have packet combining capability or the second electronic device does not have unpacking capability, the first electronic device performs single-packet processing on at least one audio data stream to be sent to obtain at least one audio data packet. Among them, each audio data packet in the at least one audio data packet includes a single-packet type identifier, and the single-packet type identifier is used to identify each audio data packet as a single-packet data packet.
[0226] In one implementable manner, the single-packet type identifier is the audio stream type of the audio data stream in the audio data packet.
[0227] In one implementable manner, before the first electronic device performs packet combining processing or single-packet processing on at least one audio data stream to be sent, it may further include: when the version information carried in the packet header of the audio data stream to be sent is the first version, the first electronic device generates an audio stream type corresponding to each audio data stream to be sent; the first electronic device creates an audio encoder corresponding to each channel number according to the channel number; the first electronic device uses each audio encoder to perform encoding processing on the audio data stream to be sent for each channel number to obtain at least one encoded audio data stream; the first electronic device performs single-packet processing on at least one encoded audio data to obtain at least one single-packet data packet; wherein, the packet header of each single-packet data packet in the at least one single-packet data packet includes the corresponding audio stream type; the first electronic device performs packet combining processing on at least one single-packet data packet to obtain a packet-combined data packet.
[0228] In one implementable manner, before the first electronic device performs packet combining processing or single-packet processing on at least one audio data stream to be sent, it may further include: when the version information carried in the packet header of the audio data stream to be sent is the second version, the first electronic device calls a static audio encoder; the first electronic device uses the static audio encoder to perform encoding processing on at least one audio data to be sent to obtain at least one encoded audio data stream; the first electronic device performs single-packet processing on at least one encoded audio data stream to obtain at least one single-packet data packet; wherein, the packet header of each single-packet data packet in the at least one single-packet data packet includes the corresponding audio stream type.
[0229] Among them, for the description of step S502, reference can be made to the descriptions of steps S209 to S211a, step S211b, and steps S301 to S306b, which will not be elaborated here.
[0230] S503, the first electronic device sends an audio data packet to the second electronic device.
[0231] Among them, for the description of step S503, reference can be made to the descriptions of steps S212a, S213a, S212b, and S213b, which will not be elaborated here.
[0232] Figure 9 This is an audio data transmission method provided by an embodiment of the present application. This method can be applied to a second electronic device (the second electronic device is the electronic device for receiving audio data packets among two interconnected electronic devices), and this method may include the following steps:
[0233] S601, when establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device; the data channel establishment message is used to indicate the unpacking ability of the second electronic device.
[0234] In one implementable manner, when the service type of the data channel is a speaker and the transmission type of the data channel is Magic Link, the second electronic device sends a data channel establishment message to the first electronic device.
[0235] In one implementable manner, when the second electronic device has the unpacking ability, the data channel establishment message includes an unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message does not include an unpacking ability identifier.
[0236] In one implementable manner, when the second electronic device has the unpacking ability, the data channel establishment message includes a first unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message includes a second unpacking ability identifier; the first unpacking ability identifier is different from the second unpacking ability identifier.
[0237] Among them, for step S601, reference can be made to the descriptions of steps S201 to S208, which will not be elaborated here.
[0238] S602, the second electronic device receives the audio data packet sent by the first electronic device.
[0239] S603, the second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played.
[0240] In one implementable manner, when the audio data packet includes a combined packet type identifier, the second electronic device performs unpacking processing on the audio data to obtain at least one audio data stream to be played.
[0241] In one implementable manner, when the audio data packet includes a single packet type identifier, the second electronic device performs single packet reception processing on the audio data to obtain the audio data stream to be played.
[0242] Among them, for step S603, reference can be made to the descriptions of steps S214a, S214b, and S401 to S403, which will not be elaborated here.
[0243] Each method embodiment described herein can be an independent solution or can be combined according to the internal logic, and these solutions all fall within the protection scope of this application.
[0244] It can be understood that in the above method embodiments, the methods and operations implemented by the electronic device can also be implemented by components (such as chips or circuits) available for the electronic device.
[0245] The above embodiments have introduced the audio data transmission method provided by the present application. It can be understood that, in order for an electronic device to implement the above functions, it includes the corresponding hardware structure and / or software module for executing each function. Those skilled in the art should easily realize that, combining the units and algorithm steps of each example described in the embodiments disclosed in this article, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a certain function is executed in the way of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the present application.
[0246] The embodiment of the present application also provides a processing device, which includes at least one processor and a communication interface. The communication interface is used to provide information input and / or output for the at least one processor, and the at least one processor is used to execute the method in the above method embodiment.
[0247] It should be understood that the above processing device may be a chip. For example, refer to Figure 10 , Figure 10 which is a structural block diagram of a chip provided by the embodiment of the present application. Figure 10 The shown chip may be a general-purpose processor or a dedicated processor. The chip 700 may include at least one processor 701. Among them, the at least one processor 701 may be used to support the execution of Figures 1 to 9 the technical solutions shown in any one of the embodiments.
[0248] Optionally, the chip 700 may further include a transceiver 702. The transceiver 702 is used to accept the control of the processor 701 and is used to support the execution of Figures 1 to 9 the technical solutions shown in any one of the embodiments. Optionally, Figure 10 the shown chip 700 may further include a storage medium 703. Specifically, the transceiver 702 may be replaced by a communication interface, and the communication interface provides information input and / or output for the at least one processor 701.
[0249] It should be noted that Figure 10The chip 700 shown can be implemented using the following circuits or devices: one or more field programmable gate arrays (FPGAs), programmable logic devices (PLDs), application specific integrated circuits (ASICs), system on chips (SoCs), central processor units (CPUs), network processors (NPs), digital signal processing circuits (DSPs), micro controller units (MCUs), controllers, state machines, gate logic, discrete hardware components, any other suitable circuits, or any combination of circuits capable of performing the various functions described throughout this application.
[0250] In the implementation process, the steps of the above method can be completed by the integrated logic circuit of the hardware in the processor or the instructions in the form of software. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by the hardware processor, or executed and completed by the combination of the hardware and software modules in the processor. The software module can be located in a mature storage medium in the art such as random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method. To avoid repetition, it will not be described in detail here.
[0251] It should be noted that the processor in the embodiments of the present application can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method embodiments can be completed by the integrated logic circuit in the hardware of the processor or instructions in software form. The above processor can be a general-purpose processor, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. It can implement or execute the various methods, steps, and logic block diagrams disclosed in the embodiments of the present application. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in combination with the embodiments of the present application can be directly embodied as being executed and completed by a hardware decoding processor, or executed and completed by a combination of the hardware and software modules in the decoding processor. The software module can be located in a mature storage medium in the art such as a random access memory, flash memory, read-only memory, programmable read-only memory, or electrically erasable programmable memory, register, etc. This storage medium is located in the memory, and the processor reads the information in the memory and combines its hardware to complete the steps of the above method.
[0252] It can be understood that the memory in the embodiments of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a flash memory. The volatile memory can be a random access memory (RAM), which is used as an external cache. By way of example but not limitation, many forms of RAM are available, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDR SDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchlink dynamic random access memory (SLDRAM), and direct rambus random access memory (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to include but not be limited to these and any other suitable types of memory.
[0253] According to the method provided by the embodiments of the present application, the embodiments of the present application also provide a computer program product, which includes: a computer program or instruction. When the computer program or instruction runs on a computer, the computer is enabled to execute the method of any one of the method embodiments.
[0254] According to the method provided by the embodiments of the present application, the embodiments of the present application also provide a computer storage medium, which stores a computer program or instruction. When the computer program or instruction runs on a computer, the computer is enabled to execute the method of any one of the method embodiments.
[0255] According to the method provided by the embodiments of the present application, the embodiments of the present application also provide an electronic device, including a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device is enabled to execute the method of any one of the method embodiments.
[0256] Those of ordinary skill in the art can realize that the various illustrative logical blocks and steps described in combination with the embodiments disclosed herein can be implemented in electronic hardware, or in a combination of computer software and electronic hardware. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered to exceed the scope of the present application.
[0257] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or a 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 and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: various media such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk, or an optical disc that can store program code.
[0258] The computer storage medium, computer program product, and electronic device provided in the embodiments of the present application above are all used to execute the methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects corresponding to the methods provided above, and will not be elaborated here.
[0259] It should be understood that in the various embodiments of the present application, the execution order of each step should be determined according to its function and internal logic. The size of each step number does not mean the sequence of execution, and does not limit the implementation process of the embodiments.
[0260] Each part of this specification is described in a progressive manner. For the same or similar parts between the various embodiments, reference can be made to each other. Each embodiment focuses on the differences from other embodiments. In particular, for the embodiments of the device, computer storage medium, computer program product, and electronic device, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can refer to the descriptions in the method embodiments.
[0261] Although the preferred embodiments of the present application have been described, those skilled in the art can make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the appended claims are intended to be construed as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0262] The embodiments of the present application described above do not constitute a limitation to the protection scope of the present application.
Claims
1. An audio data transmission method, characterized in that, applied to a first electronic device, the method includes: When establishing an audio data channel, the first electronic device receives a data channel establishment message sent by a second electronic device; the data channel establishment message is used to indicate the unpacking ability of the second electronic device; The first electronic device processes at least one audio data stream to be sent according to the packet combining ability of the first electronic device and the data channel establishment message, to obtain audio data packets; wherein, when the second electronic device does not have the unpacking ability, the audio data packet is a single-packet data packet; when the first electronic device has the packet combining ability and the second electronic device has the unpacking ability, the audio data packet is a combined packet data packet; The first electronic device sends the audio data packet to the second electronic device.
2. The method according to claim 1, characterized in that, The first electronic device processes at least one audio data stream to be sent according to the packet combining ability of the first electronic device and the data channel establishment message, to obtain audio data packets, including: When the first electronic device has the packet combining ability and the second electronic device has the unpacking ability, the first electronic device performs packet combining processing on the at least one audio data stream to be sent, to obtain the audio data packet; wherein, the audio data packet includes a packet combining type identifier, and the packet combining type identifier is used to identify that the audio data packet is a combined packet data packet.
3. The method according to claim 1, characterized in that, The first electronic device processes at least one audio data stream to be sent according to the packet combining ability of the first electronic device and the data channel establishment message, to obtain audio data packets, including: When the first electronic device does not have the packet combining ability or the second electronic device does not have the unpacking ability, the first electronic device performs single-packet processing on the at least one audio data stream to be sent, to obtain at least one of the audio data packets; wherein, each audio data packet in the at least one audio data packet includes a single-packet type identifier, and the single-packet type identifier is used to identify each of the audio data packets as a single-packet data packet.
4. The method according to claim 3, characterized in that, The single-packet type identifier is the audio stream type of the audio data stream in the audio data packet.
5. The method according to claim 1, characterized in that, When the second electronic device has the unpacking ability, the data channel establishment message includes an unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message does not include the unpacking ability identifier.
6. The method according to claim 1, characterized in that, When the second electronic device has the unpacking ability, the data channel establishment message includes a first unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message includes a second unpacking ability identifier; the first unpacking ability identifier is different from the second unpacking ability identifier.
7. The method according to any one of claims 1 - 6, wherein, when establishing an audio data channel, the first electronic device receives a data channel establishment message sent by the second electronic device, including: when the service type of the data channel is a speaker and the transmission type of the data channel is MagicLink, the first electronic device receives the data channel establishment message sent by the second electronic device.
8. The method according to claim 2, wherein, the packet header of each audio data stream to be sent in the at least one audio data stream to be sent carries version information. When the version information is the first version, the packet header of the audio data stream to be sent carries a channel number; the first electronic device performs packet combining processing on the at least one audio data stream to be sent to obtain the audio data packet, including: when the version information carried in the packet header of the audio data stream to be sent is the first version, the first electronic device generates an audio stream type corresponding to each audio data stream to be sent; the first electronic device creates an audio encoder corresponding to each channel number according to the channel number; the first electronic device uses each of the audio encoders to perform encoding processing on the audio data stream to be sent with each channel number to obtain at least one encoded audio data stream; the first electronic device performs single - packet processing on the at least one encoded audio data to obtain at least one single - packet data packet; wherein, the packet header of each single - packet data packet in the at least one single - packet data packet includes the corresponding audio stream type; the first electronic device performs packet combining processing on the at least one single - packet data packet to obtain a combined packet data packet.
9. The method according to claim 3, wherein, the packet header of each audio data stream to be sent in the at least one audio data stream to be sent carries version information. When the version information is the second version, the packet header of the audio data stream to be sent carries an audio stream type; the first electronic device performs single - packet processing on the at least one audio data to be sent to obtain at least one audio data packet, including: when the version information carried in the packet header of the audio data stream to be sent is the second version, the first electronic device calls a static audio encoder; the first electronic device uses the static audio encoder to perform encoding processing on the at least one audio data to be sent to obtain at least one encoded audio data stream; the first electronic device performs single - packet processing on the at least one encoded audio data stream to obtain at least one single - packet data packet; wherein, the packet header of each single - packet data packet in the at least one single - packet data packet includes the corresponding audio stream type.
10. An audio data transmission method, wherein, applied to a second electronic device, the method includes: when establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device; the data channel establishment message is used to indicate the unpacking ability of the second electronic device; The second electronic device receives the audio data packet sent by the first electronic device; The second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played.
11. The method according to claim 10, wherein, The second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played, including: When the audio data packet includes a packet combining type identifier, the second electronic device performs unpacking processing on the audio data to obtain at least one audio data stream to be played.
12. The method according to claim 10, wherein, The second electronic device processes the audio data packet according to the data packet type of the audio data packet to obtain at least one audio data stream to be played, including: When the audio data packet includes a single packet type identifier, the second electronic device performs single packet reception processing on the audio data to obtain an audio data stream to be played.
13. The method according to claim 10, wherein, When the second electronic device has the unpacking ability, the data channel establishment message includes an unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message does not include the unpacking ability identifier.
14. The method according to claim 10, wherein, When the second electronic device has the unpacking ability, the data channel establishment message includes a first unpacking ability identifier; when the second electronic device does not have the unpacking ability, the data channel establishment message includes a second unpacking ability identifier; the first unpacking ability identifier is different from the second unpacking ability identifier.
15. The method according to any one of claims 10-14, wherein, When establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device, including: When the service type of the data channel is a speaker and the transmission type of the data channel is Magic Link, the second electronic device sends a data channel establishment message to the first electronic device.
16. An electronic device, wherein, The electronic device includes a memory and a processor; the memory and the processor are coupled; the memory is used to store computer program code, and the computer program code includes computer instructions. When the processor executes the computer instructions, the electronic device executes the method according to any one of claims 1-15.
17. A computer-readable storage medium, wherein, The computer-readable storage medium stores a computer program or instructions. When the computer program or instructions run on a computer, the computer executes the method according to any one of claims 1-15.
Citation Information
Patent Citations
Cross-device audio playing method, mobile terminal, electronic device and storage medium
CN114205336A
Media file transmission method and device
CN115426338A
Audio data transmission method, electronic device and storage medium
WO2022151778A1
Cross-device audio data transmission method and electronic devices
WO2023088209A1