An audio data transmission method and electronic device

By exchanging packet unpacking capability information and deciding on packet merging during audio data transmission, the problem of incompatibility between audio data transmission technology versions is solved, achieving compatibility and reliability of audio data transmission between devices of different versions.

CN120091359BActive Publication Date: 2026-03-13HONOR DEVICE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-24
Publication Date
2026-03-13

AI Technical Summary

Technical Problem

In scenarios where two electronic devices are interconnected, audio data transmission may fail due to incompatibility between different audio data transmission technology versions, resulting in the inability to play audio normally.

Method used

By exchanging unpacking capability information when establishing an audio data channel, and deciding whether to perform packet merging based on the other party's unpacking capability, the audio data packet type is ensured to be compatible with the other party's device.

Benefits of technology

It achieves compatibility between different versions of audio data transmission technology, improves the reliability and success rate of data transmission, and ensures that audio can be played normally in various interconnected scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120091359B_ABST
    Figure CN120091359B_ABST
Patent Text Reader

Abstract

This application discloses an audio data transmission method and electronic device, 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 indicates the unpacking capability of the second electronic device; the first electronic device processes at least one audio data stream to be sent according to its unpacking capability and the data channel establishment message to obtain an audio data packet. Thus, the first electronic device can decide whether to perform unpacking processing on the audio data stream based on the unpacking capability and the unpacking capability of the second electronic device, ensuring that the data packet type of the obtained audio data packet is compatible with the unpacking capability of the second electronic device.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of terminal technology, specifically relating to an audio data transmission method and an electronic device. Background Technology

[0002] In scenarios where two electronic devices are interconnected (e.g., a mobile phone and a vehicle system interconnected or a mobile phone and a tablet interconnected), one electronic device can project audio onto another electronic device so that the audio can be played through the other electronic device.

[0003] The audio data transmission technologies used by the two electronic devices may be different versions. For example, a newer version of the audio data transmission technology has the ability to combine and unpack audio data. An older version of the audio data transmission technology does not have this ability.

[0004] Thus, if two interconnected electronic devices use different versions of audio data transmission technology, incompatibility between the audio data transmission technology versions may cause audio data transmission errors, resulting in the inability to play audio normally. Summary of the Invention

[0005] This application provides an audio data transmission method and an electronic device that are compatible with scenarios where different versions of audio data transmission technologies are used for audio data transmission.

[0006] In a first aspect, this application provides an audio data transmission method 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 capability of the second electronic device; 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 an audio data packet; wherein, when the second electronic device does not have the unpacking capability, the audio data packet is a single-packet data packet; when the first electronic device has the packet combining capability and the second electronic device has the unpacking capability, the audio data packet is a combined-packet data packet; and 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 packet repackaging on the audio data stream based on the unpacking capability of the second electronic device and the packet repackaging capability 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 unpacking capability of the second electronic device.

[0008] In one possible implementation, a first electronic device processes at least one audio data stream to be sent based on its packet-merging capability and a data channel establishment message to obtain an audio data packet. This includes: when the first electronic device has packet-merging capability and the second electronic device has packet-unmerging capability, the first electronic device performs packet-merging processing on at least one audio data stream to be sent to obtain an audio data packet; wherein the audio data packet includes a packet-merging type identifier, which is used to identify the audio data packet as a packet-merged data packet.

[0009] In this way, after receiving the audio data packet, the second electronic device can determine that the audio data packet is a combined data packet based on the combined packet type identifier in the audio data packet. Then, based on the fact that the audio data packet is a combined data packet, it can perform unpacking processing on the received combined data packet. Thus, because the second electronic device has unpacking capabilities and the audio data packet it receives is a combined data packet, the second electronic device can perform normal unpacking processing on the received combined data packet.

[0010] In one possible implementation, a first electronic device processes at least one audio data stream to be sent based on its packet-merging capability and a data channel establishment message to obtain an audio data packet. This includes: if the first electronic device does not have packet-merging capability or the second electronic device does not have packet-unmerging capability, the first electronic device performs single-packet processing on the at least one audio data stream to be sent to obtain at least one audio data packet; wherein each audio data packet in the at least one audio data packet includes a single-packet type identifier, which is used to identify each audio data packet as a single-packet data packet.

[0011] In this way, the first electronic device can choose not to merge the audio data stream, either because it lacks the ability to merge packets or the second electronic device lacks the ability to disassemble packets. Conversely, upon receiving the audio data packet, the second electronic device can determine that the audio data packet is a single packet based on the single packet type identifier within it. Therefore, it can choose not to disassemble the audio data packet based on this single packet type identifier. This allows the second electronic device to perform normal single packet reception processing on the received single data packet.

[0012] In one possible implementation, the single packet type is identified as the audio stream type of the audio data stream within the audio data packet.

[0013] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes an unpacking capability identifier; if the second electronic device does not have unpacking capability, the data channel establishment message does not include an unpacking capability identifier.

[0014] Thus, after the first electronic device receives the data channel establishment message, if the data channel establishment message includes a packet unpacking capability identifier, the first electronic device can determine that the second electronic device has packet unpacking capability. If the data channel establishment message does not include a packet unpacking capability identifier, the first electronic device can determine that the second electronic device does not have packet unpacking capability.

[0015] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes a first unpacking capability identifier; if 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 and the second unpacking capability identifier are different.

[0016] Thus, after the first electronic device receives the data channel establishment message, if the data channel establishment message includes a first unpacking capability identifier, the first electronic device can determine that the second electronic device has unpacking capability. If the data channel establishment message does not include a second unpacking capability identifier, the first electronic device can determine that the second electronic device does not have unpacking capability.

[0017] In one possible implementation, 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 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.

[0018] In one possible implementation, the header of each audio data stream to be sent carries version information. If the version information is a first version, the header of the audio data stream to be sent carries a channel number. A first electronic device performs packet merging processing on the at least one audio data stream to be sent to obtain an audio data packet. This includes: if the version information carried in the header of the audio data stream to be sent is a 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 based on the channel number; the first electronic device uses each audio encoder to encode 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 the at least one encoded audio data stream to obtain at least one single-packet data packet; wherein the header of each single-packet data packet in the at least one single-packet data packet includes its corresponding audio stream type; and the first electronic device performs packet merging processing on the at least one single-packet data packet to obtain a merged data packet.

[0019] In this way, the first electronic device can dynamically create an audio encoder based on the version information carried by the audio data stream to be sent (as version 1) and determine the number of dynamically created audio encoders.

[0020] In one possible implementation, the header of each audio data stream to be sent carries version information. If the version information is a second version, the header of the audio data stream to be sent carries an audio stream type. A first electronic device performs single-packet processing on the at least one audio data stream to be sent to obtain at least one audio data packet, including: if the version information carried in the header of the audio data stream to be sent is a second version, the first electronic device calls a static audio encoder; the first electronic device uses the static audio encoder to encode the at least one audio data stream 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 header of each single-packet data packet in the at least one single-packet data packet includes its corresponding audio stream type.

[0021] In this way, the first electronic device can directly call the static audio encoder based on the version information carried by the audio data stream to be sent, which is the second version, without having to dynamically create an audio encoder.

[0022] Secondly, this 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 a first electronic device; the data channel establishment message is used to indicate the unpacking capability of the second electronic device; the second electronic device receives audio data packets sent by the first electronic device; the second electronic device processes the audio data packets according to the data packet type of the audio data packets 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 capability through the data channel establishment message, allowing the first electronic device to decide whether to process the audio data stream as a single packet. After receiving the audio data packet, the second electronic device can decide whether to unpack the audio data packet based on its packet type. Specifically, if the audio data packet is a single packet, the second electronic device will unpack it. If the audio data packet is a single packet, the second electronic device will not unpack it.

[0024] In one possible implementation, 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: if the audio data packet includes a 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.

[0025] In one possible implementation, 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 possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes an unpacking capability identifier; if the second electronic device does not have unpacking capability, the data channel establishment message does not include an unpacking capability identifier.

[0027] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes a first unpacking capability identifier; if 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 and the second unpacking capability identifier are different.

[0028] In one possible implementation, 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 speaker and the transmission type of the data channel is MagicLink, the second electronic device sends a data channel establishment message to the first electronic device.

[0029] Thirdly, this 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, which includes computer instructions, and when the processor executes the computer instructions, it causes the electronic device to perform the method as described in either the first or second aspect.

[0030] Fourthly, this application provides a computer-readable storage medium storing a computer program or instructions that, when executed on a computer, cause the computer to perform the method as described in either the first or second aspect. Attached Figure Description

[0031] Figure 1 This application scenario diagram illustrates the interconnection between the first electronic device 10 and the second electronic device 20, as provided in the embodiments of this application.

[0032] Figure 2An interconnection scenario diagram of a first electronic device 10 and a second electronic device 20 employing different versions of audio data transmission technology, provided for embodiments of this application;

[0033] Figure 3 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application;

[0034] Figure 4 A software structure framework for an electronic device provided in this application embodiment;

[0035] Figure 5 A module interaction diagram of an audio data transmission method provided in an embodiment of this application;

[0036] Figure 6 A module interaction diagram for yet another audio data transmission method provided in this application embodiment;

[0037] Figure 7A A schematic diagram illustrating the splitting processing of an audio data stream by a first electronic device, as provided in an embodiment of this application;

[0038] Figure 7B A schematic diagram illustrating a first electronic device that does not perform splitting processing on an audio data stream, as provided in an embodiment of this application;

[0039] Figure 8 A flowchart illustrating an audio data transmission method applied to a first electronic device, provided as an embodiment of this application;

[0040] Figure 9 A flowchart illustrating an audio data transmission method applied to a second electronic device, provided as an embodiment of this application;

[0041] Figure 10 This is a structural block diagram of a chip provided in an embodiment of this application. Detailed Implementation

[0042] To facilitate understanding of the technical solution of this application, the application scenario of this application will be described first below.

[0043] Figure 1 This is an application scenario diagram illustrating the interconnection between a first electronic device 10 and a second electronic device 20, as provided in an embodiment of this application. Figure 1 As shown, in a scenario where the first electronic device 10 and the second electronic device 20 are interconnected, after establishing a communication connection, the first electronic device 10 can project audio to the second electronic device 20 so that the audio can be played 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, and calls to the second electronic device 20.

[0044] The audio data transmission technologies used by the first electronic device 10 and the second electronic device 20 may include different versions.

[0045] For example, taking a mobile phone as the first electronic device 10 and an in-vehicle infotainment system as the second electronic device 20, in the new version of 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 ability to split the streams. Thus, 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 splits the transmission of different audio stream types of audio data streams to the second electronic device 20, the first electronic device 10 can perform packet processing on the different audio stream types to obtain a packetized data package. Then, it sends the packetized data package to the second electronic device 20. Correspondingly, the second electronic device 20 can perform packet unpacking processing on the packetized data package to obtain the audio data to be played. In this way, by packaging audio data streams of different audio stream types into packetized data packages for transmission, data transmission efficiency can be improved. That is to say, the first electronic device 10 using the new version of audio data transmission technology has packet merging capability, and the second electronic device 20 using the new version of audio data transmission technology has packet unpacking capability.

[0046] Another example is a mobile phone as the first electronic device 10 and a tablet computer as the second electronic device 20. In older versions of 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 lacks the ability to split the streams. 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 single-packet data packets. Then, it sends the single-packet data packets to the second electronic device 20. It is clear that the first electronic device 10 does not need to perform packet merging processing on the audio data stream, and the second electronic device 20 does not need to perform packet unmerging processing on the audio data stream. In other words, the first electronic device 10 using older versions of audio data transmission technology lacks packet merging capabilities, and the second electronic device 20 using older versions of audio data transmission technology lacks packet unmerging capabilities.

[0047] Among them, single packet processing refers to encapsulating the mixed audio data stream into a small packet to form a single packet data packet; or, encapsulating an audio data stream of an audio stream type into a small packet to form a single packet data packet.

[0048] Packet merging refers to first encapsulating the audio data streams of each audio stream type into a small packet, i.e., a single data packet. Then, all the single data packets are encapsulated into a large packet to form a merged data packet. In other words, a merged data packet can contain one or more single data packets.

[0049] In practical applications, interconnected first electronic device 10 and second electronic device 20 may exhibit the following characteristics: Figure 2 The four scenarios are shown. For example... Figure 2 As shown in (a), both the first electronic device 10 and the second electronic device 20 employ a new version of audio data transmission technology. Thus, the first electronic device 10 has the ability to combine data packets, and the second electronic device 20 has the ability to unpack them. Figure 2 As shown in (b), both the first electronic device 10 and the second electronic device 20 use older versions of audio data transmission technology. Therefore, the first electronic device 10 lacks the ability to combine packets, and the second electronic device 20 lacks the ability to unpack packets. Figure 2 As shown in (c), the first electronic device 10 uses a new version of audio data transmission technology, while the second electronic device 20 uses an older version. Thus, the first electronic device 10 has the ability to combine packets, while the second electronic device 20 does not have the ability to unpack packets. Figure 2 As shown in (d), the first electronic device 10 uses an older version of audio data transmission technology, while the second electronic device 20 uses a newer version. Thus, the first electronic device 10 lacks the ability to combine packets, while the second electronic device 20 possesses the ability to unpack packets.

[0050] in, Figure 2 In the scenarios shown in (a) and (b), because the audio data transmission technologies used by the two interconnected electronic devices are compatible, the audio data transmission is relatively reliable, and problems with audio data transmission generally do not cause the second electronic device 20 to fail to play audio properly. Figure 2 In the scenarios shown in (c) and (d), because the audio data transmission technologies used by the two interconnected electronic devices are incompatible, the second electronic device 20 may be unable to play audio properly due to this incompatibility. For example, as... Figure 2 In the scenario shown in (c), the first electronic device 10 combines the audio data stream into packets and sends them to the second electronic device 20. Because the second electronic device 20 lacks the ability to decompose the packets, it cannot extract the audio data, thus preventing it from playing the audio correctly. For example, as... Figure 2In the scenario shown in (d), because the first electronic device 10 lacks packet combining capabilities, the audio data packets sent by the first electronic device 10 to the second electronic device 20 are single-packet data packets. However, because the second electronic device 20 has packet unpacking capabilities, it automatically performs unpacking processing upon receiving the single-packet data packets. As a result, since the second electronic device 20 cannot perform the normal unpacking procedure, it will report an error, causing the second electronic device 20 to be unable to play the audio correctly.

[0051] This application provides an audio data transmission method. When establishing an audio data channel, a second electronic device can send a data channel establishment message to a first electronic device, indicating the second electronic device's packet unpacking capability. During the audio data transmission phase, the first electronic device can decide whether to process the audio data stream to be transmitted into single packets or multiple packets based on its packet combining capability and the second electronic device's packet unpacking capability. The audio data packet obtained after packet combining is a combined data packet, and the audio data packet obtained after single packet processing is a single data packet. After receiving the audio data packet sent by the first electronic device, the second electronic device can decide whether to unpack the audio data packet based on its data packet type. Thus, the data transmission method provided by this application is compatible with different versions of data transmission technologies in electronic devices, improving the reliability of data transmission between two electronic devices in various interconnection scenarios.

[0052] It should be noted that the embodiments of this application do not limit the specific forms of the interconnected first and second electronic devices. The first and second electronic devices can be of the same or different types. For example, the first electronic device can be a mobile phone, tablet computer, laptop computer, in-vehicle infotainment system, etc., and the second electronic device can be a mobile phone, tablet computer, laptop computer, in-vehicle infotainment system, etc.

[0053] Figure 3 This is a schematic diagram of the hardware structure of an electronic device 100 provided in an embodiment of this application. The specific structures of the first electronic device 10 and the second electronic device 20 can be referred to... Figure 3 The diagram shows the structure of the electronic device 100.

[0054] Electronic device 100 may include processor 110, external memory interface 120, internal memory 121, universal serial bus (USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, sensor module 180, button 190, motor 191, indicator 192, camera 193, display screen 194, and 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 accelerometer sensor 180E, a distance sensor 180F, a proximity 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 is understood that the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0056] Processor 110 may include one or more processing units, such as application processors (APs), modem processors, graphics processing units (GPUs), image signal processors (ISPs), controllers, video codecs, digital signal processors (DSPs), baseband processors, and / or neural network processing units (NPUs). These different processing units may be independent devices or integrated into one or more processors.

[0057] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0058] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the 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. Interfaces may 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 is understood that the interface connection relationships between the modules illustrated in the embodiments of the present invention are merely illustrative and do not constitute a structural limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may also employ different interface connection methods or combinations of multiple interface connection methods as described in the above embodiments.

[0061] The charging management module 140 receives charging input from a charger. The charger can be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 receives charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 receives wireless charging input via 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 via the power management module 141.

[0062] The power management module 141 connects the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, providing power to the processor 110, internal memory 121, display screen 194, camera 193, and wireless communication module 160, etc. The power management module 141 can also monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage current, impedance). In some other embodiments, the power management module 141 may also be located within the processor 110. In other embodiments, the power management module 141 and the charging management module 140 may be located in the same device.

[0063] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0064] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0065] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed 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 may be housed in the same device.

[0066] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to speaker 170A, receiver 170B, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0067] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, performs frequency modulation and filtering of the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, perform frequency modulation and amplification, and convert them into electromagnetic waves for radiation via antenna 2.

[0068] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology 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 the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0069] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0070] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel may 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 miniature LED, a microLED, a quantum dot light-emitting diode (QLED), etc. In some embodiments, electronic device 100 may include one or N displays 194, where N is a positive integer greater than 1.

[0071] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0072] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, transforming it into an image visible to the naked eye. The ISP can also perform algorithmic optimization of image noise, brightness, and skin tone. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0073] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0074] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0075] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0076] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0077] The external storage 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 storage interface 120 to perform data storage functions. For example, music, video, and other files can be saved on the external memory card.

[0078] Internal memory 121 can be used to store computer executable program code, which includes instructions. Internal memory 121 may include a program storage area and a data storage area. The program storage area may store the operating system, at least one application program required for a function (such as sound playback, image playback, etc.), etc. The data storage area may store data created during the use of electronic device 100 (such as audio data, phonebook, etc.). Furthermore, internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, universal flash storage (UFS), etc. Processor 110 executes various functional applications and data processing of electronic device 100 by running instructions stored in internal memory 121 and / or instructions stored in memory located in the processor.

[0079] Electronic device 100 can implement audio functions, such as music playback and recording, through audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, and application processor.

[0080] The audio module 170 is used to convert digital audio information into analog audio signals for output, and also to convert analog audio input into digital audio signals. The audio module 170 can also be used for encoding and decoding audio signals. In some embodiments, the audio module 170 may be located in the processor 110, or some functional modules of the audio module 170 may be located in the processor 110.

[0081] The speaker 170A, also known as a "loudspeaker," is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or make hands-free calls through the speaker 170A. Multiple speakers 170A can be installed in the electronic device 100; for example, a speaker 170A can be installed on the top of the electronic device 100, or a speaker 170A can be installed on the bottom, etc.

[0082] The receiver 170B, also known as a "handpiece," is used to convert audio electrical signals into sound signals. When the electronic device 100 answers a telephone call or voice message, the receiver 170B can be brought close to the ear to hear the voice. In some embodiments, the speaker 170A and the receiver 170B can also be configured as a single component, which is not a limitation of this application.

[0083] Microphone 170C, also known as a "microphone" or "voice transducer," is used to convert sound signals into electrical signals. When making a phone call or sending a voice message, the user can speak by bringing their mouth close to microphone 170C, inputting the sound signal into microphone 170C. Electronic device 100 may have at least one microphone 170C. In some embodiments, electronic device 100 may have two microphones 170C, which, in addition to collecting sound signals, can also perform noise reduction. In other embodiments, electronic device 100 may also have three, four, or more microphones 170C, which can collect sound signals, reduce noise, identify the sound source, and perform directional recording, etc.

[0084] The 170D headphone jack is used to connect wired headphones. The 170D headphone jack can be a USB 130 interface or a 3.5mm Open Mobile Terminal Platform (OMTP) standard interface, a CTIA (Cellular Telecommunications Industry Association of the USA) standard interface.

[0085] Buttons 190 include a power button, volume buttons, etc. Buttons 190 can be mechanical buttons or touch-sensitive buttons. Electronic device 100 can receive button input and generate key signal inputs related to user settings and function control of electronic device 100.

[0086] Motor 191 can generate vibration alerts. Motor 191 can be used for incoming call vibration alerts or for touch vibration feedback. For example, different vibration feedback effects can correspond to touch operations performed on different applications (such as taking photos, playing audio, etc.). Motor 191 can also correspond to different vibration feedback effects for touch operations performed on different areas of the display screen 194. Different application scenarios (such as time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also be customized.

[0087] Indicator 192 can be an indicator light, used to indicate charging status, power changes, or to indicate messages, missed calls, notifications, etc.

[0088] The SIM card interface 195 is used to connect a SIM card. The SIM card can be inserted into or removed from the SIM card interface 195 to make contact with and separate from the electronic device 100. The electronic device 100 can support one 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 simultaneously. The multiple cards can be of the same or different types. The SIM card interface 195 is also compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In some embodiments, the electronic device 100 uses an eSIM, i.e., 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 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.

[0090] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system libraries, the hardware abstraction layer (HAL), and the kernel layer.

[0091] The application layer can include a series of application packages. The application layer can run applications by calling the application programming interface (API) provided by the application framework layer.

[0092] like Figure 4 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0093] The application framework layer provides application programming interfaces (APIs) and a programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0094] like Figure 4 As shown, the application framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc. The application framework layer may also include an audio virtualization module, service management module, data transmission module, etc.

[0095] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0096] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0097] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0098] The phone manager is used to provide communication functions for electronic device 100. For example, it manages call status (including connection and disconnection).

[0099] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0100] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0101] In a scenario where a first electronic device and a second electronic device are interconnected, 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 merging capabilities to the service management module of the second electronic device, and can also be used to receive information including packet unmerging 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 merging 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 unmerging processing on the audio data stream.

[0102] For example, the audio virtualization module, service management module, and data transmission module can be implemented using different classes. For instance, the audio virtualization module of the first electronic device could be a `ServiceAudioWrapper` class, and the audio virtualization module of the second electronic device could be an `AudioSteam` class. The service management module of the first electronic device could be a `RemoteVirtualServiceSource` class, and the service management module of the second electronic device could be a `VirtualServiceSink` class. The data transmission module of the first electronic device could be a `RemoteDataSession` class, and the data transmission module of the second electronic device could be a `DataSession` class.

[0103] The Android Runtime consists of core libraries and a virtual machine. The 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 functionalities that need to be called by the Java language, and the other part is the Android core library.

[0105] The application layer and application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and 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] System libraries can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0107] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0108] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0109] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0110] A 2D graphics engine is a graphics engine for 2D drawing.

[0111] HAL (Hardware Abstraction Layer) is the abstract interface for the device kernel driver, providing application programming interfaces (APIs) for accessing the underlying device to higher-level Java API frameworks. The Hardware Abstraction Layer can include multiple library modules, such as display, audio, Bluetooth, and Wi-Fi modules. Each module can implement an interface for a specific type of hardware component. When the framework API requests access to the device hardware, the Android system loads the library module for that hardware component.

[0112] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0113] Figure 5 This is a module interaction diagram of an audio data transmission method according to an embodiment of this application. For example... Figure 5 As shown, taking a first electronic device including a first audio virtualization module, a first service management module, and a first data transmission module, and a 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 this application will be exemplarily described. Figure 5 As shown, the method may include the following steps:

[0114] S201, the first audio virtualization module sends a request to the first data transmission module to establish a data channel.

[0115] S202, after receiving the request to establish a data channel, the first data transmission module begins to establish the data channel.

[0116] S203, if 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 establishing a basic communication connection between the first electronic device and the second electronic device, they further establish a data channel. The data channel refers to the channel used for data transmission between the first electronic device and the second electronic device.

[0118] For example, after the first electronic device and the second electronic device establish a basic communication connection, if the first electronic device recognizes that the second electronic device includes a speaker, a microphone, and a camera, the first electronic device will typically request the establishment of data channels corresponding to the speaker, the microphone, and the camera, respectively. 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] If the first service management module determines that the service type of the currently established data channel is speaker, it can send a first message to the second service management module. This first message can indicate whether encryption or decryption of the transmitted data is required. For example, the first message could be a trigger_options message.

[0120] In some embodiments, the first electronic device may send its packet-splitting capability to the second electronic device. Thus, the first message can also be used to indicate the packet-splitting capability of the first electronic device. The packet-splitting capability of the first electronic device includes whether the first electronic device has packet-splitting capability or not.

[0121] In one possible implementation, if the first electronic device has packet merging capability, a packet merging capability identifier can be carried in the first message. If the first electronic device does not have packet merging capability, the packet merging capability identifier can be omitted from the first message. Thus, after receiving the first message, the second electronic device can determine the packet merging capability of the first electronic device based on whether the packet merging capability identifier is carried in the first message.

[0122] In another possible implementation, if the first electronic device has the ability to combine packets, a first combining capability identifier can be carried in the first message. If the second electronic device does not have the ability to unpack packets, a second combining capability identifier can be carried in the first message. The first combining capability identifier and the second combining capability identifier are different. Thus, after receiving the first message, the second electronic device can determine the combining capability of the first electronic device based on whether the combining capability identifier carried in the first message is the first or the second combining capability identifier.

[0123] In some embodiments, the first electronic device may not send its packet-switching capability to the second electronic device. Thus, the first message is not used to indicate the packet-switching capability of the first electronic device.

[0124] In some embodiments, if the first service management module determines that the service type of the currently established data channel is speaker and the transmission type of the data channel is the target transmission type, it may send first information to the second service management module. The target transmission type includes MagicLink.

[0125] Data channel transmission types can include Huawei Share OneHop (OneHop) and MagicLink. Both OneHop and MagicLink enable interconnection between two electronic devices, allowing data transfer without the need for a data cable or other external devices. OneHop has limitations on the size of data that can be transferred and is typically used for transferring smaller files, images, etc. MagicLink, on the other hand, has no size limit and can be used to transfer large, combined data packets.

[0126] Based on this, in this embodiment of the application, when the service type of the currently established data channel is speaker and the transmission type of the data channel is MagicLink, the first information can be sent to the second service management module. This ensures that the combined audio data packets are sent to the second electronic device.

[0127] S204, after receiving the first message, the second service management module parses the packet-switching capability of the first electronic device based on the first message.

[0128] S205, the second service management module sends the packetization capability of the first electronic device to the second audio virtualization module.

[0129] S206, the second audio virtualization module preserves the packet-storing capability of the first electronic device.

[0130] For example, if the second service management module detects that the first message includes a package-sharing capability identifier, it determines that the first electronic device has package-sharing capability. Conversely, if the second service management module detects that the first message does not include a package-sharing capability identifier, it determines that the first electronic device does not have package-sharing capability.

[0131] As another example, if the second service management module recognizes that the first message includes a first package-sharing capability identifier, it determines that the first electronic device has package-sharing capability. Conversely, if the second service management module recognizes that the first message includes a second package-sharing capability identifier, it determines that the first electronic device does not have package-sharing capability.

[0132] It should be understood that if the first information is not used to indicate the packet-gathering capability of the first electronic device, that is, if the first electronic device does not send the packet-gathering capability of the first electronic device to the second electronic device, then the above steps S204 to S206 may not be performed.

[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 upon receiving the first message.

[0135] In some embodiments, the second service management module may also send second information to the first service management module if it determines that the service type of the currently established data channel is speaker.

[0136] In some embodiments, the second service management module may also send second information to the first service management module if it determines that the service type of the currently established data channel is speaker and the transmission type of the data channel is the target transmission type. The target transmission type includes MagicLink.

[0137] The second message can be a SendSetup message (also known as a data channel establishment message), which can be used to indicate whether encryption or decryption of the transmitted data is required. The second message can also indicate the unpacking capability of the second electronic device. This unpacking capability includes whether the second electronic device has the capability to unpack data or not.

[0138] In one possible implementation, if the second electronic device has unpacking capability, an unpacking capability identifier can be carried in the second message. If the second electronic device does not have unpacking capability, the unpacking capability identifier may not be carried in the first message. Thus, after receiving the second message, the first electronic device can determine its unpacking capability based on whether the second message carries the unpacking capability identifier.

[0139] In another possible implementation, if the second electronic device has unpacking capability, a first unpacking capability identifier can be carried in the second message. If the second electronic device does not have unpacking capability, the second unpacking capability identifier may not be carried in the first message. The first and second unpacking capability identifiers are different. Thus, after receiving the second message, the first electronic device can determine its unpacking capability based on whether the unpacking capability identifier carried in the second message is the first or second unpacking capability identifier.

[0140] S208, after receiving the second message, the first service management module parses the unpacking capability of the second electronic device based on the second message.

[0141] Steps S201 to S208 above constitute the audio data channel establishment stage provided in this embodiment. After the audio data channel is established, the first service management module of the first electronic device can store the unpacking capability of the second electronic device, and the second audio virtualization module of the second electronic device can store the merging capability of the first electronic device.

[0142] The following section continues to explain the process of audio data transmission based on the audio data channel established above.

[0143] S209, 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 acquires the unpacking capability of the second electronic device, it can determine whether the second electronic device has the unpacking capability or not. Furthermore, based on the unpacking capability and the repackaging capability of the second electronic device, the first data transmission module can decide whether to repackage at least one audio data stream. Please refer to steps S211a to S213b below for details.

[0146] S211a, when the first electronic device has the ability to merge packets and the second electronic device has the ability to unpack packets, the first data transmission module performs packet merging processing on at least one audio data stream to obtain an audio data packet, which is a merged 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 performs packet merging processing on at least one audio data stream, which can be implemented in the following manner: The first data transmission module can first process each audio data stream in the at least one audio data stream into a single packet to obtain at least one single packet data. Then, it can merge the multiple single packet data into a combined data packet.

[0150] For example, 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. Thus, the first data transmission module can separately package the music audio data stream and the navigation audio data stream into two single data packets. The first moment and the second moment can be the same moment or different moments.

[0151] Furthermore, the two single data packets can be cached in their respective output queues. Then, at preset intervals, the first data transmission module traverses each output queue, further packaging the single data packets in each queue into a larger packet, resulting in a combined data packet. This combined data packet is then sent 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 packets. For example, in the embodiments of this application, single-packet data packets may include a single-packet type identifier, and combined-packet data packets may include a combined-packet type identifier. The single-packet type identifier is used to identify that the audio data packet is a single-packet data packet, and the combined-packet type identifier is used to identify that the audio data packet is a combined-packet data packet.

[0153] In one implementation, the single-packet type identifier can be the actual audio stream type (streamtype) of each audio data stream. Specifically, the ssrc field of the header of each single-packet data stream can be filled with the actual audio stream type (streamtype) of each audio data stream. For example, the ssrc field of the header of a music single-packet data stream can be streamtype_music, and the ssrc field of the header of a navigation single-packet data stream can be streamtype_navigation. The combined packet type identifier can be streamtype_All. Specifically, the ssrc field of the header of a combined packet can be filled with streamtype_All.

[0154] Thus, since the second electronic device has the capability to unpack data packets, the first data transmission module sends a combined data packet adapted to this unpacking capability to the second audio virtualization module. Upon receiving the combined audio data packet, the second audio virtualization module can then perform normal unpacking processing, thereby ensuring the normal transmission of audio data.

[0155] S211b, if the first electronic device does not have the ability to combine packets or the second electronic device does not have the ability to unpack packets, the first data transmission module performs single-packet processing on at least one audio data stream to obtain at least one audio data packet, which 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, where the first electronic device has packet combining capability and the second electronic device does not have packet splitting capability, the first data transmission module performs single-packet processing on at least one audio data stream, which can be implemented as follows: The first data transmission module performs single-packet processing on each of the 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 can be used as the ssrc field of the packet header of each single-packet data packet. Further, the first data transmission module sends each single-packet data packet separately to the second data transmission module. Correspondingly, the second data transmission module receives multiple independent single-packet data packets.

[0159] In some embodiments, when the first electronic device does not have packet combining capabilities, 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 single packets to obtain a single 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 data packet.

[0160] Since the second electronic device lacks the ability to unpack data packets, the first data transmission module sends single-packet data packets to the second audio virtualization module, which are adapted to this lack of unpacking capability. Thus, the second audio virtualization module does not need to unpack each received single-packet data packet and can process them normally, ensuring the normal transmission of audio data.

[0161] In summary, the audio data packets received by the second audio virtualization module are either single packets or combined packets. Therefore, the second audio virtualization module can decide whether to split the received audio data packets based on the type of the received audio data packets.

[0162] The following describes the processing flow of the second audio virtualization module for the received audio data packets.

[0163] S214a, when the audio data packet type is a combined data packet, the second audio virtualization module performs unpacking processing on the audio data packet to obtain at least one audio data stream.

[0164] S214b, when the audio data packet type is a single packet data packet, the second audio virtualization module performs single packet reception processing on the audio data packet.

[0165] In one possible implementation, the second audio virtualization module can determine the data packet type of the audio data packet by judging whether the data 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, the data packet type of the audio data packet can be determined to be a combined data packet. If the audio data packet includes a single packet type identifier, the data packet type of the audio data packet can be determined to be a single packet data packet.

[0166] For example, if the second audio virtualization module determines that the SSRC field in the header of the audio data packet is streamtype_All, then the audio data packet can be determined to be a combined data packet. If the second audio virtualization module determines that the SSRC field in the header of the audio data packet is streamtype_music, streamtype_navigation, or streamtype_other, then the audio data packet can be determined to be a single data packet.

[0167] Thus, if the second audio virtualization module determines that the received audio data packet is a combined data packet, it will perform packet splitting processing on the audio data packet. If the second audio virtualization module determines that the received audio data packet is a single data packet, it will perform single packet reception processing on the audio data packet.

[0168] The second audio virtualization module, after decomposing the combined data packets, can obtain one or more individual data packets. After obtaining one or more individual data packets, each individual data packet can be further processed for single-packet reception to obtain audio data streams of different audio stream types.

[0169] When the first electronic device has packet merging capability, the second audio virtualization module can process individual data packets one by one to obtain a single-tone data stream (i.e., an audio data stream of one audio stream type). When the first electronic device does not have packet merging capability, the second audio virtualization module may obtain a mixed audio stream after processing individual data packets one by one.

[0170] In summary, the audio data transmission method provided in this application allows the first electronic device to decide whether to merge audio data streams based on the unpacking and repackaging capabilities of the second electronic device. The second electronic device can decide whether to unpack audio data packets based on the data packet type of the received audio data packets. Thus, even if the interconnected first and second electronic devices use different versions of audio data transmission technologies, normal audio data transmission can still be guaranteed.

[0171] It should be noted that in the above embodiments, the second electronic device decides whether to unpack the audio data packets based on the data packet type of the received audio data packets. Thus, the second electronic device does not need to consider the packet-combining capability of the first electronic device. Therefore, during the audio data channel establishment phase, the first information sent by the first electronic device to the second electronic device may not carry any identifier indicating the packet-combining capability of the first electronic device. In other words, steps S203 to S206 may also be omitted from the embodiments of this application.

[0172] In some embodiments, steps S203 to S206 described above may be included to enhance the reliability of audio data transmission. Correspondingly, the second electronic device may also decide whether to split the audio data packets based on the data packet type of the received audio data packets and the packet-splitting capability of the first electronic device. For example, if the first electronic device has packet-splitting capability and the received audio data packets are of the split-packet type, the second electronic device will split the audio data packets. If the first electronic device does not have packet-splitting capability or the received audio data packets are of the single-packet type, the second electronic device will not split the audio data packets.

[0173] The following is combined with Figure 2 The four scenarios shown illustrate the audio data transmission method provided in the embodiments of this application.

[0174] like Figure 2 As shown in (a), the first electronic device has the ability to combine data packets, and the second electronic device has the ability to unpack data packets. Thus, based on the first electronic device's ability to combine data packets and the second electronic device's ability to unpack data packets, the first electronic device can perform combined processing on the audio data stream. Correspondingly, after receiving the audio data packet, the second electronic device can determine whether to unpack the audio data packet based on the combined data packet type identifier included in the audio data packet. It is evident that in this scenario, the second electronic device has the ability to unpack data packets, and the audio data packet received by the second electronic device is a combined data packet. Therefore, the second electronic device can perform a normal unpacking process on the received combined data packet.

[0175] like Figure 2 As shown in (b), the first electronic device lacks the ability to combine packets, and the second electronic device lacks the ability to split packets. Therefore, based on the lack of either the first or second electronic device's packet-combining or splitting capabilities, the first electronic device can process the audio data stream as a single packet. Correspondingly, after receiving the audio data packet, the second electronic device can determine whether to perform single-packet reception processing based on the single-packet type identifier included in the audio data packet. It is evident that in this scenario, the second electronic device lacks the ability to split packets, and the audio data packet received by the second electronic device is a single-packet data packet. Therefore, the second electronic device can perform normal single-packet reception processing on the received single-packet data packet.

[0176] like Figure 2As shown in (c), the first electronic device has packet combining capability, while the second electronic device does not have packet splitting capability. Thus, based on the first electronic device's packet combining capability but the second electronic device's lack of packet splitting capability, the first electronic device can process the audio data stream as a single packet. Correspondingly, after receiving the audio data packet, the second electronic device can determine whether to perform single-packet reception processing based on the single-packet type identifier included in the audio data packet. It is evident that in this scenario, although the first electronic device has packet combining capability, it does not perform packet combining processing on the audio data stream because the second electronic device lacks packet splitting capability; instead, it processes the audio data stream as a single packet. Therefore, the audio data packet received by the second electronic device is a single-packet data packet, and thus, the second electronic device, lacking packet splitting capability, can perform normal single-packet reception processing on the received single-packet data packet.

[0177] like Figure 2 As shown in (d), the first electronic device lacks packet merging capabilities, while the second electronic device possesses packet unmerging capabilities. Thus, because the first electronic device lacks packet merging capabilities, it can process the audio data stream as a single packet. Correspondingly, after receiving an audio data packet, the second electronic device can determine whether to perform single-packet reception processing based on the single-packet type identifier included in the audio data packet. Therefore, in this scenario, although the second electronic device possesses packet unmerging capabilities, it can perform single-packet reception processing on the received audio data packet based on the single-packet type identifier included in the audio data packet, without performing packet unmerging.

[0178] As can be seen, the audio data transmission method provided in this application embodiment is compatible with the above four audio data transmission scenarios, ensuring that the first electronic device can correctly decide whether to merge the audio data stream and the second electronic device can correctly decide whether to unpack the audio data packet under the above four audio data transmission scenarios, thereby 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 processing on the audio data stream, such as Figure 6 As shown, it may also include the following steps:

[0180] S301, HAL receives at least one audio data stream sent by the frame layer.

[0181] In the application layer, applications such as music, navigation, and calls can send their respective audio data streams to the framework layer. The framework layer can then perform stream splitting or not, depending on whether it has the capability to split the audio data streams. For example, in newer versions of audio data transmission technology, the framework layer has splitting capabilities. In older versions of audio data transmission technology, the framework layer does not have splitting capabilities.

[0182] For example, such as Figure 7A As shown, if the first electronic device has a splitting capability, its framework layer can provide multiple channels to split the audio data stream and write the split audio data stream into the HAL. For example, the first electronic device can divide the audio data stream into three types: music, navigation, and other. The other types can include audio data streams such as notifications and calls. The framework layer of the first electronic device sets up three audio data transmission channels corresponding to these three audio stream types, each with a corresponding channel number (routeNo). For example, routeNo1 is used to transmit music audio data streams, routeNo2 is used to transmit navigation audio data streams, and routeNo3 is used to transmit other audio data streams.

[0183] Another example, such as Figure 7B As shown, if the first electronic device does not have the ability to split data, the frame layer of the first electronic device only provides one channel, and all audio data streams of all audio stream types are written to the HAL through this channel.

[0184] S302, HAL generates the packet header parameters for each audio data stream.

[0185] like Figure 7A As shown, if the first electronic device has a splitting capability, the header parameters of the audio data stream generated by HAL can include routeNo and first version information. Here, first version (version1) indicates that the first electronic device has a splitting capability, and second version (version0) indicates that the first electronic device does not have a splitting capability.

[0186] For example, such as Figure 7A As shown, the music audio data stream written to HAL, after processing by HAL, carries the header parameters: routeNo1, version1. The navigation audio data stream written to HAL, after processing by HAL, carries the header parameters: routeNo2, version1. Other audio data streams written to HAL, after processing by HAL, carry the header parameters: routeNo3, version1.

[0187] like Figure 7B As shown, if the first electronic device does not have the ability to split the stream, the header parameters of the audio data stream generated by HAL can include the audio stream type and second version information.

[0188] For example, such as Figure 7BAs shown, the first electronic device in the second version does not have splitting capability, and the frame layer outputs the mixing data stream. The mixing data stream is written to the HAL, and after processing by the HAL, the packet header parameters can be: music / navigation / other, version0.

[0189] S303, HAL sends at least one audio data stream to the first data transmission module, wherein 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 version one, the first data transmission module generates the audio stream type corresponding to each audio data stream.

[0192] Combination Figure 7A If the version information is version 1, the header parameters carried by each audio data stream do not include the audio stream type. Therefore, in the case of version 1, this embodiment can generate the audio stream type corresponding to each audio data stream for subsequent filling of the header of each single audio data packet.

[0193] For example, since different routeNos correspond to different audio stream types, the first data transmission module can generate the corresponding audio stream type based on the routeNo of each audio data stream. For instance, 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] As another example, the first data transmission module can generate a corresponding data stream type based on the usage parameter in each audio data stream. The usage parameter includes information characterizing the data stream type of the audio data stream.

[0195] S306a, the first data transmission module creates an audio encoder corresponding to each channel number based on the channel number.

[0196] S307a: Using each audio encoder, the frequency data stream corresponding to each channel number is encoded to obtain at least one encoded audio data stream.

[0197] Different audio encoders can be used to encode audio data streams of different audio stream types, that is, to compress audio data streams.

[0198] For the first electronic device with splitting capability, there is no pre-configured audio encoder. Therefore, after the first data transmission module receives the audio data stream, it needs to dynamically create the corresponding audio encoder.

[0199] In the case of version S305b, where the version information is version 2, the first data transmission module calls the static audio encoder.

[0200] The S306b uses a static audio encoder to encode the audio data stream, resulting in an encoded audio data stream.

[0201] For the first electronic device that lacks splitting capability, a static audio encoder is pre-configured. Therefore, after receiving the audio data stream, the first data transmission module 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 a static audio encoder corresponding to each audio stream type. Thus, after receiving the audio data stream, the first data transmission module can directly invoke the static audio encoder corresponding to the audio stream type.

[0203] It should be noted that for the first electronic device that does not have the capability to split audio streams, the audio data stream that needs to be encoded may be a mixed data stream or a mono audio stream. After the corresponding encoding process, an encoded audio data stream is obtained.

[0204] Furthermore, embodiments of this application can perform packet merging or single packet processing on the encoded audio data stream to obtain audio data packets.

[0205] As can be seen, steps S301 to S306b above describe the encoding process of the audio data stream for different versions of the first electronic device. Correspondingly, after the second electronic device performs audio data packet unpacking or single packet reception processing, the resulting audio data stream is the encoded audio data stream. Therefore, the second electronic device may also include a step of decoding the obtained encoded audio data stream.

[0206] The following describes the decoding process of audio data streams in different versions of the second electronic device.

[0207] Please continue reading Figure 6 As shown, the decoding process of the audio data stream by the second electronic device may include the following steps:

[0208] S401, the second audio virtualization module determines whether the header parameters of the audio data stream obtained after each packet splitting or single packet receiving process include the channel number (routeNo).

[0209] S402, when the packet header parameters include channel numbers, the second audio virtualization module creates audio decoders corresponding to each channel number based on the channel numbers.

[0210] For example, if the packet header parameter includes a channel number, three audio decoders can be created, each of which is used to decode the audio data stream under the three channel numbers.

[0211] In some embodiments, if the packet header parameter includes a channel number, three receiving threads can be created. Each receiving thread can be used to receive audio data streams of different decoded audio stream types.

[0212] S403, in the case where the packet header parameters do not include the channel number, the second audio virtualization module creates an audio decoder.

[0213] If the packet header parameters do not include the channel number, it indicates that the first electronic device does not have the capability for splitting. Therefore, the audio data stream obtained after single packet reception and processing is a single audio data stream, which can be a mixed data stream or a single-tone data stream. Therefore, in this embodiment of the application, when it is determined that the packet header parameters do not include the channel number, the second audio virtualization module can create only one audio decoder.

[0214] In some embodiments, if the packet header parameters do not include a channel number, a receive thread may also be created. This receive thread can be used to receive the decoded audio data stream.

[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 merely illustrative examples of implementing the audio data transmission method provided in this application embodiment 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 imply a limitation on the internal implementation of the audio data transmission method provided in this application embodiment.

[0217] Figure 8 An audio data transmission method provided in this application embodiment can be applied to a first electronic device (the first electronic device is an electronic device used to send audio data packets among two interconnected electronic devices), and the method may 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 capability of the second electronic device.

[0219] In one possible implementation, when the service type of the data channel is speaker and the transmission type of the data channel is MagicLink, the first electronic device receives a data channel establishment message sent by the second electronic device.

[0220] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes an unpacking capability identifier. If the second electronic device does not have unpacking capability, the data channel establishment message does not include the unpacking capability identifier.

[0221] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes a first unpacking capability identifier. If 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 and the second unpacking capability identifier are different.

[0222] Step S502 can be found in the description of steps S201 to S208, and will not be repeated here.

[0223] S502, the first electronic device processes at least one audio data stream to be sent based on its packet-merging capability and data channel establishment message to obtain an audio data packet; wherein, if the second electronic device does not have the ability to unpack, the audio data packet is a single data packet; if the first electronic device has the ability to merge packets and the second electronic device has the ability to unpack, the audio data packet is a merged data packet.

[0224] In one possible implementation, when the first electronic device has the ability to combine packets and the second electronic device has the ability to unpack packets, the first electronic device performs packet combining processing on at least one audio data stream to be sent to obtain an audio data packet; wherein, the audio data packet includes a packet combining type identifier, which is used to identify the audio data packet as a packet combining data packet.

[0225] In one possible implementation, if the first electronic device lacks packet combining capability or the second electronic device lacks packet unpacking capability, the first electronic device performs single-packet processing on at least one audio data stream to be sent, obtaining at least one audio data packet. Each audio data packet includes a single-packet type identifier, which identifies each audio data packet as a single-packet data packet.

[0226] In one possible implementation, the single packet type is identified as the audio stream type of the audio data stream within the audio data packet.

[0227] In one possible implementation, before the first electronic device performs packet merging or single packet processing on at least one audio data stream to be sent, the method may further include: if the version information carried in the header of the audio data stream to be sent is a 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 based on the channel number; the first electronic device encodes the audio data stream to be sent for each channel number using each audio encoder 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 header of each single packet data packet in the at least one single packet data packet includes its corresponding audio stream type; and the first electronic device performs packet merging processing on the at least one single packet data packet to obtain a merged packet data packet.

[0228] In one possible implementation, before the first electronic device performs packet processing or single packet processing on at least one audio data stream to be sent, the method may further include: if the version information carried in the header of the audio data stream to be sent is a second version, the first electronic device invokes a static audio encoder; the first electronic device uses the static audio encoder to encode at least one audio data stream to be sent, obtaining at least one encoded audio data stream; the first electronic device performs single packet processing on at least one encoded audio data stream, obtaining at least one single packet data packet; wherein, the header of each single packet data packet in the at least one single packet data packet includes its corresponding audio stream type.

[0229] The details of step S502 can be found in the descriptions of steps S209 to S211a, S211b, and S301 to S306b, and will not be repeated here.

[0230] S503, the first electronic device sends an audio data packet to the second electronic device.

[0231] The details of step S503 can be found in the descriptions of steps S212a, S213a, S212b, and S213b, and will not be repeated here.

[0232] Figure 9 An audio data transmission method provided in this application embodiment can be applied to a second electronic device (the second electronic device is an electronic device used to receive audio data packets among two interconnected electronic devices), and the 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 capability of the second electronic device.

[0234] In one possible implementation, when the service type of the data channel is speaker and the transmission type of the data channel is MagicLink, the second electronic device sends a data channel establishment message to the first electronic device.

[0235] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes an unpacking capability identifier; if the second electronic device does not have unpacking capability, the data channel establishment message does not include an unpacking capability identifier.

[0236] In one possible implementation, if the second electronic device has unpacking capability, the data channel establishment message includes a first unpacking capability identifier; if 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 and the second unpacking capability identifier are different.

[0237] The details of step S601 can be found in the descriptions of steps S201 to S208, and will not be repeated 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 possible implementation, if the audio data packet includes a packet type identifier, the second electronic device unpacks the audio data to obtain at least one audio data stream to be played.

[0241] In one possible implementation, 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] Step S603 can be found in the descriptions of steps S214a, S214b, and S401 to S403, and will not be repeated here.

[0243] The various method embodiments described herein can be independent solutions or combinations based on internal logic, and all such solutions fall within the protection scope of this application.

[0244] It is understood that the methods and operations implemented by electronic devices in the above-described method embodiments can also be implemented by components (such as chips or circuits) that can be used in electronic devices.

[0245] The above embodiments describe the audio data transmission method provided in this application. It is understood that, in order to achieve the above functions, the electronic device includes corresponding hardware structures and / or software modules for executing each function. Those skilled in the art should readily recognize that, based on the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein, this application can be implemented in hardware or a combination of hardware and computer software. Whether a function is executed in hardware or by computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0246] This application also provides a processing apparatus, which includes at least one processor and a communication interface. The communication interface is used to provide information input and / or output to the at least one processor, which is used to execute the methods described in the above method embodiments.

[0247] It should be understood that the aforementioned processing device can be a chip. For example, see Figure 10 , Figure 10 This is a structural block diagram of a chip provided in an embodiment of this application. Figure 10 The chip shown can be a general-purpose processor or a special-purpose processor. The chip 700 may include at least one processor 701. The at least one processor 701 can be used to support execution... Figures 1 to 9 The technical solution shown in any one of the embodiments.

[0248] Optionally, the chip 700 may also include a transceiver 702, which is used to receive control from the processor 701 to support execution. Figures 1 to 9 The technical solution shown in any of the embodiments. Optionally, Figure 10 The chip 700 shown may also include a storage medium 703. Specifically, the transceiver 702 may be replaced by a communication interface that provides information input and / or output to 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 processors (CPUs), network processors (NPs), digital signal processors (DSPs), microcontrollers (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 implementation, each step of the above method can be completed by integrated logic circuits in the processor's hardware or by instructions in software. The steps of the method disclosed in the embodiments of this application can be directly implemented by a hardware processor, or by a combination of hardware and software modules in the processor. The software modules can reside in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads information from the memory and, in conjunction with its hardware, completes the steps of the above method. To avoid repetition, detailed descriptions are omitted here.

[0251] It should be noted that the processor in the embodiments of this application can be an integrated circuit chip with signal processing capabilities. During implementation, each step of the above method embodiments can be completed by the integrated logic circuitry in the processor's hardware or by instructions in software form. The 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, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this application. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this application can be directly embodied as being executed by a hardware decoding processor, or executed by a combination of hardware and software modules in the decoding processor. The software modules can be located in random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, registers, or other mature storage media in the art. This storage medium is located in memory, and the processor reads the information in the memory and, in conjunction with its hardware, completes the steps of the above methods.

[0252] It is understood that the memory in the embodiments of this application can be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. The non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. The volatile memory can be 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), synchronous linked dynamic random access memory (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory used in the systems and methods described herein is intended to include, but is not limited to, these and any other suitable types of memory.

[0253] According to the method provided in the embodiments of this application, the embodiments of this application also provide a computer program product, which includes: a computer program or instructions, which, when run on a computer, cause the computer to perform the method of any one of the embodiments of the method embodiments.

[0254] According to the method provided in the embodiments of this application, the embodiments of this application also provide a computer storage medium storing a computer program or instructions, which, when run on a computer, causes the computer to perform the method of any one of the embodiments of the method.

[0255] According to the method provided in the embodiments of this application, the embodiments of this 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, the computer program code including computer instructions, and when the processor executes the computer instructions, the electronic device performs the method of any one of the embodiments of the method embodiments.

[0256] Those skilled in the art will recognize that the various illustrative logical blocks and steps described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this application.

[0257] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0258] The computer storage medium, computer program product, and electronic device provided in the embodiments of this application are all used to execute the methods provided above. Therefore, the beneficial effects they can achieve can be referred to the beneficial effects corresponding to the methods provided above, and will not be repeated here.

[0259] It should be understood that in the various embodiments of this application, the execution order of each step should be determined by its function and internal logic, and the size of each step number does not mean the order of execution, and does not constitute a limitation on the implementation process of the embodiments.

[0260] The various parts of this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referred to interchangeably. Each embodiment focuses on the differences from other embodiments. In particular, the embodiments for devices, computer storage media, computer program products, and electronic devices are basically similar to the method embodiments, so the descriptions are relatively simple; relevant details can be found in the descriptions within the method embodiments.

[0261] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.

[0262] The embodiments described above do not constitute a limitation on the scope of protection of this application.

Claims

1. An audio data transmission method, characterized by, Applied to a first electronic device, the method comprises: 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 capability of the second electronic device; The first electronic device processes at least one audio data stream to be sent according to the packing capability of the first electronic device and the data channel establishment message, to obtain an audio data packet of an audio data transmission version adapted to the second electronic device; wherein, in the case that the second electronic device does not have unpacking capability, the audio data packet is a single-packet data packet; in the case that the first electronic device has packing capability and the second electronic device has unpacking capability, the audio data packet is a packed data packet; The first electronic device sends the audio data packet to the second electronic device.

2. The method of claim 1, wherein, The first electronic device processes at least one audio data stream to be sent according to the packing capability of the first electronic device and the data channel establishment message, to obtain an audio data packet, comprising: In the case that the first electronic device has packing capability and the second electronic device has unpacking capability, the first electronic device performs packing processing on the at least one audio data stream to be sent, to obtain the audio data packet; wherein, the audio data packet comprises a packed type identifier, and the packed type identifier is used to identify that the audio data packet is a packed data packet.

3. The method of claim 1, wherein, The first electronic device processes at least one audio data stream to be sent according to the packing capability of the first electronic device and the data channel establishment message, to obtain an audio data packet, comprising: In the case that the first electronic device does not have packing capability or the second electronic device does not have unpacking capability, the first electronic device performs single-packet processing on the at least one audio data stream to be sent, to obtain at least one audio data packet; wherein, each audio data packet in the at least one audio data packet comprises a single-packet type identifier, and the single-packet type identifier is used to identify that each audio data packet is a single-packet data packet.

4. The method of claim 3, wherein, The single-packet type identifier is an audio stream type of an audio data stream in the audio data packet.

5. The method of claim 1, wherein, In the case that the second electronic device has unpacking capability, the data channel establishment message comprises an unpacking capability identifier; in the case that the second electronic device does not have unpacking capability, the data channel establishment message does not comprise the unpacking capability identifier.

6. The method of claim 1, wherein, In the case that the second electronic device has unpacking capability, the data channel establishment message comprises a first unpacking capability identifier; in the case that the second electronic device does not have unpacking capability, the data channel establishment message comprises a second unpacking capability identifier; the first unpacking capability identifier is different from the second unpacking capability identifier.

7. The method according to any one of claims 1 to 6, characterized in that, The first electronic device receives the data channel establishment message sent by the second electronic device when establishing an audio data channel, comprising: In a case where 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 a data channel establishment message sent by the second electronic device.

8. The method of claim 2, wherein, The packet header of each of the at least one to-be-sent audio data stream carries version information, and in a case where the version information is a first version, the packet header of the to-be-sent audio data stream carries a channel number. The first electronic device performs packet combining processing on the at least one to-be-sent audio data stream to obtain the audio data packet, including: In a case where the version information carried in the packet header of the to-be-sent audio data stream is the first version, the first electronic device generates an audio stream type corresponding to each to-be-sent audio data stream. The first electronic device creates an audio encoder corresponding to each channel number according to the channel number. The first electronic device encodes each to-be-sent audio data stream of each channel number by using each audio encoder 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, and the packet header of each single-packet data packet in the at least one single-packet data packet includes a corresponding audio stream type. The first electronic device performs packet combining processing on the at least one single-packet data packet to obtain a packet-combined data packet.

9. The method of claim 3, wherein, The packet header of each of the at least one to-be-sent audio data stream carries version information, and in a case where the version information is a second version, the packet header of the to-be-sent audio data stream carries an audio stream type. The first electronic device performs single-packet processing on the at least one to-be-sent audio data to obtain at least one audio data packet, including: In a case where the version information carried in the packet header of the to-be-sent audio data stream is the second version, the first electronic device invokes a static audio encoder. The first electronic device encodes the at least one to-be-sent audio data by using the static audio encoder 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, and the packet header of each single-packet data packet in the at least one single-packet data packet includes a corresponding audio stream type.

10. An audio data transmission method, characterized by, The method applied to a second electronic device includes: When establishing an audio data channel, the second electronic device sends a data channel establishment message to a first electronic device, and the data channel establishment message is used to indicate the packet disassembling capability of the second electronic device. The second electronic device receives an audio data packet sent by the first electronic device, and the audio data packet is adapted to an audio data transmission version of the second 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 to-be-played audio data stream.

11. The method of 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 to-be-played audio data stream, including: In a case where the audio data packet comprises a combined packet type identifier, the second electronic device unpacks the audio data to obtain at least one audio data stream to be played.

12. The method of claim 10, wherein, The second electronic device processes the audio data packet according to a data packet type of the audio data packet to obtain at least one audio data stream to be played, including: In a case where the audio data packet comprises a single packet type identifier, the second electronic device performs single packet receiving processing on the audio data to obtain an audio data stream to be played.

13. The method of claim 10, wherein, In a case where the second electronic device has unpacking capability, the data channel establishment message comprises an unpacking capability identifier; in a case where the second electronic device does not have unpacking capability, the data channel establishment message does not comprise the unpacking capability identifier.

14. The method of claim 10, wherein, In a case where the second electronic device has unpacking capability, the data channel establishment message comprises a first unpacking capability identifier; in a case where the second electronic device does not have unpacking capability, the data channel establishment message comprises a second unpacking capability identifier; the first unpacking capability identifier is different from the second unpacking capability identifier.

15. The method according to any one of claims 10 to 14, characterized in that, In establishing an audio data channel, the second electronic device sends a data channel establishment message to the first electronic device, including: In a case where a service type of the data channel is a loudspeaker and a transmission type of the data channel is a Magic Link, the second electronic device sends a data channel establishment message to the first electronic device.

16. An electronic device, comprising: The electronic device comprises a memory and a processor; the memory and the processor are coupled; the memory is configured to store computer program code, the computer program code comprises computer instructions, when the processor executes the computer instructions, the electronic device executes the method in any one of claims 1-15.

17. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer programs or instructions, when the computer programs or instructions run on the computer, the computer executes the method in any one of claims 1-15.

Citation Information

Patent Citations

  • Media file transmission method and device

    CN115426338A