Audio playing system and method and electronic equipment

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

CN118538252APending Publication Date: 2024-08-23HUAWEI TECH CO LTD
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202310197537.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-02-22
Publication Date
2024-08-23

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 thus reduce user experience.

Method used

By setting a unique cache address in the first electronic device, the audio data is only cached once during the transmission process, and the fast path and inter-core synchronization mechanism are used to reduce memory copies, provide a direct fast path from the application to the audio DSP, and reduce distribution Audio playback delay.

Benefits of technology

It effectively reduces the delay of distributed audio playback, improves audio and video synchronization and echo cancellation characteristics, and improves user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118538252A
    Figure CN118538252A
Patent Text Reader

Abstract

The embodiment of the invention provides an audio playing system and method and electronic equipment. In the technical scheme, first electronic equipment responds to a playing operation of a user on a first audio in a first application, and generates a first playing request through the first application, the first playing request carries first audio data of the first audio and a device identifier of the second electronic device; writing the first audio data into a unique cache address by calling a first audio frame according to the first playing request; reading the first audio data from the unique cache address and then sending the first audio data to the second electronic equipment; the unique cache address is the unique cache address in the process of transmitting the first audio data from the first application to the second electronic equipment; and the second electronic equipment outputs the first audio data to the second output equipment of the second electronic equipment through the second fast path and the inter-core synchronization mechanism to play the first audio, so that the time delay of distributed audio playing can be reduced, the characteristics of sound and picture synchronization, echo cancellation and the like are improved, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[Technical field]

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

[0002] There are multiple data caches in the audio playback system, especially in the distributed audio playback scenario. Although the size of a frame of audio data is not too large, multiple caches also bring a certain delay, affecting features such as audio and video synchronization, echo cancellation, and user experience. [Summary of the invention]

[0003] In view of this, the embodiments of the present invention provide an audio playback system, method and electronic device, which can reduce the delay of distributed audio playback, thereby improving characteristics such as audio and video synchronization and echo cancellation, and improving user experience.

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

[0005] 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;

[0006] The second electronic device is used to output 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. 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 the transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device, which reduces redundant cache and reduces the delay of distributed audio playback, thereby improving audio-visual synchronization, echo cancellation and other characteristics, and improving user experience.

[0007] In combination with the first aspect, in certain implementations of the first aspect, the first electronic device is further used to generate a second play request in response to a 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; 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.

[0008] 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, which is a producer-consumer model, so the two cores must be synchronized, and the timing-based synchronization mechanism is simpler and more efficient.

[0009] In conjunction with the first aspect, in some 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 an embodiment of the present invention, the unique cache address may be provided by an audio framework or a distributed hardware abstraction layer.

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

[0011] In a second aspect, an embodiment of the present invention provides an audio playback method, which is applied to a first electronic device, and the method includes:

[0012] 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;

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

[0014] 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;

[0015] The unique cache address is the unique cache address of the first audio data during the transmission from the first application to the second electronic device. In the 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 the transmission of the first audio data, the first audio data only needs to be cached once in the first electronic device, which reduces redundant cache and reduces the delay of distributed audio playback, thereby improving audio-visual synchronization, echo cancellation and other characteristics, and improving user experience.

[0016] In combination with the second aspect, in some implementations of the first aspect, before sending the first audio data to the second electronic device, the method further includes:

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

[0018] The sending the first audio data to the second electronic device comprises:

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

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

[0021] 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;

[0022] 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 the embodiment of the present invention, the first fast path is created by the first local hardware abstraction layer of the first electronic device; in 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 the memory copy therein, thereby providing a direct fast channel from the application or audio framework to the underlying audio DSP, reducing the memory copy therein, and reducing the playback delay of the local audio and distributed audio.

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

[0024] 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, which is a producer-consumer model, so the two cores must be synchronized, and the timing-based synchronization mechanism is simpler and more efficient.

[0025] In conjunction with the second aspect, in some 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 an embodiment of the present invention, the unique cache address may be provided by an audio framework or a distributed hardware abstraction layer.

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

[0027] In a third aspect, an embodiment of the present invention provides an audio playback method, which is applied to a second electronic device, and the method includes:

[0028] Receiving first audio data sent by a first electronic device;

[0029] The first audio data is output 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. In the embodiment of the present invention, the second fast path is created by the second local hardware abstraction layer of the second electronic device; in 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 the memory copy therein, thereby providing a direct fast channel from the application or audio framework to the underlying audio DSP, reducing the memory copy therein, and reducing the playback delay of the local audio and distributed audio.

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

[0031] Receiving the encoded first audio data sent by the first electronic device;

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

[0033] 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, which is a producer-consumer model, so the two cores must be synchronized, and the timing-based synchronization mechanism is simpler and more efficient.

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

[0035] 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 as described above.

[0036] 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 executed by a computer, the computer is caused to execute the method as described above.

[0037] 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

[0038] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0039] Figure 1 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention;

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

[0041] Figure 3 A schematic diagram of an audio playback process in a distributed audio playback scenario;

[0042] Figure 4 A schematic diagram of an audio playback system;

[0043] Figure 5 A schematic diagram of multiple audio data caches in a distributed audio playback scenario;

[0044] Figure 6 A schematic diagram of an audio playback system provided by an embodiment of the present invention;

[0045] Figure 7 It is a schematic diagram of the principle of the fast access device in an embodiment of the present invention;

[0046] Figure 8 A timing diagram of a timing-based synchronization mechanism in an embodiment of the present invention;

[0047] Fig. 9 A schematic diagram of another audio playback system provided by an embodiment of the present invention;

[0048] Fig.10 A signaling interaction diagram of an audio playback method provided by an embodiment of the present invention;

[0049] Fig.11 A signaling interaction diagram of another audio playback method provided by an embodiment of the present invention;

[0050] Fig.12 A flowchart of an audio playback method provided by an embodiment of the present invention;

[0051] Fig.13 for Fig.12 A specific flow chart of the first electronic device reading the first audio data from the unique cache address according to the first play request;

[0052] Fig.14 for Fig.12 A specific flow chart of the first electronic device 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;

[0053] Fig.15 A schematic diagram of the structure of a first electronic device provided by an embodiment of the present invention;

[0054] Fig.16 A schematic structural diagram of a second electronic device provided by an embodiment of the present invention. [Specific implementation method]

[0055] 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.

[0056] It should be clear that the described embodiments are only part 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 ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0057] 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", "said" 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 other meanings.

[0058] It should be understood that the term "and / or" used in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated objects before and after are in an "or" relationship.

[0059] Figure 1 A schematic structural diagram of an electronic device 100 is shown.

[0060] 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.

[0061] It is to be understood that the structure illustrated in the embodiment 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 in the figure, or combine some components, or separate some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0062] 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 processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent devices or integrated into one or more processors.

[0063] 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.

[0064] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0065] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0066] The USB interface 130 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 130 can be used to connect a charger to charge the electronic device 100, and can also be used to transfer data between the electronic device 100 and a peripheral device. It can also be used to connect headphones to play audio through the headphones. The interface can also be used to connect other electronic devices, such as AR devices, etc.

[0067] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic 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 in the above embodiments, or a combination of multiple interface connection methods.

[0068] The charging management module 140 is used to receive charging input from a charger. The charger may be a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 may receive charging input from a wired charger through the USB interface 130. In some wireless charging embodiments, the charging management module 140 may receive wireless charging input through a wireless charging coil of the electronic device 100. While the charging management module 140 is charging the battery 142, it may also power the electronic device through the power management module 141.

[0069] 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 supplies power to the processor 110, the internal memory 121, the display screen 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 number, battery health status (leakage, impedance), etc. 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.

[0070] 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.

[0071] 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 the utilization of antennas. For example, antenna 1 can be reused as a diversity antenna for a wireless local area network. In some other embodiments, the antenna can be used in combination with a tuning switch.

[0072] The mobile communication module 150 can provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 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.

[0073] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent 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 the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a 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.

[0074] 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 integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0075] 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).

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

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

[0078] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0079] ISP is used to process the data fed back by camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0080] 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 optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted 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.

[0081] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0082] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0083] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0084] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0085] 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.

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

[0087] 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 arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

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

[0089] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0090] Microphone 170C, also called "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 microphone 170C to input the sound signal into 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 sound source, realize directional recording function, etc.

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

[0092] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0093] 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.

[0094] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0095] The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting it into the SIM card interface 195 or pulling it out from the SIM card interface 195. The electronic device 100 can support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM cards, Micro SIM cards, SIM cards, 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.

[0096] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. In the embodiment of the present invention, the Android system of the layered architecture is taken as an example to exemplify the software structure of the electronic device 100.

[0097] Figure 2 1 is a software structure block diagram of the electronic device 100 according to an embodiment of the present invention.

[0098] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

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

[0100] like Figure 2 As shown, the application package may include camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, short message and other applications.

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

[0102] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

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

[0104] 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.

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

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

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

[0108] The notification manager enables applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the system top status bar in the form of a chart or scroll bar text, such as notifications of applications running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is displayed in the status bar, a prompt sound is emitted, an electronic device vibrates, an indicator light flashes, etc.

[0109] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

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

[0111] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0112] The system library may 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.

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

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

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

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

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

[0118] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with capturing a photo scene.

[0119] 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, timestamp of the touch operation, 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 static images or videos through the camera 193.

[0120] Audio playback is one of the important functions of current electronic device operating systems. Since the human ear is sensitive to sound, in order to ensure less lag during audio playback, current mainstream operating systems will cache several frames in the audio framework during audio playback. Some operating systems are mainly positioned to provide operating system (OS) capabilities for stand-alone devices and are not designed for distributed scenarios. Therefore, directly modifying them for distributed audio playback will result in higher latency.

[0121] Figure 3 is a schematic diagram of the audio playback process in a distributed audio playback scenario, such as Figure 3 As shown in the figure, in the distributed audio playback scenario, the audio needs to be transmitted from the audio application of the master end to the speaker of the controlled end for playback. The entire transmission chain is relatively long, including the audio application of the master end, the audio framework, the encoder, the distributed audio, the soft bus and the decoder, the distributed audio, the audio framework, the kernel / direct memory access (DMA) and the speaker of the controlled end. At the same time, since the audio framework and distributed transmission process of the two devices are cached, and also include encoding delay and DMA handling time, the overall latency of distributed audio playback is high, affecting the user experience and audio and video synchronization, echo cancellation and other features.

[0122] Figure 4 A schematic diagram of an audio playback system is shown in FIG. Figure 4 As shown, 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 to the audio framework (AudioFramework) by the music application, 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. Subsequently, the local hardware abstraction layer passes the audio data to the kernel, audio digital signal processor (DSP), etc. for DMA playback.

[0123] like Figure 4As shown, taking the music application of device A as an example, when the music application of device A applies to play on device B, device A is the master end and device B is the controlled end. In device A, the audio data is given to the audio framework by the music application, and then the audio framework copies the audio data and passes the audio data to the distributed hardware abstraction layer (Distributed HAL) provided by distributed audio. The distributed hardware abstraction layer then passes the audio data to the distributed audio system capability (Stand Alone, SA) through data copying. The distributed audio SA encodes the audio data and then sends it to device B through the distributed soft bus; after receiving the audio data, device B decodes it and then calls the audio framework to play music. The audio framework will call the local HAL of device B, and then pass it to the kernel, audio DSP, etc. for DMA playback.

[0124] therefore, Figure 4 In the audio playback system shown, 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. Figure 4 As shown in the figure, the audio framework of the master end, the distributed audio transmission, and the audio framework of the controlled end all have multiple frame caches, which are unnecessary and redundant. Each cached frame will cause a delay of one frame, and the delay caused by caching N frames will be multiplied by N. Figure 5 This 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. Figure 5 As shown in the figure, if caching 3 frames at each location causes a delay of 60ms, then the delay caused by redundant caching will be as long as more than 100ms.

[0125] Figure 4 The audio playback system shown has 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 frame of audio data is not too large, frequent copying also brings certain delays and operational complexity.

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

[0127] Figure 6 Schematic diagram of an audio playback system provided by an embodiment of the present invention. Figure 6As shown, 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. There is a first fast path between the first audio framework 220 and the first audio digital signal processor 250; the first path memory 231 is a memory provided by the first local hardware abstraction layer 230 for the first fast path.

[0128] 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. There is a second fast path between the second audio framework 320 and the second audio digital signal processor 350; the second path memory 331 is a memory provided by the second local hardware abstraction layer 330 for the second fast path.

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

[0130] 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 be referred to in Figure 1 and Figure 2 Related description about electronic device 100.

[0131] and Figure 4 Compared with the audio playback system shown in FIG. 1 , the audio playback system provided in the 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.

[0132] Among them, the path memory is created by the local hardware abstraction layer of the electronic device. The path memory can be directly shared with the application, audio framework, and audio DSP, thereby realizing a direct and fast channel from the application or audio framework to the underlying audio DSP. Figure 7 Schematic diagram of the principle of the fast path in the embodiment of the present invention, such as Figure 7 As shown, 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. 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 into the shared memory (i.e., the first channel memory 231) created by the local HAL, and the underlying first audio digital signal processor 250 directly reads from the shared memory and sends it to DMA for playback. 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 the memory copy and reducing the playback delay of local audio and distributed audio.

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

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

[0135] Optionally, the inter-core synchronization mechanism includes a synchronization mechanism based on timing. The embodiment of the present invention proposes a synchronization mechanism based on timing. Figure 8 FIG. 1 is a timing diagram of a timing-based synchronization mechanism in an embodiment of the present invention, such as Figure 8 As shown in the figure, taking a frame length of 5ms as an example, the timing-based synchronization mechanism is introduced as follows:

[0136] 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, and the audio DSP does not play the first frame Buffer1;

[0137] 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;

[0138] 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, which is simpler and more efficient.

[0139] In the embodiment of the present invention, a unique cache device is set 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 the distributed audio data from the first application 210 to the second electronic device 300. Therefore, during the transmission of the 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. Figure 6 As shown, the only cache device is created by the distributed HAL, and the cache address 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; Figure 4 Compared with the audio playback system shown in the figure with multiple redundant caches, the embodiment of the present invention reduces the redundant caches and saves the transmission delay.

[0140] 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.

[0141] Taking the distributed audio playback scenario as an example, Figure 6 The audio playback system shown is as follows:

[0142] The first electronic device 200 is used to generate a first play request through the first application 210 in response to the user's play operation of the first audio in the first application 210, and 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 the unique cache address by calling the first audio framework 220; read the first audio data from the unique cache address and send the first audio data to the second electronic device 300. The second electronic device 300 outputs 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. Among them, the unique cache address is the address of the unique cache in the process of transmitting the first audio data from the first application 210 to the second electronic device 300.

[0143] 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.

[0144] 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 identification of the second electronic device 300.

[0145] In some possible embodiments, the first application 210 is used 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 .

[0146] Exemplarily, the first application 210 includes an audio application, that is, an application that can play audio, such as a music application, a game application, or an instant messaging application.

[0147] 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.

[0148] 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.

[0149] 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.

[0150] 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.

[0151] In some possible embodiments, the first distributed audio system capability 260 is specifically used 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

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

[0153] 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.

[0154] Among them, 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.

[0155] Specifically, the second communication module 362 is used to receive the encoded first audio data, and send the encoded first audio data to the decoder 361. The decoder 361 is used 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, and the decoder 361 sends the first audio data to the proxy client, and the proxy client then sends the first audio data to the second audio framework 320.

[0156] 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.

[0157] In some possible embodiments, the second audio framework 320 is used to write the first audio data into the second path memory 331 of the second local hardware abstraction layer 330 through the second fast path. The second audio digital signal processor 350 is used to read the first audio data from the second path memory 331 through the inter-core synchronization mechanism, and output the first audio data to the 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.

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

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

[0160] For example, when a user uses the Changlian app on their 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 app to the speaker; Figure 4The original data path used by the audio playback system shown 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. Therefore, it is necessary to reduce the audio playback delay to solve the problem of audio and video asynchrony; the audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the audio and video synchronization characteristics and improving the user experience.

[0161] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of the mobile phone to collect the sound and uses the speaker of the large-screen device to play the sound. Figure 4 The original data path used by the audio playback system shown has a certain delay, and echo usually occurs, so 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 improving the user experience.

[0162] 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, reduces the multiple redundant caches on the original data path, and reduces the transmission delay while ensuring that the audio is not stuck. 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 sends it for playback. By applying the fast reading path to the underlying DSP, the data copying of each layer during the local playback process is reduced, and the delay is reduced. 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 reduces the audio playback delay, thereby improving the characteristics of audio and video synchronization, echo cancellation, etc., and improving the user experience.

[0163] Taking the local playback scenario as an example, Figure 6 The audio playback system shown is as follows:

[0164] The first electronic device 200 is used to generate a second playback request in response to a user's playback operation on the second audio in the first application 210, where the second playback request carries second audio data of the second audio and a device identifier 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 a first fast path and an inter-core synchronization mechanism to play the second audio.

[0165] The first application 210 is used to generate a second play request in response to the 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.

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

[0167] Exemplarily, the first application 210 includes an audio application, that is, an application that can play audio, such as a music application, a game application, or an instant messaging application.

[0168] 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.

[0169] In some possible embodiments, the first audio framework 220 is used to write the second audio data into the first path memory 231 of the first local hardware abstraction layer 230 through the first fast path according to the second play request. The first audio digital signal processor 250 is used to read the second audio data from the first path memory 231 through 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.

[0170] In the local playback scenario, on the one hand, in the original data path, when the electronic device calls the audio framework for playback, the data is sent for playback by continuous copying; the embodiment of the present invention directly adopts the fast path, the audio framework writes the data into the memory provided by the local HAL, and the bottom DSP directly reads and plays it. By applying the fast reading path to the bottom DSP, the data copying of each layer during the local playback process is reduced, and the delay is reduced. 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.

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

[0172] Furthermore, an embodiment of the present invention provides another audio playback system, Fig. 9 Schematic diagram of another audio playback system provided by an embodiment of the present invention. Fig. 9 As shown, Figure 6 Compared to the audio playback system shown, Fig. 9 The audio playback system shown has the following differences:

[0173] Difference 1: The unique cache device is created by the audio framework, not by the distributed hardware abstraction layer. Fig. 9 As shown, 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.

[0174] 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 according to the first playback request; and write the first audio data into the unique cache device 221 according to the unique cache address. In some possible embodiments, the first audio framework 220 is also used to send a read command to the first distributed hardware abstraction layer 240 after writing the first audio data into the unique cache device 221. The first distributed hardware abstraction layer 240 is used to read the first audio data from the unique cache device 221 according to the read command, and send the first audio data to the encoder 261 of the first distributed audio system capability 260.

[0175] Except for the above two differences, the rest are the same Figure 6 The audio playback system shown is the same as that shown in the figure. Figure 6 The embodiment of the audio playback system shown is not described in detail here.

[0176] based on Figure 6-Figure 9 The audio playing system shown, an embodiment of the present invention provides an audio playing method. Fig.10 The following is a signaling interaction diagram of an audio playback method provided by an embodiment of the present invention. Fig.10 As shown, the method includes:

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

[0178] In this step, if Figure 6 and Fig. 9 As shown, the first application generates a first play request in response to a 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.

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

[0180] Exemplarily, the first application includes an audio application, that is, an application that can play audio, such as a music application, a game application, or an instant messaging application.

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

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

[0183] In this step, if Figure 6 and Fig. 9 As shown, the first audio framework obtains a unique cache address according to the first play request.

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

[0185] 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.

[0186] 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 according to 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.

[0187] 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.

[0188] 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.

[0189] The unique cache device is a device in the first electronic device for providing 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 unique cache address 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. Figure 4 Compared with the audio playback system shown in the figure with multiple redundant caches, the embodiment of the present invention reduces the redundant caches and saves the transmission delay.

[0190] 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.

[0191] like Figure 6 As shown, the unique cache device is created by the distributed HAL, and the cache address 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. 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.

[0192] like Fig. 9 As shown, the unique cache device is created by the audio framework, and the cache address is sent to the distributed HAL. The audio framework and the distributed HAL negotiate to read and write, realizing 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.

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

[0194] like Figure 6 As shown, 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.

[0195] 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.

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

[0197] 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.

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

[0199] like Figure 6 As shown, the first distributed audio system is capable of reading the first audio data from a unique cache address in a unique cache device.

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

[0201] like Fig. 9 As shown, 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 the first distributed hardware abstraction layer reads the first audio data from the unique cache address in the unique cache device, it sends the first audio data to the encoder of the first distributed audio system capability.

[0202] 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.

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

[0204] like Figure 6 and Fig. 9 As shown, 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.

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

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

[0207] In this step, if Figure 6 and Fig. 9 As shown, the encoder encodes the first audio data to obtain encoded first audio data.

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

[0209] In this step, if Figure 6 and Fig. 9 As shown, the encoder sends the encoded first audio data to the first communication module.

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

[0211] In this step, if Figure 6 and Fig. 9 As shown, 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.

[0212] 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.

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

[0214] In this step, if Figure 6 and Fig. 9 As shown, the second communication module sends the encoded first audio data to the decoder.

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

[0216] In this step, if Figure 6 and Fig. 9 As shown, the decoder decodes the encoded first audio data to obtain the first audio data.

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

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

[0219] In this step, if Figure 6 and Fig. 9 As shown, the decoder sends the first audio data to the second audio frame.

[0220] In some possible embodiments, the second distributed audio system capability also 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.

[0221] 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.

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

[0223] 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.

[0224] In this step, if Figure 6 and Fig. 9 As shown, 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] Among them, the second channel memory is created by the second local hardware abstraction layer of the second electronic device, and the second channel 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 Schematic diagram of the principle of the fast path in the embodiment of the present invention, such as Figure 7 As shown, 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. 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 the memory copy and reducing the playback delay of local audio and distributed audio.

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

[0227] In this step, if Figure 6 and Fig. 9 As shown, the second audio digital signal processor reads the first audio data from the second channel memory through the inter-core synchronization mechanism.

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

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

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

[0231] 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, and the audio DSP does not play the first frame Buffer1;

[0232] 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;

[0233] 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.

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

[0235] In this step, the second audio digital signal processor outputs the first audio data to the second output device ( Figure 6 and Fig. 9 (not shown in the figure). Exemplarily, the second output device of the second electronic device includes a speaker.

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

[0237] 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, and the multiple caches of the master end part in the original data path are replaced by the unique cache device, thereby reducing the multiple redundant caches on the original data path, and reducing the transmission delay while ensuring that the audio is not stuck; 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 bottom DSP directly reads and sends it for playback. By applying the fast reading path to the bottom DSP, the data copying of each layer during the local playback process is reduced, thereby reducing the delay; the inter-core synchronization mechanism of the fast path adopts a timing-based data synchronization mechanism, which is simpler and more efficient.

[0238] For example, when a user uses the Changlian app on their 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 app to the speaker; Figure 4 The original data path used by the audio playback system shown 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. Therefore, it is necessary to reduce the audio playback delay to solve the problem of audio and video asynchrony; the audio playback system provided by the embodiment of the present invention can effectively reduce the audio playback delay, thereby improving the audio and video synchronization characteristics and improving the user experience.

[0239] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of the mobile phone to collect the sound and uses the speaker of the large-screen device to play the sound. Figure 4 The original data path used by the audio playback system shown has a certain delay, and echo usually occurs, so 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 improving the user experience.

[0240] Therefore, the embodiments of the present invention improve the audio-visual synchronization, echo cancellation and other characteristics by reducing the audio playback delay, thereby improving the user experience.

[0241] based on Figure 6-Figure 9The audio playing system shown, the embodiment of the present invention provides another audio playing method. Fig.11 FIG. 4 is a signaling interaction diagram of another audio playback method provided by an embodiment of the present invention. Fig.11 As shown, the method includes:

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

[0243] In this step, if Figure 6 and Fig. 9 As shown, 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.

[0244] 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.

[0245] Exemplarily, the first application includes an audio application, that is, an application that can play audio, such as a music application, a game application, or an instant messaging application.

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

[0247] In this step, if Figure 6 and Fig. 9 As shown, the first application sends a second play request to the first audio framework.

[0248] 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.

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

[0250] 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.

[0251] 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 according to 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.

[0252] 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.

[0253] 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.

[0254] In this step, if Figure 6 and Fig. 9 As shown, 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.

[0255] Among them, the first channel memory is created by the first local hardware abstraction layer of the first electronic device, and the first channel 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 Schematic diagram of the principle of the fast path in the embodiment of the present invention, such as Figure 7 As shown, 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. 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 the memory copy and reducing the playback delay of local audio and distributed audio.

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

[0257] In this step, if Figure 6 and Fig. 9 As shown, the first audio digital signal processor reads the second audio data from the first channel memory through the inter-core synchronization mechanism.

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

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

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

[0261] 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, and the audio DSP does not play the first frame Buffer1;

[0262] 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;

[0263] 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.

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

[0265] In this step, the first audio digital signal processor outputs the second audio data to the first output device ( Figure 6 and Fig. 9 (not shown in the figure). Exemplarily, the first output device of the first electronic device includes a speaker.

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

[0267] 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 adopts the fast path, calls the audio framework to write data into the memory provided by the local HAL, and the bottom DSP directly reads and sends it for playback. By applying the fast reading path to the bottom DSP, the data copying of each layer during the local playback process is reduced, and the delay is reduced; the inter-core synchronization mechanism of the fast path adopts a timing-based data synchronization mechanism, which is simpler and more efficient.

[0268] based on Figure 6-Figure 9 The audio playing system shown, the embodiment of the present invention provides another audio playing method. Fig.12 Flow chart of an audio playback method provided by an embodiment of the present invention. Fig.12 As shown, the method includes:

[0269] Step 602: The first electronic device generates a first play request through the first application in response to a user's operation of playing 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.

[0270] Exemplarily, the first application includes an audio application, that is, an application that can play audio, such as a music application, a game application, or an instant messaging application.

[0271] In some possible embodiments, step 602 specifically includes: the first electronic device generates a first play request through the first application in response to the user selecting the second electronic device to play the first audio in the first application. 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. The user broadcasts the audio in the Changlian application to a speaker, so that the play request carries the audio data and the device identification of the speaker.

[0272] 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.

[0273] In some possible embodiments, Fig.13 As shown, step 604 specifically includes:

[0274] 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.

[0275] 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.

[0276] 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.

[0277] 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.

[0278] The unique cache address is the unique cache address of the first audio data during the transmission from the first application to the second electronic device. The unique cache address is provided by the 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. Figure 4 Compared with the audio playback system shown in the figure with multiple redundant caches, the embodiment of the present invention reduces the redundant caches and saves the transmission delay.

[0279] 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.

[0280] like Figure 6 As shown, the unique cache device is created by the distributed HAL, and the cache address 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. 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.

[0281] like Fig. 9 As shown, the unique cache device is created by the audio framework, and the cache address is sent to the distributed HAL. The audio framework and the distributed HAL negotiate to read and write, realizing 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.

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

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

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

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

[0286] Step 610: The second electronic device outputs 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.

[0287] Among them, Figure 6 and Fig. 9 As shown, 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, and 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 7Schematic diagram of the principle of the fast path in the embodiment of the present invention, such as Figure 7 As shown, 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. 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 the memory copy and reducing the playback delay of local audio and distributed audio.

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

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

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

[0291] 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, and the audio DSP does not play the first frame Buffer1;

[0292] 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;

[0293] 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.

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

[0295] 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.

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

[0297] 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, where the second play request carries the second audio data of the second audio and the device identification of the first electronic device.

[0298] 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.

[0299] 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.

[0300] In some possible embodiments, Fig.14 As shown, step 614 specifically includes:

[0301] 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.

[0302] 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.

[0303] 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.

[0304] 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.

[0305] Among them, Figure 6 and Fig. 9 As shown, 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 Schematic diagram of the principle of the fast path in the embodiment of the present invention, such as Figure 7As shown in the figure, 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. 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 the memory copy and reducing the playback delay of local audio and distributed audio.

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

[0307] There is no specific limitation on the order of steps 602-610 and steps 612-614, and 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 also be performed separately and independently.

[0308] For example, when a user uses the Changlian app on their 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 app to the speaker; Figure 4 The original data path used by the audio playback system shown 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. Therefore, it is necessary to reduce the audio playback delay to solve the problem of audio and picture asynchrony; 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 improving the user experience.

[0309] For example, when a user is holding a conference call in a meeting room, the user usually uses the microphone of the mobile phone to collect the sound and uses the speaker of the large-screen device to play the sound. Figure 4 The original data path used by the audio playback system shown has a certain delay, and echo usually occurs, so 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 improving the user experience.

[0310] 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, the first playback request carrying first audio data of the first audio and a device identification of a second electronic device; according to the first playback request, the first audio data is written to a unique cache address by calling a 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.

[0311] Fig.15 The first electronic device 700 is a schematic diagram of a 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 audio playback method. To avoid repetition, it is not described in detail here. The first electronic device 700 includes: a first processing unit 701 and a first transceiver unit 702.

[0312] 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, wherein 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 unique cache address of the first audio data during the process of transmitting the first audio data from the first application to the second electronic device.

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

[0314] 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.

[0315] 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, wherein the second playback request carries second audio data of the second audio and a device identifier 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.

[0316] Optionally, the first output device comprises a speaker.

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

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

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

[0320] Fig.16 The second electronic device 800 is a schematic diagram of a 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 execute each step of the second electronic device in the above audio playback method. To avoid repetition, it is not described in detail here. The second electronic device 800 includes: a second transceiver unit 801 and a second processing unit 802.

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

[0322] The second processing unit 802 is used to output 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.

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

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

[0325] Optionally, the second output device comprises a speaker.

[0326] 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 functions. The hardware circuit may include an application specific integrated circuit (ASIC), an electronic circuit, a processor (such as a shared processor, a proprietary processor, or a group processor, etc.) and a memory for executing one or more software or firmware programs, a merged logic circuit, and / or other suitable components that support the described functions.

[0327] Therefore, the units of each example described in the embodiments of the present invention can be implemented by electronic hardware, or a combination of 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. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0328] The 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 execute the functions / steps in the above method embodiment.

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

[0330] The embodiment of the present application also provides a computer program product comprising instructions, and 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 embodiment.

[0331] In the embodiments of the present application, "at least one" refers to one or more, and "plurality" 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 subsequent 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.

[0332] Those of ordinary skill in the art will appreciate that the various units and algorithm steps described in the embodiments disclosed herein can be implemented in 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. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0333] Those skilled in the art can 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.

[0334] In several embodiments provided in the present application, any function can be stored in a computer-readable storage medium if it is implemented in the form of a software functional unit and sold or used as an independent product. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for enabling an electronic device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present 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.

[0335] The above is only a specific implementation of the present application. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. The protection scope of the present application should be based on the protection scope 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

Cited By

  • Audio playing system and method and electronic device

    EP4579661A1

  • Audio playing system and method and electronic device

    WO2024174782A1

  • Audio playback time adjustment method and electronic device

    WO2026092107A1