Audio playing system and method and electronic device

By setting a unique cache address in the distributed audio playback system and adopting a fast path and timing synchronization mechanism, the delay problem caused by multiple caches is solved, the audio and video synchronization and echo cancellation effects are improved, and the user experience is improved.

WO2024174782A1PCT designated stage expired Publication Date: 2024-08-29HUAWEI TECH CO LTD
View PDF 6 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2024/073205
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-02-22
Filing Date
2024-01-19
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

There are multiple data caches in the distributed audio playback system that cause delays, affect audio and video synchronization and echo cancellation, and reduce user experience.

Method used

By setting a unique cache address in the audio playback system, redundant caches are reduced, and a fast path and timing-based inter-core synchronization mechanism are used to directly transmit data from the application or audio framework to the audio DSP, reducing memory copy and transmission delays.

Benefits of technology

Effectively reduce distributed audio playback delay, improve audio and video synchronization and echo cancellation characteristics, and improve user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2024073205_29082024_PF_FP_ABST
    Figure CN2024073205_29082024_PF_FP_ABST
Patent Text Reader

Abstract

Provided in the embodiments of the present invention are technical solutions of an audio playing system and method and an electronic device. The method comprises: in response to a playing operation of a user on a first audio in a first application, a first electronic device generating a first playing request by means of the first application, the first playing request carrying first audio data of the first audio and a device identifier of a second electronic device; according to the first playing request, by means of calling a first audio framework, writing the first audio data into a unique cache address; after reading the first audio data from the unique cache address, sending same to the second electronic device, the unique cache address being a unique cache address for the first audio data during transmission from the first application to the second electronic device; and by means of a second rapid path and an inter-core synchronization mechanism, the second electronic device outputting the first audio data to a second output device of the second electronic device, so as to play the first audio. The present invention can reduce the latency of distributed audio playback, so as to improve the characteristics such as audio-visual synchronization and echo cancellation, thereby improving user experience.
Need to check novelty before this filing date? Find Prior Art

Description

Audio playback system, method and electronic device

[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office on February 22, 2023, with application number 202310197537.0 and application name “An Audio Playback System, Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present invention relates to the field of computer technology, and in particular to an audio playback system, method and electronic equipment. Background Art

[0003] Audio playback systems have multiple data buffers, especially in distributed audio playback scenarios. Although the size of a single audio frame is relatively small, multiple buffers introduce latency, impacting features like audio / video synchronization, echo cancellation, and user experience.

[0004] Summary of the Invention

[0005] In view of this, embodiments of the present invention provide an audio playback system, method, and electronic device that can reduce the latency of distributed audio playback, thereby improving features such as audio-visual synchronization and echo cancellation, and enhancing user experience.

[0006] In a first aspect, an embodiment of the present invention provides an audio playback system, the system comprising:

[0007] A first electronic device is configured to, in response to a user's operation of playing a first audio in a first application, generate a first play request through the first application, the first play request carrying first audio data of the first audio and a device identifier of a second electronic device; write the first audio data to a unique cache address by calling a first audio framework according to the first play request; read the first audio data from the unique cache address, and send the first audio data to the second electronic device; wherein the unique cache address is an address of a unique cache during the process of transmitting the first audio data from the first application to the second electronic device;

[0008] The second electronic device is configured to output the first audio data to a second output device of the second electronic device via a second fast path and an inter-core synchronization mechanism, thereby playing the first audio. In an embodiment of the present invention, the first electronic device sets a unique cache address in the first electronic device for caching the first audio data. Therefore, during transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device, reducing redundant caching and lowering the latency of distributed audio playback, thereby improving features such as audio-visual synchronization and echo cancellation, and enhancing the user experience.

[0009] In combination with the first aspect, in certain implementations of the first aspect, the first electronic device is further configured to generate a second playback request in response to a user's playback operation on the second audio in the first application, the second playback request carrying the second audio data of the second audio and the device identifier of the first electronic device; the second audio data is output to the first output device of the first electronic device through the first fast path and the inter-core synchronization mechanism to play the second audio. In an embodiment of the present invention, the first fast path is created by the first local hardware abstraction layer of the first electronic device; the embodiment of the present invention, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing memory copies therein, thereby providing a direct fast channel from the application or audio framework to the underlying audio DSP, reducing memory copies therein, and reducing the playback delay of local audio and distributed audio.

[0010] In conjunction with the first aspect, in certain implementations of the first aspect, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. In the fast path, the local HAL layer and the DSP use the same memory queue, i.e., a producer-consumer model. Therefore, synchronization between the two cores is necessary. Using a timing-based synchronization mechanism is simpler and more efficient.

[0011] In conjunction with the first aspect, in certain implementations of the first aspect, the unique cache address is located in a first audio framework or a first distributed hardware abstraction layer of the first electronic device. In this embodiment of the present invention, the unique cache address may be provided by the audio framework or the distributed hardware abstraction layer.

[0012] In combination with the first aspect, in some implementations of the first aspect, the first application includes an audio application.

[0013] In a second aspect, an embodiment of the present invention provides an audio playback method, applied to a first electronic device, the method comprising:

[0014] In response to a user's operation of playing a first audio in a first application, generating a first play request through the first application, where the first play request carries first audio data of the first audio and a device identifier of a second electronic device;

[0015] Writing the first audio data into a unique cache address by calling a first audio framework according to the first play request;

[0016] reading the first audio data from the unique buffer address, and sending the first audio data to the second electronic device, so that the second electronic device plays the first audio;

[0017] The unique cache address is the unique cache address of the first audio data during transmission from the first application to the second electronic device. In an embodiment of the present invention, the first electronic device sets a unique cache address for caching the first audio data in the first electronic device. Therefore, during transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device, reducing redundant caching and lowering the latency of distributed audio playback, thereby improving features such as audio-visual synchronization and echo cancellation, and enhancing the user experience.

[0018] In conjunction with the second aspect, in certain implementations of the first aspect, before sending the first audio data to the second electronic device, the method further includes:

[0019] Encoding the first audio data to obtain encoded first audio data;

[0020] The sending of the first audio data to the second electronic device includes:

[0021] The encoded first audio data is sent to the second electronic device.

[0022] In conjunction with the second aspect, in certain implementations of the first aspect, the method further includes:

[0023] In response to a user's operation of playing a second audio in the first application, generating a second play request, where the second play request carries second audio data of the second audio and a device identifier of the first electronic device;

[0024] The second audio data is output to the first output device of the first electronic device via a first fast path and an inter-core synchronization mechanism to play the second audio. In this embodiment of the present invention, the first fast path is created by the first local hardware abstraction layer of the first electronic device. Through vertical integration of software and hardware, this embodiment of the present invention allows the memory queue created by the local HAL to be directly shared with the audio DSP, reducing memory copies. This provides a direct, fast path from the application or audio framework to the underlying audio DSP, reducing memory copies and lowering the playback latency of local and distributed audio.

[0025] In combination with the second aspect, in some implementations of the first aspect, the first output device includes a speaker.

[0026] In conjunction with the second aspect, in certain implementations of the first aspect, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. In the fast path, the local HAL layer and the DSP use the same memory queue, i.e., a producer-consumer model. Therefore, synchronization between the two cores is necessary. Using a timing-based synchronization mechanism is simpler and more efficient.

[0027] In conjunction with the second aspect, in certain implementations of the first aspect, the unique cache address is located in a first audio framework or a first distributed hardware abstraction layer of the first electronic device. In this embodiment of the present invention, the unique cache address may be provided by the audio framework or the distributed hardware abstraction layer.

[0028] In combination with the second aspect, in certain implementations of the first aspect, the first application includes an audio application.

[0029] In a third aspect, an embodiment of the present invention provides an audio playback method, applied to a second electronic device, the method comprising:

[0030] receiving first audio data sent by a first electronic device;

[0031] The first audio data is output to the second output device of the second electronic device via a second fast path and inter-core synchronization mechanism to play the first audio. In this embodiment of the present invention, the second fast path is created by the second local hardware abstraction layer of the second electronic device. Through vertical integration of software and hardware, this embodiment of the present invention allows the memory queue created by the local HAL to be directly shared with the audio DSP, reducing memory copies. This provides a direct and fast path from the application or audio framework to the underlying audio DSP, reducing memory copies and lowering the playback latency of local and distributed audio.

[0032] In conjunction with the third aspect, in some implementations of the first aspect, receiving the audio data sent by the first electronic device includes:

[0033] receiving the encoded first audio data sent by the first electronic device;

[0034] The first audio data is obtained by decoding the encoded first audio data.

[0035] In conjunction with the third aspect, in certain implementations of the first aspect, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. In the fast path, the local HAL layer and the DSP use the same memory queue, i.e., a producer-consumer model. Therefore, synchronization between the two cores is necessary. Using a timing-based synchronization mechanism is simpler and more efficient.

[0036] In combination with the third aspect, in some implementations of the first aspect, the second output device includes a speaker.

[0037] In a fourth aspect, an embodiment of the present invention provides an electronic device comprising a processor and a memory, wherein the memory is used to store a computer program, and the computer program comprises program instructions, and when the processor runs the program instructions, the electronic device executes the steps of the method described above.

[0038] In a fifth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program request is run by a computer, the computer is caused to execute the method as described above.

[0039] In a sixth aspect, an embodiment of the present invention provides a computer program product, which includes instructions. When the computer program product is run on a computer or any at least one processor, the computer executes the functions / steps in the above method. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] FIG1 is a schematic structural diagram of an electronic device provided by an embodiment of the present invention;

[0041] FIG2 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention;

[0042] FIG3 is a schematic diagram of an audio playback process in a distributed audio playback scenario;

[0043] FIG4 is a schematic diagram of an audio playback system;

[0044] FIG5 is a schematic diagram of multiple audio data caches in a distributed audio playback scenario;

[0045] FIG6 is a schematic diagram of an audio playback system provided by an embodiment of the present invention;

[0046] FIG7 is a schematic diagram of the principle of a fast access device according to an embodiment of the present invention;

[0047] FIG8 is a timing diagram of a timing-based synchronization mechanism according to an embodiment of the present invention;

[0048] FIG9 is a schematic diagram of another audio playback system provided by an embodiment of the present invention;

[0049] FIG10 is a signaling interaction diagram of an audio playback method provided by an embodiment of the present invention;

[0050] FIG11 is a signaling interaction diagram of another audio playback method provided in an embodiment of the present invention;

[0051] FIG12 is a flowchart of an audio playback method provided by an embodiment of the present invention;

[0052] FIG13 is a specific flow chart of the first electronic device in FIG12 reading the first audio data from the unique cache address according to the first play request;

[0053] FIG14 is a specific flow chart of the first electronic device in FIG12 outputting the second audio data to the first output device of the first electronic device through the first fast path and the inter-core synchronization mechanism according to the second play request to play the second audio;

[0054] FIG15 is a schematic structural diagram of a first electronic device provided by an embodiment of the present invention;

[0055] FIG16 is a schematic structural diagram of a second electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0056] In order to better understand the technical solution of the present invention, the embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0057] It should be understood that the embodiments described are only a portion of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative work are within the scope of protection of the present invention.

[0058] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The singular forms "a", "an", "the" and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise.

[0059] It should be understood that the term "and / or" as used herein simply describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent: A alone, A and B together, or B alone. Furthermore, the character " / " in this document generally indicates an "or" relationship between the associated objects.

[0060] FIG1 shows a schematic structural diagram of an electronic device 100 .

[0061] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0062] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0063] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.

[0064] The controller can generate operation control signals according to the instruction operation code and timing signal to complete the control of instruction fetching and execution.

[0065] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.

[0066] In some embodiments, the processor 110 may include one or more interfaces. The 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.

[0067] The USB interface 130 is an interface that complies with USB standards and may be a Mini USB interface, a Micro USB interface, a USB Type-C interface, or the like. The USB interface 130 can be used to connect a charger to charge the electronic device 100, or to transfer data between the electronic device 100 and peripheral devices. It can also be used to connect headphones to play audio. This interface can also be used to connect other electronic devices, such as augmented reality devices.

[0068] It is understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is merely an illustrative illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.

[0069] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive 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 provide power to the electronic device via the power management module 141.

[0070] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and provides power to the processor 110, the internal memory 121, the display 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.

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

[0072] 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 a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In other embodiments, the antennas can be used in conjunction with a tuning switch.

[0073] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify, and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In some embodiments, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0074] The modem processor may include a modulator and a demodulator. The modulator is used to modulate the low-frequency baseband signal to be transmitted into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After being processed by the baseband processor, the low-frequency baseband signal is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to the speaker 170A, the receiver 170B, etc.) or displays an image or video through the display screen 194. In some embodiments, the modem processor may be an independent device. In other embodiments, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0075] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices that integrate at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0076] In some embodiments, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through 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 technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

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

[0078] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.

[0079] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.

[0080] The ISP processes data fed back by camera 193. For example, when taking a photo, 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, which is then passed to the ISP for processing and converted into a visible image. The ISP can also perform algorithmic optimization on image noise, brightness, and skin tone. It can also optimize parameters such as exposure and color temperature of the captured scene. In some embodiments, the ISP can be located within camera 193.

[0081] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. 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, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0082] The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

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

[0084] The NPU is a neural network (NN) computing processor. Drawing on the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it rapidly processes input information and can continuously self-learn. The NPU can enable intelligent cognitive applications in electronic device 100, such as image recognition, face recognition, speech recognition, and text comprehension.

[0085] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement data storage functions. For example, files such as music and videos can be stored on the external memory card.

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

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

[0088] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be provided in the processor 110, or some functional modules of the audio module 170 can be provided in the processor 110.

[0089] The speaker 170A, also called a "speaker", is used to convert audio electrical signals into sound signals. The electronic device 100 can listen to music or listen to hands-free calls through the speaker 170A.

[0090] The receiver 170B, also called a "handset", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or a voice message, the user can place the receiver 170B close to the ear to hear the voice.

[0091] Microphone 170C, also known as "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by putting their mouth close to the microphone 170C to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C. In other embodiments, the electronic device 100 can be provided with two microphones 170C, which can not only collect sound signals but also realize noise reduction function. In other embodiments, the electronic device 100 can also be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify the source of sound, realize directional recording function, etc.

[0092] The headphone jack 170D is used to connect a wired headphone and can be the USB interface 130 or a 3.5mm open mobile terminal platform (OMTP) standard interface or a cellular telecommunications industry association of the USA (CTIA) standard interface.

[0093] The buttons 190 include a power button, a volume button, and the like. The buttons 190 may be mechanical buttons or touch buttons. The electronic device 100 may receive key inputs and generate key signal inputs related to user settings and function control of the electronic device 100.

[0094] Motor 191 can generate vibration prompts. Motor 191 can be used for incoming call vibration prompts, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, audio playback, etc.) can correspond to different vibration feedback effects. For touch operations acting on different areas of the display screen 194, motor 191 can also correspond to different vibration feedback effects. Different application scenarios (for example: time reminders, receiving messages, alarm clocks, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.

[0095] The indicator 192 may be an indicator light, which may be used to indicate the charging status, power level changes, messages, missed calls, notifications, etc.

[0096] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to or disconnected from the electronic device 100 by inserting it into or removing it from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, and the like. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the multiple cards can be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 can also be compatible with external memory cards. The electronic device 100 interacts with the network through the SIM card to implement functions such as calls and data communications. 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.

[0097] The software system of the electronic device 100 can adopt a layered architecture, an event-driven architecture, a micro-kernel architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system with a layered architecture is used as an example to illustrate the software structure of the electronic device 100.

[0098] FIG2 is a block diagram of the software structure of the electronic device 100 according to an embodiment of the present invention.

[0099] A layered architecture divides software into several layers, each with distinct roles and responsibilities. Layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers: the application layer, the application framework layer, the Android runtime and system libraries, and the kernel layer.

[0100] The application layer can include a series of application packages.

[0101] As shown in FIG2 , the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and short message.

[0102] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.

[0103] As shown in FIG2 , the application framework layer may include a window manager, a content provider, a view system, a telephony manager, a resource manager, a notification manager, and the like.

[0104] The window manager is used to manage window programs. The window manager can obtain the display size, determine whether there is a status bar, lock the screen, take screenshots, etc.

[0105] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0106] The view system includes visual controls, such as those for displaying text and images. The view system is used to build applications. A display interface can consist of one or more views. For example, a display interface containing a text notification icon might include a view for displaying text and a view for displaying images.

[0107] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including answering, hanging up, etc.).

[0108] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0109] The Notification Manager allows applications to display notifications in the status bar. These messages can be displayed briefly and then disappear automatically without user interaction. For example, the Notification Manager is used to notify users of completed downloads and message reminders. The Notification Manager can also display notifications in the top status bar of the system as icons or scrolling text, such as notifications from background applications, or as dialog windows on the screen. Examples include text messages in the status bar, beeps, vibrations on electronic devices, and flashing indicator lights.

[0110] Android Runtime includes core libraries and a virtual machine. Android runtime is responsible for scheduling and management of the Android system.

[0111] The core library consists of two parts: one is the function that needs to be called by the Java language, and the other is the Android core library.

[0112] The application layer and application framework layer run in a virtual machine. The virtual machine executes Java files in the application layer and application framework layer as binary files. The virtual machine manages object lifecycles, stack management, thread management, security and exception management, and garbage collection.

[0113] The system library can include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0114] The surface manager is used to manage the display subsystem and provide fusion of 2D and 3D layers for multiple applications.

[0115] The media library supports playback and recording of a variety of common audio and video formats, as well as static image files. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

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

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

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

[0119] The following describes the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.

[0120] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into a raw input event (including touch coordinates, touch operation timestamp, and other information). The raw input event is stored in the kernel layer. The application framework layer obtains the raw input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is the control of the camera application icon, the camera application calls the interface of the application framework layer to start the camera application, and then starts the camera driver by calling the kernel layer to capture a still image or video through the camera 193.

[0121] Audio playback is a key function of current electronic device operating systems. Because the human ear is sensitive to sound, mainstream operating systems currently buffer several frames within the audio framework to minimize playback interruptions. Some operating systems primarily provide operating system (OS) capabilities for standalone devices and are not designed for distributed scenarios. Therefore, directly adapting these operating systems for distributed audio playback can result in high latency.

[0122] Figure 3 is a schematic diagram of the audio playback process in a distributed audio playback scenario. As shown in Figure 3, in a distributed audio playback scenario, audio needs to be transmitted from the audio application on the master end to the speakers on the slave end for playback. The entire transmission chain is relatively long, sequentially including the master end's audio application, audio framework, encoder, distributed audio, soft bus, and the slave end's decoder, distributed audio, audio framework, kernel / Direct Memory Access (DMA), and speakers. Furthermore, because the audio frameworks and distributed transmission processes of both devices have caches, as well as encoding delays and DMA transfer time, the overall latency of distributed audio playback is high, affecting user experience and features such as audio-visual synchronization and echo cancellation.

[0123] Figure 4 is a schematic diagram of an audio playback system. As shown in Figure 4, taking the music application of device A as an example, when the music application of device A applies for local playback, the audio data in device A is given by the music application to the audio framework (Audio Framework), and then the audio framework copies the audio data and passes the audio data to the local hardware abstraction layer (Local HAL) provided by the local audio. Then the local hardware abstraction layer passes the audio data to the kernel, audio digital signal processor (DSP), etc. for DMA playback.

[0124] As shown in Figure 4, taking the music application on device A as an example, when device A's music application requests playback on device B, device A is the master and device B is the slave. On device A, the music application provides audio data to the audio framework, which then copies the audio data and passes it to the distributed hardware abstraction layer (HAL) provided by distributed audio. The distributed hardware abstraction layer then copies the audio data to the distributed audio system capability (Stand Alone, SA). The distributed audio SA encodes the audio data and sends it to device B via the distributed soft bus. After receiving the audio data, device B decodes it and calls the audio framework to play the music. The audio framework then calls device B's local HAL and passes it to the kernel, audio DSP, and other devices for DMA playback.

[0125] Therefore, in the audio playback system shown in Figure 4, there are multiple data caches during the process of transmitting audio data from the application layer to the underlying audio DSP of the master or controlled end, especially in the distributed audio playback scenario. As shown in Figure 4, there are multiple frame caches in the master audio framework, distributed audio transmission, and controlled audio framework. These caches are unnecessary and redundant. Every time 1 frame is cached, it will bring a delay of 1 frame. If N frames are cached, the delay will be multiplied by N. Figure 5 is a schematic diagram of multiple audio data caches in the current distributed audio playback scenario. Usually, one frame of audio data is about 20ms. As shown in Figure 5, if caching 3 frames at each location brings a delay of 60ms, then the redundant cache will bring a delay of more than 100ms.

[0126] The audio playback system shown in Figure 4 also involves multiple layers of data copying. Music data is copied at each layer, from the music application to the audio framework, to the local HAL, to the kernel, and to the audio DSP. Although the size of a single frame of audio data is relatively small, frequent copying does introduce certain delays and operational complexity.

[0127] Based on the above technical problems, an embodiment of the present invention provides an audio playback system to reduce distributed audio playback delay, improve audio and video synchronization, echo cancellation and other characteristics, and enhance user experience.

[0128] Figure 6 is a schematic diagram of an audio playback system provided by an embodiment of the present invention. As shown in Figure 6, the audio playback system includes a first electronic device 200 and a second electronic device 300. The first electronic device 200 includes a first application 210, a first audio framework 220, a first local hardware abstraction layer 230, a first distributed hardware abstraction layer 240, a first audio digital signal processor 250, and a first distributed audio system capability 260. The first local hardware abstraction layer 230 includes a first path memory 231. The first distributed hardware abstraction layer 240 includes a unique cache device 241. The first distributed audio system capability 260 includes an encoder 261 and a first communication module 262. A first fast path exists between the first audio framework 220 and the first audio digital signal processor 250; the first path memory 231 is memory provided by the first local hardware abstraction layer 230 for the first fast path.

[0129] The second electronic device 300 includes a second audio framework 320, a second local hardware abstraction layer 330, a second audio digital signal processor 350, and a second distributed audio system capability 360. The second local hardware abstraction layer 330 includes a second path memory 331. The second distributed audio system capability 360 includes a decoder 361 and a second communication module 362. A second fast path exists between the second audio framework 320 and the second audio digital signal processor 350; the second path memory 331 is memory provided by the second local hardware abstraction layer 330 for the second fast path.

[0130] The first electronic device 200 and the second electronic device 300 are connected by wire or wirelessly.

[0131] The hardware structure and software structure of the first electronic device 200 and the second electronic device 300 provided in the embodiment of the present invention can refer to the relevant description of the electronic device 100 in Figures 1 and 2.

[0132] Compared to the audio playback system shown in FIG4 , the audio playback system provided in this embodiment of the present invention further includes a path memory and a unique cache device. Specifically, the first local hardware abstraction layer 230 of the first electronic device 200 further includes a first path memory 231 , and the first distributed hardware abstraction layer 240 further includes a unique cache device 241 ; the second local hardware abstraction layer 330 of the second electronic device 300 further includes a second path memory 331 .

[0133] Among them, the path memory is created by the local hardware abstraction layer of the electronic device, and the path memory can be directly shared with the application, audio framework, and audio DSP, thereby realizing a direct fast channel from the application or audio framework to the underlying audio DSP. Figure 7 is a schematic diagram of the principle of the fast path in an embodiment of the present invention. As shown in Figure 7, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing the memory copy therein. Specifically, taking the first electronic device 200 as an example, after the audio data of the first application 210 is processed by the first audio framework 220, it is directly written to the shared memory (i.e., the first path memory 231) created by the local HAL, and the bottom first audio digital signal processor 250 directly reads from the shared memory and sends DMA to play. Therefore, the embodiment of the present invention provides a direct fast channel from the application or audio framework to the underlying audio DSP, thereby reducing the memory copy therein and reducing the playback delay of local audio and distributed audio.

[0134] Furthermore, in the fast path, the local HAL layer and the DSP use the same memory queue, which is a producer-consumer model, so synchronization must be performed between the two cores.

[0135] Optionally, the inter-core synchronization mechanism includes a semaphore or other mechanism.

[0136] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. An embodiment of the present invention proposes a timing-based synchronization mechanism. FIG8 is a timing diagram of a timing-based synchronization mechanism in an embodiment of the present invention. As shown in FIG8 , taking a frame length of 5 ms as an example, the timing-based synchronization mechanism is introduced as follows:

[0137] In the first 5ms: the application writes the first frame Buffer1 to the memory queue, the audio DSP reads the first frame Buffer1 and executes the algorithm, but the audio DSP does not play the first frame Buffer1;

[0138] In the second 5ms: the audio DSP plays the first frame, Buffer1; at the same time, the application writes the second frame, Buffer2, to the memory queue, and the audio DSP reads the second frame, Buffer2, and executes the algorithm;

[0139] In the third 5ms: the audio DSP plays the second frame Buffer2; at the same time, the application writes the third frame Buffer3 to the memory queue, and the audio DSP reads the third frame Buffer3 and executes the algorithm. This repeated process achieves inter-core data synchronization, which is simpler and more efficient.

[0140] Among them, the embodiment of the present invention sets a unique cache device in the electronic device, and the unique cache device 241 includes a unique cache address, which is the address of the unique cache in the process of transmitting distributed audio data from the first application 210 to the second electronic device 300. Therefore, in the process of transmitting distributed audio data from the first application 210 to the second electronic device 300, the distributed audio data only needs to be cached once in the first electronic device 200. As shown in Figure 6, the unique cache device is created by the distributed HAL, and the address of the cache there is sent to the audio framework and the distributed audio SA respectively. The audio framework and the distributed audio SA negotiate to read and write, thereby realizing distributed audio data transmission; compared with the audio playback system shown in Figure 4 with multiple redundant caches, the embodiment of the present invention reduces redundant caches and saves transmission delays.

[0141] The audio playback system provided by the embodiment of the present invention is applicable to audio playback scenarios, such as local playback scenarios and distributed audio playback scenarios.

[0142] Taking the distributed audio playback scenario as an example, the audio playback system shown in Figure 6 is introduced as follows:

[0143] In response to a user's operation to play a first audio file in a first application 210, the first electronic device 200 generates a first play request through the first application 210, the first play request carrying the first audio data of the first audio file and the device identifier of the second electronic device; based on the first play request, the first electronic device 200 writes the first audio data to a unique cache address by calling the first audio framework 220; reads the first audio data from the unique cache address and sends the first audio data to the second electronic device 300. The second electronic device 300 outputs the first audio data to a second output device of the second electronic device 300 via a second fast path and inter-core synchronization mechanism to play the first audio file. The unique cache address is the address of the unique cache during the transmission of the first audio data from the first application 210 to the second electronic device 300.

[0144] In the embodiment of the present invention, the unique cache address is not used to cache audio data obtained by the first application 210 from the network, but is only used to cache first audio data transmitted from the first application 210 of the first electronic device 200 to the second electronic device 300.

[0145] The first application 210 is used to generate a first play request in response to the user's play operation on the first audio in the first application 210, and send the first play request to the first audio framework 220. The first play request carries the first audio data of the first audio and the device identifier of the second electronic device 300.

[0146] In some possible embodiments, the first application 210 is configured to generate a first play request in response to a user selecting the second electronic device 300 to play the first audio in the first application 210 , and send the first play request to the first audio framework 220 .

[0147] Exemplarily, the first application 210 includes an audio application, that is, an application capable of playing audio, such as a music application, a game application, or an instant messaging application.

[0148] The first audio framework 220 is used to obtain a unique cache address according to the first play request; and write the first audio data into the unique cache address according to the unique cache address.

[0149] In some possible embodiments, the first audio framework 220 is specifically used to determine, based on the first playback request, whether the device identifier in the first playback request is the device identifier of the first electronic device 200; if it is determined that the device identifier in the first playback request is not the device identifier of the first electronic device 200, then the first playback request is a distributed playback request, and a unique cache address of the unique cache device 241 is obtained from the first distributed hardware abstraction layer 240; according to the unique cache address, the first audio data is written into the unique cache device 241 of the first distributed hardware abstraction layer 240.

[0150] In some possible embodiments, the first audio framework 220 is also used to send a read command to the encoder 261 of the first distributed audio system capability 260 after writing the first audio data into the unique cache address, and the read command is used to enable the encoder 261 to read the first audio data from the unique cache address of the unique cache device 241.

[0151] The first distributed audio system capability 260 is used to read the first audio data from the unique cache address of the unique cache device 241, encode the first audio data, and send the encoded first audio data to the second distributed audio system capability 360 of the second electronic device 300.

[0152] In some possible embodiments, the first distributed audio system capability 260 is specifically configured to read the first audio data from the unique cache address of the unique cache device 241 according to the read command, encode the first audio data, and send the encoded first audio data to the

[0153] The second distributed audio system capability 360 of the second electronic device 300 .

[0154] Specifically, the encoder 261 is used to read the first audio data from the unique cache address of the unique cache device 241, encode the first audio data, and send the encoded first audio data to the first communication module 262; the first communication module 262 is used to send the encoded first audio data to the second distributed audio system capability 360 of the second electronic device 300.

[0155] The second distributed audio system capability 360 is used to receive the encoded first audio data; decode the encoded first audio data to obtain the first audio data; and send the first audio data to the second audio framework 320 .

[0156] Specifically, the second communication module 362 is configured to receive the encoded first audio data and send the encoded first audio data to the decoder 361. The decoder 361 is configured to decode the encoded first audio data to obtain the first audio data and send the first audio data to the second audio framework 320. In some possible embodiments, the second distributed audio system capability 360 also includes a proxy client. The decoder 361 sends the first audio data to the proxy client, which then sends the first audio data to the second audio framework 320.

[0157] The second audio framework 320 is used to output the first audio data to the second output device of the second electronic device 300 through the second fast path and inter-core synchronization mechanism to play the first audio.

[0158] In some possible embodiments, the second audio framework 320 is configured to write the first audio data to the second path memory 331 of the second local hardware abstraction layer 330 via the second fast path. The second audio digital signal processor 350 is configured to read the first audio data from the second path memory 331 via an inter-core synchronization mechanism and output the first audio data to a second output device of the second electronic device 300 to play the first audio. Exemplarily, the second output device of the second electronic device 300 includes a speaker.

[0159] Optionally, the inter-core synchronization mechanism includes a semaphore or other mechanism.

[0160] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism.

[0161] For example, when a user uses the Changlian application in a mobile phone to make a video call, the volume of the mobile phone is limited and cannot meet the requirement of a higher volume, so the user broadcasts the audio in the Changlian application to the speaker; the original data path used by the audio playback system shown in Figure 4 has a certain delay, which usually causes the video picture in the mobile phone and the sound played by the speaker to be out of sync, so it is necessary to reduce the audio playback delay to solve the problem of audio and picture out of sync; the audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the audio and picture synchronization characteristics and enhancing the user experience.

[0162] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of a mobile phone to collect sound and uses the speaker of a large-screen device to play the sound. Since the original data path used by the audio playback system shown in Figure 4 has a certain delay, echo usually occurs. Therefore, it is necessary to reduce the audio playback delay to eliminate the echo. The audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the echo cancellation characteristics and enhancing the user experience.

[0163] In the distributed audio playback scenario, on the one hand, the original data path has multiple redundant caches in the local audio framework, distributed audio transmission, and remote audio framework, which brings unnecessary delays; the embodiment of the present invention replaces the multiple caches of the master end part in the original data path with a unique cache device, reducing the multiple redundant caches on the original data path, while ensuring that the audio is not stuck and reducing the transmission delay. On the other hand, in the original data path, when the controlled end calls the audio framework for playback, the data is sent for playback by continuous copying; in the embodiment of the present invention, the controlled end directly uses a fast path, calls the audio framework to write the data into the memory provided by the local HAL, and the underlying DSP directly reads and plays it. By applying the fast reading path to the underlying DSP, the copying of each layer of data during the local playback process is reduced, reducing the delay. On the other hand, the inter-core synchronization mechanism of the fast path in the embodiment of the present invention adopts a timing-based data synchronization mechanism, which is simpler and more efficient. Furthermore, the embodiment of the present invention improves the characteristics such as audio and video synchronization and echo cancellation by reducing the audio playback delay, thereby improving the user experience.

[0164] Taking the local playback scenario as an example, the audio playback system shown in Figure 6 is introduced as follows:

[0165] The first electronic device 200 is used to generate a second playback request in response to the user's playback operation of the second audio in the first application 210, where the second playback request carries the second audio data of the second audio and the device identification of the first electronic device 200; according to the second playback request, the second audio data is output to the first output device of the first electronic device 200 through the first fast path and inter-core synchronization mechanism to play the second audio.

[0166] The first application 210 is configured to generate a second play request in response to a user's play operation on the second audio in the first application 210, and send the second play request to the first audio framework 220. The second play request carries the second audio data of the second audio and the device identification of the first electronic device 200.

[0167] In some possible embodiments, the first application 210 is configured to generate a second play request in response to a user selecting the second electronic device 300 to play the second audio in the first application 210 , and send the second play request to the first audio framework 220 .

[0168] Exemplarily, the first application 210 includes an audio application, that is, an application capable of playing audio, such as a music application, a game application, or an instant messaging application.

[0169] The first audio framework 220 is used to output the second audio data to the first output device of the first electronic device 200 through the first fast path and inter-core synchronization mechanism according to the second play request to play the second audio.

[0170] In some possible embodiments, the first audio framework 220 is configured to write the second audio data to the first path memory 231 of the first local hardware abstraction layer 230 via the first fast path according to the second play request. The first audio digital signal processor 250 is configured to read the second audio data from the first path memory 231 using a timing-based synchronization mechanism and output the second audio data to the first output device of the first electronic device 200 to play the second audio. Exemplarily, the first output device of the first electronic device 200 includes a speaker.

[0171] In local playback scenarios, on the one hand, in the existing data path, when an electronic device calls the audio framework for playback, it continuously copies data for playback. However, in this embodiment of the present invention, a fast path is directly adopted. The audio framework writes data to the memory provided by the local HAL, and the underlying DSP directly reads and plays it. By applying a fast read path to the underlying DSP, data copying at each layer during local playback is reduced, thus reducing latency. Furthermore, the inter-core synchronization mechanism of the fast path in this embodiment of the present invention uses a time-series-based data synchronization mechanism, which is simpler and more efficient.

[0172] In the embodiment of the present invention, the playing of the first audio and the playing of the second audio may occur simultaneously or independently.

[0173] Furthermore, an embodiment of the present invention provides another audio playback system. FIG9 is a schematic diagram of another audio playback system provided by an embodiment of the present invention. As shown in FIG9 , compared with the audio playback system shown in FIG6 , the audio playback system shown in FIG9 has the following differences:

[0174] Difference 1: The unique cache device is created by the audio framework, not by the distributed hardware abstraction layer. As shown in FIG9 , the first audio framework 220 further includes a unique cache device 221 , while the first distributed hardware abstraction layer 240 does not include a unique cache device.

[0175] Difference 2: In the distributed audio playback scenario, the first audio framework 220 is used to obtain a unique cache address from the unique cache device 221 based on the first playback request and write the first audio data into the unique cache device 221 based on the unique cache address. In some possible embodiments, after writing the first audio data into the unique cache device 221, the first audio framework 220 is further used to send a read command to the first distributed hardware abstraction layer 240. The first distributed hardware abstraction layer 240 is used to read the first audio data from the unique cache device 221 based on the read command and send the first audio data to the encoder 261 of the first distributed audio system capability 260.

[0176] Except for the above two differences, the rest are the same as the audio playback system shown in FIG6 . For details, please refer to the embodiment of the audio playback system shown in FIG6 , which will not be described again here.

[0177] Based on the audio playback system shown in Figures 6-9, an embodiment of the present invention provides an audio playback method. Figure 10 is a signaling interaction diagram of an audio playback method provided by an embodiment of the present invention. As shown in Figure 10, the method includes:

[0178] Step 402: The first application generates a first play request in response to a user's play operation on the first audio in the first application.

[0179] In this step, as shown in Figures 6 and 9 , the first application generates a first play request in response to the user's play operation on the first audio in the first application. The first play request carries the first audio data of the first audio and the device identification of the second electronic device.

[0180] In some possible embodiments, step 402 specifically includes: the first application generates a first play request in response to a user selecting, in the first application, a second electronic device to play the first audio.

[0181] Exemplarily, the first application includes an audio application, that is, an application capable of playing audio, such as a music application, a game application, or an instant messaging application.

[0182] Step 404: The first application sends a first play request to the first audio framework.

[0183] Step 406: The first audio framework obtains a unique cache address according to the first play request.

[0184] In this step, as shown in FIG6 and FIG9 , the first audio framework obtains a unique cache address according to the first play request.

[0185] In some possible embodiments, step 406 specifically includes:

[0186] Step 406a: The first audio framework determines, based on the first play request, whether the device identifier in the first play request is the device identifier of the first electronic device.

[0187] In this step, after receiving the first play request, the first audio framework determines whether the first play request is a local play request or a distributed play request based on the device identifier in the first play request. Specifically, if the device identifier in the first play request is the device identifier of the first electronic device, the first play request is a local play request; if the device identifier in the first play request is not the device identifier of the first electronic device, the first play request is a distributed play request.

[0188] Step 406b: The first audio framework determines that the device identifier in the first play request is not the device identifier of the first electronic device, and obtains a unique cache address of a unique cache device.

[0189] Since the first play request carries the device identification of the second electronic device, the first audio framework determines that the device identification in the first play request is not the device identification of the first electronic device, then the first play request is a distributed play request, and the first audio data is distributed audio data.

[0190] The unique cache device is a device in the first electronic device that provides a unique cache address during the transmission of distributed audio data from the first application to the second electronic device. The unique cache address is the address of the unique cache used during the transmission of the first audio data from the first application to the second electronic device. Therefore, during the transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device. Compared to the audio playback system shown in Figure 4, which has multiple redundant caches, this embodiment of the present invention reduces redundant caches and saves transmission latency.

[0191] In the embodiment of the present invention, the unique cache address is not used to cache audio data obtained by the first application from the network, but is only used to cache first audio data transmitted from the first application of the first electronic device to the second electronic device.

[0192] As shown in Figure 6, the distributed HAL is responsible for creating a unique cache device and sending the cache address there to the audio framework and the distributed audio SA. The audio framework and the distributed audio SA negotiate to read and write data, thus implementing distributed audio data transmission. Therefore, the unique cache device is located in the first distributed hardware abstraction layer, and the first audio framework obtains the unique cache address from the first distributed hardware abstraction layer.

[0193] As shown in Figure 9, the audio framework is responsible for creating a unique cache device and sending the cache address there to the distributed HAL. The audio framework and the distributed HAL negotiate read and write operations, implementing distributed audio data transmission. The unique cache device is located in the first audio framework, and the first audio framework obtains the unique cache address from the unique cache device.

[0194] Step 408: The first audio framework writes the first audio data into the unique cache address.

[0195] As shown in FIG6 , step 408 specifically includes: the first audio framework writes the first audio data into the only cache device of the first distributed hardware abstraction layer according to the only cache address.

[0196] In some possible embodiments, after writing the first audio data into the unique cache address, the first audio framework sends a read command to the encoder of the first distributed audio system capability, where the read command is used to enable the first distributed audio system capability to read the first audio data from the unique cache address.

[0197] As shown in FIG. 9 , step 408 specifically includes: the first audio framework writes the first audio data into the unique cache device according to the unique cache address.

[0198] In some possible embodiments, after writing the first audio data into the unique cache address, the first audio framework sends a read command to the first distributed hardware abstraction layer, where the read command is used to enable the first distributed hardware abstraction layer to read the first audio data from the unique cache address.

[0199] Step 410: The first distributed audio system capability reads first audio data from a unique buffer address.

[0200] As shown in FIG6 , the first distributed audio system is capable of reading the first audio data from a unique buffer address in a unique buffer device.

[0201] In some possible embodiments, the encoder reads the first audio data from a unique buffer device according to a read command.

[0202] As shown in Figure 9, the first distributed audio system capability reads the first audio data from the unique cache address in the unique cache device through the first distributed hardware abstraction layer. Specifically, after reading the first audio data from the unique cache address in the unique cache device, the first distributed hardware abstraction layer sends the first audio data to the encoder of the first distributed audio system capability.

[0203] In some possible embodiments, the first distributed hardware abstraction layer reads the first audio data from a unique cache address in a unique cache device according to a read command, and then sends the first audio data to the encoder.

[0204] Step 412: The first distributed audio system capability sends the first audio data to the second distributed audio system capability.

[0205] As shown in FIG6 and FIG9 , the first distributed audio system capability includes an encoder and a first communication module, and the second distributed audio system capability includes a second communication module and a decoder.

[0206] In some possible embodiments, step 412 specifically includes:

[0207] Step 412a: The encoder encodes the first audio data to obtain encoded first audio data.

[0208] In this step, as shown in FIG6 and FIG9 , the encoder encodes the first audio data to obtain encoded first audio data.

[0209] Step 412b: The encoder sends the encoded first audio data to the first communication module.

[0210] In this step, as shown in FIG6 and FIG9 , the encoder sends the encoded first audio data to the first communication module.

[0211] Step 412c: The first communication module sends the encoded first audio data to the second communication module.

[0212] In this step, as shown in FIG6 and FIG9 , the first communication module sends the encoded first audio data to the second communication module of the second distributed audio system capability of the second electronic device.

[0213] The first electronic device and the second electronic device are connected by wire or wirelessly, and data transmission is achieved between the first electronic device and the second electronic device via the first communication module and the second communication module.

[0214] Step 412d: The second communication module sends the encoded first audio data to the decoder.

[0215] In this step, as shown in FIG6 and FIG9 , the second communication module sends the encoded first audio data to the decoder.

[0216] Step 412e: The decoder decodes the encoded first audio data to obtain the first audio data.

[0217] In this step, as shown in FIG6 and FIG9 , the decoder decodes the encoded first audio data to obtain the first audio data.

[0218] Step 414: The second distributed audio system capability sends the first audio data to the second audio framework.

[0219] In some possible embodiments, step 414 specifically includes: the decoder sends the first audio data to the second audio framework.

[0220] In this step, as shown in FIG6 and FIG9, the decoder sends the first audio data to the second audio frame.

[0221] In some possible embodiments, the second distributed audio system capability further includes a proxy client, the decoder sends the first audio data to the proxy client, and the proxy client then sends the first audio data to the second audio framework.

[0222] Step 416: The second audio framework outputs the first audio data to the second output device of the second electronic device through the second fast path and inter-core synchronization mechanism.

[0223] In some possible embodiments, step 416 specifically includes:

[0224] Step 416a: The second audio framework writes the first audio data into the second path memory of the second local hardware abstraction layer through the second fast path.

[0225] In this step, as shown in FIG6 and FIG9 , the second audio framework writes the first audio data into the second path memory of the second local hardware abstraction layer through the second fast path.

[0226] The second-path memory is created by the second local hardware abstraction layer of the second electronic device. The second-path memory can be directly shared with the application, the second audio framework, and the second audio DSP, thereby realizing a direct and fast channel from the application or audio framework to the underlying audio DSP. Figure 7 is a schematic diagram of the principle of the fast channel in an embodiment of the present invention. As shown in Figure 7, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing memory copies. Therefore, the embodiment of the present invention provides a direct and fast channel from the application or audio framework to the underlying audio DSP, thereby reducing memory copies and lowering the playback delay of local audio and distributed audio.

[0227] Step 416b: The second audio digital signal processor reads the first audio data from the second path memory through the inter-core synchronization mechanism.

[0228] In this step, as shown in FIG6 and FIG9 , the second audio digital signal processor reads the first audio data from the second path memory through the inter-core synchronization mechanism.

[0229] In the fast path, the local HAL layer and the DSP use the same memory queue, which is a producer-consumer model, so synchronization must be performed between the two cores.

[0230] Optionally, the inter-core synchronization mechanism includes a semaphore or other mechanism.

[0231] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. The embodiment of the present invention proposes a timing-based synchronization mechanism that is simpler and more efficient. As shown in FIG8 , taking a frame length of 5ms as an example, the timing-based synchronization mechanism is introduced as follows:

[0232] In the first 5ms: the application writes the first frame Buffer1 to the memory queue, the audio DSP reads the first frame Buffer1 and executes the algorithm, but the audio DSP does not play the first frame Buffer1;

[0233] In the second 5ms: the audio DSP plays the first frame, Buffer1; at the same time, the application writes the second frame, Buffer2, to the memory queue, and the audio DSP reads the second frame, Buffer2, and executes the algorithm;

[0234] In the third 5ms: the audio DSP plays the second frame Buffer2; at the same time, the application writes the third frame Buffer3 to the memory queue, and the audio DSP reads the third frame Buffer3 and executes the algorithm; this process is repeated to achieve inter-core data synchronization.

[0235] Step 416c: The second audio digital signal processor outputs the first audio data to a second output device of the second electronic device.

[0236] In this step, the second audio digital signal processor outputs the first audio data to a second output device of the second electronic device (not shown in FIG6 and FIG9 ). Exemplarily, the second output device of the second electronic device includes a speaker.

[0237] Step 418: The second output device plays the first audio.

[0238] In the technical solution of the audio playback method provided by the embodiment of the present invention, a unique cache device is set in the distributed hardware abstraction layer of the master end. The unique cache device replaces the multiple caches of the master end part in the original data path, reducing the multiple redundant caches on the original data path, ensuring that the audio is not stuck while reducing the transmission delay; when the controlled end plays, the fast path is directly used to call the audio framework to write the data into the memory provided by the local HAL, and the underlying DSP directly reads and sends it for playback. By applying the fast reading path to the underlying DSP, the copying of data at each layer during the local playback process is reduced, thereby reducing the delay; the inter-core synchronization mechanism of the fast path adopts a time-based data synchronization mechanism, which is simpler and more efficient.

[0239] For example, when a user uses the Changlian application in a mobile phone to make a video call, the volume of the mobile phone is limited and cannot meet the requirement of a higher volume, so the user broadcasts the audio in the Changlian application to the speaker; the original data path used by the audio playback system shown in Figure 4 has a certain delay, which usually causes the video picture in the mobile phone and the sound played by the speaker to be out of sync, so it is necessary to reduce the audio playback delay to solve the problem of audio and picture out of sync; the audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the audio and picture synchronization characteristics and enhancing the user experience.

[0240] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of a mobile phone to collect sound and uses the speaker of a large-screen device to play the sound. Since the original data path used by the audio playback system shown in Figure 4 has a certain delay, echo usually occurs. Therefore, it is necessary to reduce the audio playback delay to eliminate the echo. The audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the echo cancellation characteristics and enhancing the user experience.

[0241] Therefore, the embodiments of the present invention improve audio and video synchronization, echo cancellation and other characteristics by reducing audio playback delay, thereby enhancing user experience.

[0242] Based on the audio playback system shown in Figures 6-9, an embodiment of the present invention provides another audio playback method. Figure 11 is a signaling interaction diagram of another audio playback method provided by an embodiment of the present invention. As shown in Figure 11, the method includes:

[0243] Step 502: The first application generates a second play request in response to a user's play operation on a second audio in the first application.

[0244] In this step, as shown in Figures 6 and 9 , the first application generates a second play request in response to the user's play operation on the second audio in the first application. The second play request carries the second audio data of the second audio and the device identification of the first electronic device.

[0245] In some possible embodiments, step 502 specifically includes: the first application generates a first play request in response to a user selecting a first electronic device to play the first audio in the first application.

[0246] Exemplarily, the first application includes an audio application, that is, an application capable of playing audio, such as a music application, a game application, or an instant messaging application.

[0247] Step 504: The first application sends a second play request to the first audio framework.

[0248] In this step, as shown in FIG6 and FIG9 , the first application sends the second play request to the first audio framework.

[0249] Step 506: The first audio framework outputs the second audio data to the first output device of the first electronic device through the first fast path and inter-core synchronization mechanism according to the second play request.

[0250] In some possible embodiments, step 506 specifically includes:

[0251] Step 506a: The first audio framework determines, based on the second play request, whether the device identifier in the second play request is the device identifier of the first electronic device.

[0252] In this step, after receiving the second play request, the first audio framework determines whether the second play request is a local play request or a distributed play request based on the device identifier in the second play request. Specifically, if the device identifier in the second play request is the device identifier of the first electronic device, the second play request is a local play request; if the device identifier in the second play request is not the device identifier of the first electronic device, the second play request is a distributed play request.

[0253] Step 506b: The first audio framework determines that the device identifier in the second play request is the device identifier of the first electronic device, and writes the second audio data into the first path memory of the first local hardware abstraction layer through the first fast path.

[0254] Since the second play request carries the device identification of the first electronic device, the first audio framework determines that the device identification in the second play request is the device identification of the first electronic device, then the second play request is a local play request, and the second audio data is local audio data.

[0255] In this step, as shown in FIG6 and FIG9 , the first audio framework writes the second audio data into the first path memory of the first local hardware abstraction layer through the first fast path.

[0256] Among them, the first path memory is created by the first local hardware abstraction layer of the first electronic device. The first path memory can be directly shared with the application, the first audio framework, and the first audio DSP, thereby realizing a direct and fast channel from the application or audio framework to the underlying audio DSP. Figure 7 is a schematic diagram of the principle of the fast path in an embodiment of the present invention. As shown in Figure 7, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing memory copies therein. Therefore, the embodiment of the present invention provides a direct and fast channel from the application or audio framework to the underlying audio DSP, thereby reducing memory copies therein and reducing the playback delay of local audio and distributed audio.

[0257] Step 506c: The first audio digital signal processor reads the second audio data from the first path memory through the inter-core synchronization mechanism.

[0258] In this step, as shown in FIG6 and FIG9 , the first audio digital signal processor reads the second audio data from the first path memory through the inter-core synchronization mechanism.

[0259] In the fast path, the local HAL layer and the DSP use the same memory queue, which is a producer-consumer model, so synchronization must be performed between the two cores.

[0260] Optionally, the inter-core synchronization mechanism includes a semaphore or other mechanism.

[0261] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. The embodiment of the present invention proposes a timing-based synchronization mechanism that is simpler and more efficient. As shown in FIG8 , taking a frame length of 5ms as an example, the timing-based synchronization mechanism is introduced as follows:

[0262] In the first 5ms: the application writes the first frame Buffer1 to the memory queue, the audio DSP reads the first frame Buffer1 and executes the algorithm, but the audio DSP does not play the first frame Buffer1;

[0263] In the second 5ms: the audio DSP plays the first frame, Buffer1; at the same time, the application writes the second frame, Buffer2, to the memory queue, and the audio DSP reads the second frame, Buffer2, and executes the algorithm;

[0264] In the third 5ms: the audio DSP plays the second frame Buffer2; at the same time, the application writes the third frame Buffer3 to the memory queue, and the audio DSP reads the third frame Buffer3 and executes the algorithm; this process is repeated to achieve inter-core data synchronization.

[0265] Step 506d: The first audio digital signal processor outputs the second audio data to the first output device of the first electronic device.

[0266] In this step, the first audio digital signal processor outputs the second audio data to a first output device of the first electronic device (not shown in FIG6 and FIG9 ). Exemplarily, the first output device of the first electronic device includes a speaker.

[0267] Step 508: The first output device plays the second audio.

[0268] In the technical solution of the audio playback method provided by the embodiment of the present invention, when playing local audio, the electronic device directly uses a fast path, calling the audio framework to write data into the memory provided by the local HAL, and the underlying DSP directly reads and plays it. By applying the fast reading path to the underlying DSP, the data copying at each layer during the local playback process is reduced, thereby reducing latency. The inter-core synchronization mechanism of the fast path adopts a time-series-based data synchronization mechanism, which is simpler and more efficient.

[0269] Based on the audio playback system shown in Figures 6-9, an embodiment of the present invention provides another audio playback method. Figure 12 is a flow chart of an audio playback method provided by an embodiment of the present invention. As shown in Figure 12, the method includes:

[0270] Step 602: The first electronic device generates a first play request through the first application in response to a user's play operation on the first audio in the first application. The first play request carries first audio data of the first audio and a device identifier of the second electronic device.

[0271] Exemplarily, the first application includes an audio application, that is, an application capable of playing audio, such as a music application, a game application, or an instant messaging application.

[0272] In some possible embodiments, step 602 specifically includes: the first electronic device generating a first play request through the first application in response to a user selecting a second electronic device to play the first audio in the first application. For example, when a user uses the Changlian application on a mobile phone to make a video call, due to the limited volume of the mobile phone, it cannot meet the requirement for a higher volume. The user casts the audio in the Changlian application to a speaker, and the play request carries the audio data and the device identifier of the speaker.

[0273] Step 604: The first electronic device writes the first audio data into the unique cache address by calling the first audio framework according to the first play request.

[0274] In some possible embodiments, as shown in FIG13 , step 604 specifically includes:

[0275] Step 604a: The first electronic device determines, based on the first play request, whether the device identifier in the first play request is the device identifier of the first electronic device.

[0276] The first electronic device determines whether the first play request is a local play request or a distributed play request based on the device identifier in the first play request. Specifically, if the device identifier in the first play request is the device identifier of the first electronic device, the first play request is a local play request; if the device identifier in the first play request is not the device identifier of the first electronic device, the first play request is a distributed play request.

[0277] Step 604b: The first electronic device determines that the device identifier in the first play request is not the device identifier of the first electronic device, and obtains the unique cache address of the unique cache device by calling the first audio framework.

[0278] Since the first play request carries the device identification of the second electronic device, the first audio framework determines that the device identification in the first play request is not the device identification of the first electronic device, then the first play request is a distributed play request, and the first audio data is distributed audio data.

[0279] The unique cache address is the address of the unique cache used during the transmission of the first audio data from the first application to the second electronic device. This unique cache address is provided by a unique cache device. Therefore, during the transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device. Compared to the audio playback system shown in FIG4 , which has multiple redundant caches, this embodiment of the present invention reduces redundant caches and saves transmission latency.

[0280] In the embodiment of the present invention, the unique cache address is not used to cache audio data obtained by the first application from the network, but is only used to cache first audio data transmitted from the first application of the first electronic device to the second electronic device.

[0281] As shown in Figure 6, the distributed HAL is responsible for creating a unique cache device and sending the cache address there to the audio framework and the distributed audio SA. The audio framework and the distributed audio SA negotiate to read and write data, thus implementing distributed audio data transmission. Therefore, the unique cache device is located in the first distributed hardware abstraction layer, and the first audio framework obtains the unique cache address from the first distributed hardware abstraction layer.

[0282] As shown in Figure 9, the audio framework is responsible for creating a unique cache device and sending the cache address there to the distributed HAL. The audio framework and the distributed HAL negotiate read and write operations, implementing distributed audio data transmission. The unique cache device is located in the first audio framework, and the first audio framework obtains the unique cache address from the unique cache device.

[0283] Step 604c: The first electronic device writes the first audio data into the unique cache address by calling the first audio framework.

[0284] Step 606: The first electronic device reads the first audio data from the unique cache address.

[0285] Step 608: The first electronic device sends the first audio data to the second electronic device.

[0286] In some possible embodiments, before step 608, the first electronic device may further include encoding the first audio data to obtain encoded first audio data. Step 608 specifically includes sending the encoded first audio data by the first electronic device to the second electronic device.

[0287] Step 610: The second electronic device outputs the first audio data to the second output device of the second electronic device through the second fast path and the inter-core synchronization mechanism to play the first audio.

[0288] Among them, as shown in Figures 6 and 9, there is a second fast path between the second audio framework and the second audio digital signal processor; the second path memory is the memory provided by the second local hardware abstraction layer for the second fast path. The second path memory is created by the second local hardware abstraction layer of the second electronic device. The second path memory can be directly shared with the application, the second audio framework, and the second audio DSP, thereby realizing a direct fast path from the application or audio framework to the underlying audio DSP. Figure 7 is a schematic diagram of the principle of the fast path in an embodiment of the present invention. As shown in Figure 7, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing memory copies therein. Therefore, the embodiment of the present invention provides a direct fast path from the application or audio framework to the underlying audio DSP, thereby reducing memory copies therein and reducing the playback delay of local audio and distributed audio.

[0289] In the fast path, the local HAL layer and the DSP use the same memory queue, which is a producer-consumer model, so synchronization must be performed between the two cores.

[0290] Optionally, the inter-core synchronization mechanism includes a semaphore or other mechanism.

[0291] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism. The embodiment of the present invention proposes a timing-based synchronization mechanism that is simpler and more efficient. As shown in FIG8 , taking a frame length of 5ms as an example, the timing-based synchronization mechanism is introduced as follows:

[0292] In the first 5ms: the application writes the first frame Buffer1 to the memory queue, the audio DSP reads the first frame Buffer1 and executes the algorithm, but the audio DSP does not play the first frame Buffer1;

[0293] In the second 5ms: the audio DSP plays the first frame, Buffer1; at the same time, the application writes the second frame, Buffer2, to the memory queue, and the audio DSP reads the second frame, Buffer2, and executes the algorithm;

[0294] In the third 5ms: the audio DSP plays the second frame Buffer2; at the same time, the application writes the third frame Buffer3 to the memory queue, and the audio DSP reads the third frame Buffer3 and executes the algorithm; this process is repeated to achieve inter-core data synchronization.

[0295] The second output device of the second electronic device includes a speaker.

[0296] Optionally, before step 610 , the method further includes: the second electronic device receives the encoded first audio data sent by the first electronic device, and obtains the first audio data by decoding the encoded first audio data.

[0297] Optionally, after step 610, the following steps are further included:

[0298] Step 612: The first electronic device generates a second play request in response to the user's play operation on the second audio in the first application. The second play request carries the second audio data of the second audio and the device identification of the first electronic device.

[0299] In some possible embodiments, step 612 specifically includes: the first electronic device generates a second playback request in response to the user selecting the first electronic device to play the second audio in the first application, and the second playback request carries the second audio data of the second audio and the device identification of the first electronic device.

[0300] Step 614: The first electronic device outputs the second audio data to the first output device of the first electronic device through the first fast path and inter-core synchronization mechanism according to the second play request to play the second audio.

[0301] In some possible embodiments, as shown in FIG14 , step 614 specifically includes:

[0302] Step 614a: The first electronic device determines, based on the second play request, whether the device identifier in the second play request is the device identifier of the first electronic device.

[0303] The first electronic device determines whether the second play request is a local play request or a distributed play request based on the device identifier in the second play request. Specifically, if the device identifier in the second play request is the device identifier of the first electronic device, the second play request is a local play request; if the device identifier in the second play request is not the device identifier of the first electronic device, the second play request is a distributed play request.

[0304] Step 614b: The first electronic device determines that the device identifier in the second play request is the device identifier of the first electronic device, and outputs the second audio data to the first output device of the first electronic device through the first fast path and inter-core synchronization mechanism to play the second audio.

[0305] Since the second play request carries the device identification of the first electronic device, the first audio framework determines that the device identification in the second play request is the device identification of the first electronic device, then the second play request is a local play request, and the second audio data is local audio data.

[0306] Among them, as shown in Figures 6 and 9, there is a first fast path between the first audio framework and the first audio digital signal processor; the first path memory is the memory provided by the first local hardware abstraction layer for the first fast path. The first path memory is created by the first local hardware abstraction layer of the first electronic device, and the first path memory can be directly shared with the application, the first audio framework, and the first audio DSP, thereby realizing a direct fast path from the application or audio framework to the underlying audio DSP. Figure 7 is a schematic diagram of the principle of the fast path in an embodiment of the present invention. As shown in Figure 7, through the vertical integration of software and hardware, the memory queue created by the local HAL can be directly shared with the audio DSP, reducing memory copies therein. Therefore, an embodiment of the present invention provides a direct fast path from the application or audio framework to the underlying audio DSP, thereby reducing memory copies therein and reducing the playback delay of local audio and distributed audio.

[0307] The first output device of the first electronic device includes a speaker.

[0308] There is no specific limitation on the order of steps 602-610 and steps 612-614. Steps 602-610 may be performed first and then steps 612-614, or steps 612-614 may be performed first and then steps 602-610. Furthermore, steps 602-610 and steps 612-614 may be performed separately and independently.

[0309] For example, when a user uses the Changlian application in a mobile phone to make a video call, the volume of the mobile phone is limited and cannot meet the requirement of a higher volume, so the user broadcasts the audio in the Changlian application to the speaker; the original data path used by the audio playback system shown in Figure 4 has a certain delay, which usually causes the video picture in the mobile phone and the sound played by the speaker to be out of sync, so it is necessary to reduce the audio playback delay to solve the problem of audio and picture out of sync; the audio playback method provided in the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the audio and picture synchronization characteristics and enhancing the user experience.

[0310] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of a mobile phone to collect sound and uses the speaker of a large-screen device to play the sound. Since the original data path used by the audio playback system shown in Figure 4 has a certain delay, echo usually occurs. Therefore, it is necessary to reduce the audio playback delay to eliminate the echo. The audio playback method provided in the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the echo cancellation characteristics and enhancing the user experience.

[0311] In a technical solution of an audio playback method provided by an embodiment of the present invention, a first electronic device generates a first playback request through the first application in response to a user's playback operation of a first audio in a first application, and the first playback request carries the first audio data of the first audio and the device identification of the second electronic device; according to the first playback request, the first audio data is written to a unique cache address by calling the first audio framework; the first audio data is read from the unique cache address, and the first audio data is sent to the second electronic device; wherein the unique cache address is the address of the unique cache in the process of transmitting the first audio data from the first application to the second electronic device; the second electronic device outputs the first audio data to the second output device of the second electronic device through a second fast path and an inter-core synchronization mechanism to play the first audio, which can reduce the delay of distributed audio playback, thereby improving characteristics such as audio-visual synchronization and echo cancellation, and improving user experience.

[0312] FIG15 is a schematic diagram of the structure of a first electronic device provided by an embodiment of the present invention. It should be understood that the first electronic device 700 can perform each step of the first electronic device in the above-mentioned audio playback method. To avoid repetition, the first electronic device 700 includes: a first processing unit 701 and a first transceiver unit 702.

[0313] The first processing unit 701 is used to generate a first play request through the first application in response to a user's play operation of the first audio in the first application, where the first play request carries the first audio data of the first audio and the device identification of the second electronic device; according to the first play request, write the first audio data to a unique cache address by calling the first audio framework; read the first audio data from the unique cache address; wherein the unique cache address is the address of the only cache in the process of transmitting the first audio data from the first application to the second electronic device.

[0314] The first transceiver unit 702 is configured to send the first audio data to the second electronic device, so that the second electronic device plays the first audio data.

[0315] Optionally, before the first transceiver unit 702 sends the first audio data to the second electronic device, the first processing unit 701 is also used to encode the first audio data to obtain encoded first audio data; the first transceiver unit 702 is specifically used to send the encoded first audio data to the second electronic device.

[0316] Optionally, the first processing unit 701 is also used to generate a second playback request in response to a user's playback operation on the second audio in the first application, where the second playback request carries the second audio data of the second audio and the device identification of the first electronic device; and output the second audio data to the first output device of the first electronic device through a first fast path and inter-core synchronization mechanism to play the second audio.

[0317] Optionally, the first output device includes a speaker.

[0318] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism.

[0319] Optionally, the unique cache address is located in a first audio framework or a first distributed hardware abstraction layer of the first electronic device.

[0320] Optionally, the first application includes an audio application.

[0321] FIG16 is a schematic diagram of the structure of a second electronic device provided by an embodiment of the present invention. It should be understood that the second electronic device 800 can perform each step of the second electronic device in the above-mentioned audio playback method. To avoid repetition, the second electronic device 800 includes: a second transceiver unit 801 and a second processing unit 802.

[0322] The second transceiver unit 801 is configured to receive first audio data sent by a first electronic device.

[0323] The second processing unit 802 is configured to output the first audio data to a second output device of the second electronic device through a second fast path and an inter-core synchronization mechanism to play the first audio.

[0324] Optionally, the second transceiver unit 801 is specifically configured to receive the encoded first audio data sent by the first electronic device; and obtain the first audio data by decoding the encoded first audio data.

[0325] Optionally, the inter-core synchronization mechanism includes a timing-based synchronization mechanism.

[0326] Optionally, the second output device includes a speaker.

[0327] It should be understood that the first electronic device 700 and the second electronic device 800 here are embodied in the form of functional units. The term "unit" here can be implemented in the form of software and / or hardware, and is not specifically limited to this. For example, a "unit" can be a software program, a hardware circuit, or a combination of the two that implements the above-mentioned functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a dedicated processor, or a group processor, etc.) and memory for executing one or more software or firmware programs, a merged logic circuit, and / or other suitable components that support the described functions.

[0328] Therefore, the various exemplary units described in the embodiments of the present invention can be implemented using 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. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present invention.

[0329] An embodiment of the present application provides an electronic device, which may be a terminal device or a circuit device built into the terminal device. The electronic device may be used to perform the functions / steps of the above method embodiment.

[0330] An embodiment of the present application provides a computer-readable storage medium, which stores instructions. When the instructions are executed on a terminal device, the terminal device executes the functions / steps in the above-mentioned method embodiment.

[0331] An embodiment of the present application further provides a computer program product comprising instructions, which, when executed on a computer or at least one processor, enables the computer to execute the functions / steps in the above-mentioned method embodiment.

[0332] In the embodiments of the present application, "at least one" refers to one or more, and "more" refers to two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent the existence of A alone, the existence of A and B at the same time, and the existence of B alone. Among them, A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following" and similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one of a, b and c can be represented by: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0333] Those skilled in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented using a combination of electronic hardware, computer software, and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians 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.

[0334] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0335] In the several embodiments provided in this application, if any function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of this application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0336] The above description is merely a specific embodiment of the present application. Any person skilled in the art may easily conceive of variations or substitutions within the technical scope disclosed in this application, and such variations or substitutions shall be within the scope of protection of this application. The scope of protection of this application shall be subject to the scope of protection of the claims.

Claims

1. An audio playback system, characterized in that: The system comprises: A first electronic device, configured to generate a first play request through a first application in response to a user's play operation of a first audio in a first application, wherein the first play request carries first audio data of the first audio and a device identifier of a second electronic device; write the first audio data to a unique cache address by calling a first audio framework according to the first play request; read the first audio data from the unique cache address, and send the first audio data to the second electronic device; wherein the unique cache address is an address of a unique cache in the process of transmitting the first audio data from the first application to the second electronic device; The second electronic device is used to output the first audio data to a second output device of the second electronic device through a second fast path and an inter-core synchronization mechanism to play the first audio.

2. The system according to claim 1, characterized in that The first electronic device is further configured to generate a second play request in response to a user's play operation of the second audio in the first application, wherein the second play request carries second audio data of the second audio and a device identification of the first electronic device; The second audio data is output to the first output device of the first electronic device through the first fast path and the inter-core synchronization mechanism to play the second audio.

3. The system according to claim 1 or 2, characterized in that: The inter-core synchronization mechanism includes a timing-based synchronization mechanism.

4. The system according to any one of claims 1 to 3, characterized in that: The unique cache address is located in the first audio framework or the first distributed hardware abstraction layer of the first electronic device.

5. The system according to any one of claims 1 to 4, characterized in that: The first application includes an audio application.

6. An audio playback method, characterized in that: Applied to a first electronic device, the method includes: In response to a user's operation of playing a first audio in a first application, generating a first play request through the first application, where the first play request carries first audio data of the first audio and a device identifier of a second electronic device; Writing the first audio data into a unique cache address by calling a first audio framework according to the first play request; Reading the first audio data from the unique buffer address, and sending the first audio data to the second electronic device, so that the second electronic device plays the first audio; The unique cache address is a unique cache address during the process of transmitting the first audio data from the first application to the second electronic device.

7. The method according to claim 6, characterized in that Before sending the first audio data to the second electronic device, the method further includes: Encoding the first audio data to obtain encoded first audio data; The sending the first audio data to the second electronic device comprises: The encoded first audio data is sent to the second electronic device.

8. The method according to claim 6 or 7, characterized in that: The method further comprises: In response to a user's operation of playing a second audio in the first application, generating a second play request, where the second play request carries second audio data of the second audio and a device identification of the first electronic device; The second audio data is output to the first output device of the first electronic device through a first fast path and an inter-core synchronization mechanism to play the second audio.

9. The method according to claim 8, characterized in that The first output device includes a speaker.

10. The method according to claim 8 or 9, characterized in that: The inter-core synchronization mechanism includes a timing-based synchronization mechanism.

11. The method according to any one of claims 6 to 10, characterized in that: The unique cache address is located in the first audio framework or the first distributed hardware abstraction layer of the first electronic device.

12. The method according to any one of claims 6 to 11, characterized in that: The first application includes an audio application.

13. An audio playing method, characterized in that: Applied to a second electronic device, the method includes: Receiving first audio data sent by a first electronic device; The first audio data is output to the second output device of the second electronic device through a second fast path and inter-core synchronization mechanism to play the first audio.

14. The method according to claim 13, characterized in that The receiving the audio data sent by the first electronic device includes: Receiving the encoded first audio data sent by the first electronic device; The first audio data is obtained by decoding the encoded first audio data.

15. The method according to claim 13 or 14, characterized in that The inter-core synchronization mechanism includes a timing-based synchronization mechanism.

16. The method according to any one of claims 13 to 15, characterized in that The second output device includes a speaker.

17. An electronic device, characterized in that: It comprises a processor and a memory, wherein the memory is used to store a computer program, and the computer program comprises program instructions. When the processor runs the program instructions, the electronic device executes the steps of the method as claimed in any one of claims 6 to 16.

18. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program request is executed by a computer, the computer is caused to execute the method according to any one of claims 6 to 16.

Citation Information

Patent Citations

  • Audio playing system and method and electronic equipment

    CN118538252A

  • Sound effect changing method and terminal

    CN106231065A

  • Cache updating method and device

    CN113014997A

  • Cache information processing method and device and electronic equipment

    CN115130028A

  • Sending Audio Content to Digital Works

    US20220007065A1