An audio output control method and related device
By establishing a correspondence between the audio playback device and the target audio source in the audio output control method, and identifying and transmitting the target audio track input, the problem that the Android system audio framework only supports a single audio output is solved. This enables the independent processing and transmission of multiple audio sources, satisfying the flexibility and multi-device support of in-vehicle audio transmission.
Patent Information
- Application Number
- CN202511154887.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-18
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2045-08-18
AI Technical Summary
The existing Android system audio framework only supports a single audio output, which cannot meet the increasingly complex needs of in-vehicle audio transmission.
An audio output control method is constructed, which establishes a correspondence between audio playback devices and target audio sources, identifies and transmits target audio tracks to the corresponding audio playback devices, supports independent processing and transmission of multiple audio sources, and outputs the audio after mixing using AudioMixer.
It enables independent processing and transmission of multiple audio sources, avoiding mixing interference between audio sources and meeting the needs of flexible in-vehicle audio transmission and multi-device support.
Smart Images

Figure CN120658985B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of audio transmission technology, and more specifically, to an audio output control method and related equipment. Background Technology
[0002] With the development of modern technology, audio transmission technology plays an increasingly important role in in-vehicle entertainment systems, wireless audio devices, and multi-device collaboration scenarios. Especially in the driving environment, users have higher demands for audio transmission quality, flexibility, and multi-device support. However, due to design limitations, the existing Android system audio framework only supports a single audio output, which cannot meet the increasingly complex needs of in-vehicle audio transmission. Summary of the Invention
[0003] The technical problem to be solved by the present invention is to provide an audio output control method and related equipment, addressing the aforementioned technical deficiencies of the prior art.
[0004] The technical solution adopted by this invention to solve its technical problem is: to construct an audio output control method, applied to a terminal device, wherein the control method includes:
[0005] Establish the correspondence between the first audio playback device and the first target audio source;
[0006] Obtain the audio track input corresponding to all audio sources in the terminal device, identify all audio track inputs, and obtain the first target audio track input corresponding to the first target audio source according to the correspondence relationship;
[0007] According to the correspondence, the first target audio track is transmitted to the first audio playback device so that the audio data corresponding to the first target audio source can be output through the first audio playback device.
[0008] Preferably, in one embodiment of the audio output control method of the present invention, the control method further includes:
[0009] The second target audio track input corresponding to the second target audio source is obtained from the audio track input corresponding to all audio sources. The second target audio track input is mixed based on AudioMixer and then input to the second audio playback device so as to output the audio data corresponding to the second target audio source through the second audio playback device.
[0010] Preferably, in one embodiment of the audio output control method of the present invention, the second target audio track input includes:
[0011] One or more of the remaining audio track inputs after removing the first target audio track input from all audio track inputs; and / or
[0012] At least one of the first target audio tracks is input.
[0013] Preferably, in one embodiment of the audio output control method of the present invention, the number of the first audio playback devices is one or more, the number of the first target sound sources is one or more, and the correspondence includes the correspondence between one or more first audio playback devices and one or more first target sound sources.
[0014] Preferably, in one embodiment of the audio output control method of the present invention, the first audio playback device is a Bluetooth device; the step of transmitting the first target audio track input to the first audio playback device according to the correspondence includes:
[0015] The first target audio track is transmitted to the Bluetooth protocol stack via the IPC link corresponding to the Bluetooth device, so that the Bluetooth protocol stack distributes the first target audio track to the Bluetooth device according to the correspondence.
[0016] Preferably, in one embodiment of the audio output control method of the present invention, establishing the correspondence between the first audio playback device and the first target audio source includes:
[0017] When the first audio playback device is connected to the terminal device, a correspondence between the first audio playback device and the first target audio source is established based on the identification information of the first audio playback device and the APP corresponding to the first target audio source.
[0018] Preferably, in one embodiment of the audio output control method of the present invention, establishing the correspondence between the first audio playback device and the first target audio source includes:
[0019] When the APP corresponding to the first target audio source is triggered, the correspondence between the first audio playback device and the first target audio source is set.
[0020] Preferably, in one embodiment of the audio output control method of the present invention, the step of identifying all audio track inputs to obtain the first target audio track input corresponding to the first target audio source according to the correspondence relationship includes:
[0021] Obtain the application UIDs corresponding to all audio track inputs, and obtain the first target audio track input based on the application UIDs corresponding to the audio track inputs and the correspondence, wherein the correspondence includes the application UIDs corresponding to the first target audio source.
[0022] The present invention also provides an electronic device comprising: a module for performing the methods described above.
[0023] The present invention also provides an electronic device comprising a memory and a processor;
[0024] The memory is used to store computer programs;
[0025] The processor is used to execute the computer program to implement the method described above.
[0026] The audio output control method and related equipment of the present invention have the following advantages: they can realize the independent processing and transmission of audio corresponding to multiple audio sources, and avoid mixing interference between audio sources. Attached Figure Description
[0027] The present invention will be further described below with reference to the accompanying drawings and embodiments. In the accompanying drawings:
[0028] Figure 1 This is a flowchart of an embodiment of an audio output control method according to the present invention;
[0029] Figure 2 This is a flowchart of another embodiment of an audio output control method of the present invention;
[0030] Figure 3 This is a schematic diagram of the signal flow in an embodiment of an audio output control method of the present invention;
[0031] Figure 4 This is a schematic diagram of the signal flow of another embodiment of an audio output control method of the present invention. Detailed Implementation
[0032] To provide a clearer understanding of the technical features, objectives, and effects of the present invention, specific embodiments of the present invention will now be described in detail with reference to the accompanying drawings.
[0033] like Figure 1 The image illustrates one embodiment of an audio output control method according to the present invention. This method is primarily used in terminal devices to achieve relative independence of audio playback for multiple applications, such as apps, within the terminal device. Figure 1 In an embodiment of the audio output control method of the present invention shown, the method includes the following steps: S1, establishing a correspondence between a first audio playback device and a first target audio source; S2, acquiring the audio track inputs corresponding to all audio sources in the terminal device, identifying all audio track inputs to acquire the first target audio track input corresponding to the first target audio source according to the correspondence; S3, transmitting the first target audio track input to the first audio playback device according to the correspondence, so as to output the audio data corresponding to the first target audio source through the first audio playback device.
[0034] In step S1, the first audio playback device is used to play the specific audio from the terminal device, namely the audio corresponding to the first target audio source. This allows the first target audio source to be played independently through the first audio playback device without mixing, ensuring the independence of the playback process. Throughout this process, it is necessary to first establish the correspondence between the first audio playback device and the first target audio source. It can be understood that the audio source in the terminal device generates corresponding audio data based on the use of the APP (hereinafter referred to as APP sound), meaning that the audio source in the terminal device and the APP form a one-to-one correspondence.
[0035] Based on step S1, in one embodiment, establishing the correspondence between the first audio playback device and the first target sound source includes: when the first audio playback device connects to the terminal device, establishing the correspondence between the first audio playback device and the first target sound source based on the identification information of the first audio playback device and the APP corresponding to the first target sound source. Based on this embodiment, when the first audio playback device establishes a communication connection with the terminal device, the correspondence between the first audio playback device and the APP on the terminal device is established. Because the sound source corresponds to the APP, the correspondence between the first audio playback device and the first target sound source can be obtained. For example, when the first audio playback device is headphones, when the headphones establish a connection with the terminal device, a prompt message can be generated based on all the APPs already installed on the terminal device, allowing the user to select the APP sound that the headphones can play. This obtains the correspondence between the first audio playback device and the selected APP on the terminal device, which can be further understood as obtaining the correspondence between the first audio playback device and the first target sound source. This process can establish a relatively stable correspondence between a specific user and a specific APP, reducing the user's operation process. In one embodiment, the identification information of the first audio playback device can be the device information of the audio playback device. For example, when the first audio playback device is a Bluetooth device, the identification information can be the MAC address of the Bluetooth device.
[0036] In one embodiment, a correspondence between the first audio playback device and the first target sound source can also be established based on the location identification information of the first audio playback device. This establishes a correspondence between a user at a specific location and a specific app. For example, a correspondence can be established between a user in the driver's seat and a road navigation app, ensuring that the user in the driver's seat can always hear the sound corresponding to the navigation app.
[0037] Based on step S1, in another embodiment, establishing the correspondence between the first audio playback device and the first target sound source includes: setting the correspondence between the first audio playback device and the first target sound source when the APP corresponding to the first target sound source is triggered. That is, when the APP on the terminal device is triggered and launched, the user can manually set the correspondence between the APP and the first audio playback device. Because the sound source corresponds to the APP, the correspondence between the first audio playback device and the first target sound source can be obtained. For example, a prompt message can be generated when the APP is triggered, allowing the user to determine whether the APP corresponds to the first target sound source, and establishing the correspondence between the APP and the first audio playback device based on the first audio playback device connected to the terminal device, thereby obtaining the correspondence between the first audio playback device and the first target sound source. In a specific embodiment, when an APP is triggered for the first time, the correspondence between the APP and the headphones can be set according to the connection status between the terminal device and the headphones, meaning the user can decide whether the sound corresponding to the APP is output by the headphones or which headphones. This process makes the establishment of the correspondence between the first audio playback device and the first target sound source more flexible.
[0038] In one embodiment, the correspondence between the first audio playback device and the first target audio source can also be obtained based on historical settings. That is, after setting the correspondence between the first audio playback device and the first target audio source based on the above process, when there are no changes in the application on the first audio playback device and the terminal device, the latest correspondence between the first audio playback device and the first target audio source can be obtained based on the historically set correspondence. In one embodiment, a prompt message can also be generated at an appropriate time to prompt the user whether the above historical settings need to be used, or to prompt for updating the above historical settings when the APP on the first audio playback device or the terminal device changes.
[0039] Based on step S2, in the terminal device, each APP can send audio data to the audio system through the audio track at the application layer. That is, the audio data corresponding to each sound source is formed into an audio track input through the audio track and input to AudioFlinger. Before the AudioMixer in AudioFlinger performs mixing, the first target audio track input is identified. Since the first target sound source is essentially known, and there is a one-to-one correspondence between the first target sound source and the audio track input, the first target audio track input can be identified according to the set correspondence.
[0040] Based on step S3, after obtaining the first target audio track input, the first target audio track input and the first audio playback device can be directly established according to the established correspondence between the first audio playback device and the first target audio source, so that the data transmission relationship between the first target audio track input and the first audio playback device can be established, and finally the audio data corresponding to the first target audio source can be output through the first audio playback device.
[0041] like Figure 2 As shown, in one embodiment of the audio output control method of the present invention, it further includes: S4, obtaining the second target audio track input corresponding to the second target audio source from the audio track inputs corresponding to all audio sources, mixing the second target audio track input based on AudioMixer, and then inputting it to the second audio playback device, so as to output the audio data corresponding to the second target audio source through the second audio playback device. Specifically, while playing the audio data of some audio sources separately through the first audio playback device, it is also possible to judge the audio data corresponding to all audio sources, identify the second target audio track input corresponding to the second target audio source, mix all the second target audio track inputs through AudioMixer, and finally play the audio data of the audio source corresponding to the second target audio track input, i.e., the second target audio source, through the second audio playback device.
[0042] In this embodiment, a correspondence can also exist between the second target audio source and the second audio playback device. This correspondence can be established by referring to the process of establishing the correspondence between the first audio playback device and the first target audio source. For example, in one embodiment, when the second audio playback device connects to the terminal device, a correspondence between the second audio playback device and the second target audio source is established based on the identification information of the second audio playback device and the APP corresponding to the second target audio source. That is, in this embodiment, when the second audio playback device establishes a communication connection with the terminal device, a correspondence between the second audio playback device and the APP in the terminal device is established. Because the audio source corresponds to the APP, the correspondence between the second audio playback device and the second target audio source can be obtained. In another embodiment, the correspondence between the second audio playback device and the second target audio source is set when the APP corresponding to the second target audio source is triggered. That is, when the APP in the terminal device is triggered and launched, the user can manually set the correspondence between the APP and the second audio playback device. Because the audio source corresponds to the APP, the correspondence between the second audio playback device and the second target audio source can be obtained. In one specific embodiment, a prompt message can be generated when the APP is triggered, allowing the user to determine whether the APP corresponds to the second target audio source. A correspondence between the APP and the second audio playback device is established based on the second audio playback device connected to the terminal device, thereby obtaining the correspondence between the second audio playback device and the second target audio source. In another embodiment, the correspondence between the second audio playback device and the second target audio source can also be obtained based on historical settings. That is, after setting the correspondence between the second audio playback device and the second target audio source based on the above process, if the application on the second audio playback device and the terminal device remains unchanged, the latest correspondence between the second audio playback device and the second target audio source can be obtained based on the historically set correspondence. In one embodiment, a prompt message can also be generated at an appropriate time to prompt the user whether the above historical settings need to be used, or to prompt for updating the above historical settings when the APP on the second audio playback device or the terminal device changes.
[0043] Optionally, in one embodiment of the audio output control method of the present invention, the second target audio track input includes: one or more of the remaining audio track inputs after removing the first target audio track input from all audio track inputs; and / or at least one first target audio track input. Specifically, all audio sources can be played separately, that is, after playing the audio data corresponding to some audio sources, i.e., the audio data corresponding to the first target audio track input, through the first audio playback device, one or more of the remaining audio data corresponding to the audio sources can be mixed by AudioMixer and then played through the second audio playback device. Alternatively, during the above mixing process, some or all of the audio data corresponding to the first target audio track input can be mixed together by AudioMixer and then played through the second audio playback device.
[0044] In one embodiment, identifying all audio track inputs to obtain the first target audio track input corresponding to the first target audio source based on a correspondence includes: obtaining the application UIDs corresponding to all audio track inputs, and obtaining the first target audio track input based on the application UIDs corresponding to the audio track inputs and the correspondence, wherein the correspondence includes the application UID corresponding to the first target audio source. That is, based on the above process, when establishing the correspondence between the first audio playback device and the first target audio source, the application UID corresponding to the first target audio source is obtained based on the APP corresponding to the first target audio source, so as to establish the correspondence between the first audio playback device and the first target audio source through the application UID corresponding to the first target audio source. During the process of obtaining the first target audio track input based on the audio track inputs corresponding to all audio sources, the first target audio track input can be selected from all audio track inputs based on the application UID of the audio track input corresponding to the first target audio source, i.e., the first target audio track input.
[0045] In one specific embodiment, the number of first audio playback devices is one or more, and the number of first target audio sources is one or more; the correspondence between the first audio playback devices and the first target audio sources includes the correspondence between one or more first audio playback devices and one or more first target audio sources.
[0046] That is, the first audio playback device that establishes a connection with the terminal device can be one or more, and the number of first target audio sources can also be one or more. When there is one first audio playback device and one first target audio source, the first target audio source is directly selected for the first audio playback device, thus establishing a correspondence between the first audio playback device and the first target audio source. When there is one first audio playback device and multiple first target audio sources, the audio data corresponding to multiple first target audio sources can be output simultaneously through the first audio playback device. When there is one first target audio source and multiple first audio playback devices, the audio data corresponding to the first target audio source can be output through one or more first audio playback devices. When there are multiple first target audio sources and multiple first audio playback devices, it can be set that the audio data corresponding to one or more first target audio sources can be output simultaneously through the same first audio playback device, that is, setting some first audio playback devices to simultaneously play the audio data corresponding to one or more first target audio sources. For example, the number of apps installed on the terminal device can be multiple, and the audio of some apps can be played through the same headphones, that is, the audio of multiple apps can be processed, for example, mixed via Bluetooth, and then output to the headphones. It is also possible to configure multiple first target sound sources to have their audio data played through different first audio playback devices, meaning that some first audio playback devices can play audio data corresponding to different first target sound sources. For example, there can be multiple apps installed on the terminal device, and each app's sound can be played through different headphones, meaning that multiple different headphones can play different app sounds. In one specific embodiment, multiple app sounds can correspond to multiple headphones, for example, one app corresponds to headphone A, and another app corresponds to headphone B.
[0047] In one embodiment, the first audio playback device is a Bluetooth device. Transmitting the first target audio track input to the first audio playback device according to a mapping relationship includes: transmitting the first target audio track input to the Bluetooth protocol stack via an IPC link corresponding to the Bluetooth device, so that the Bluetooth protocol stack distributes the first target audio track input to the Bluetooth device according to the mapping relationship. Specifically, the first audio playback device is a Bluetooth device that establishes a communication connection with the terminal device, such as a Bluetooth headset or a Bluetooth speaker. The Bluetooth device can establish a mapping relationship with the first target audio source based on its corresponding device identifier, such as a MAC address. Upon receiving the first target audio track input, AudioFlinger transmits all the first target audio track inputs to the Bluetooth protocol stack in the terminal device via the IPC link corresponding to the Bluetooth device. The Bluetooth protocol stack then distributes the first target audio track input according to the mapping relationship between the first audio playback device and the first target audio source, so that the first audio playback device plays the audio data corresponding to the first target audio source.
[0048] like Figure 3 As shown, in one embodiment, some of the APP's corresponding audio track inputs enter the Bluetooth stack before mixing and are output through the Bluetooth stack. After all the audio track inputs enter AudioMixer for mixing, the mixed audio output is transmitted to AudioPolicy. AudioPolicyManager selects the appropriate output device according to the current audio policy (such as device connection status, audio type, user settings, etc.).
[0049] like Figure 4 As shown, in one embodiment, the audio track input entering the Bluetooth protocol stack is distributed to the corresponding Bluetooth device (different headphones) for output through the Bluetooth protocol stack.
[0050] Furthermore, an electronic device of the present invention has the function of implementing the corresponding steps performed in the above-described method. Each function can be implemented by hardware or by hardware executing corresponding software. The corresponding hardware or software includes one or more modules corresponding to the above-described functions. That is, the steps in the above-described method are executed by one or more modules respectively. The specific cooperative operation between the modules can be referred to the specific process of the above-described method, and will not be repeated here.
[0051] Furthermore, an electronic device according to the present invention may further include a memory and a processor; the memory is used to store a computer program; the processor is used to execute the computer program to implement the above-described method. Specifically, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, when the computer program is downloaded, installed, and executed by an electronic device, it performs the functions defined in the methods of the embodiments of the present invention. The electronic device in the present invention may be a terminal such as a laptop, desktop computer, tablet computer, or smartphone, or it may be a server.
[0052] This electronic device can be an in-vehicle device. Based on the above embodiments, the in-vehicle device can achieve the following functions: audio separation for the driver and passengers. The driver can receive navigation audio through a Bluetooth headset, while the passenger can enjoy high-quality music playback through the in-vehicle Bluetooth speaker. It can also support simultaneous connection of multiple Bluetooth devices, such as the driver's mobile phone, the passenger's tablet, and the in-vehicle speaker, to achieve independent transmission of multiple audio streams.
[0053] It is understood that the above embodiments only illustrate preferred embodiments of the present invention, and their descriptions are relatively specific and detailed, but they should not be construed as limiting the scope of the present invention. It should be noted that those skilled in the art can freely combine the above technical features without departing from the concept of the present invention, and can also make several modifications and improvements, all of which fall within the protection scope of the present invention. Therefore, all equivalent transformations and modifications made with respect to the scope of the claims of the present invention should fall within the scope of the claims of the present invention.
Claims
1. An audio output control method, characterized in that, The control method, applied to terminal devices, includes: Establish the correspondence between the first audio playback device and the first target audio source; Obtain the audio track input corresponding to all audio sources in the terminal device, identify all audio track inputs, and obtain the first target audio track input corresponding to the first target audio source according to the correspondence relationship; According to the correspondence, the first target audio track is transmitted to the first audio playback device so that the audio data corresponding to the first target audio source can be output through the first audio playback device; The second target audio track input corresponding to the second target audio source is obtained from the audio track input corresponding to all audio sources. The second target audio track input is mixed based on AudioMixer and then input to the second audio playback device so that the audio data corresponding to the second target audio source can be output through the second audio playback device. Wherein, the second target audio track input includes: one or more of the remaining audio track inputs after removing the first target audio track input from all audio track inputs; and / or at least one of the first target audio track inputs; The establishment of the correspondence between the first audio playback device and the first target audio source includes: When the first audio playback device is connected to the terminal device, a correspondence between the first audio playback device and the first target audio source is established based on the identification information of the first audio playback device and the APP corresponding to the first target audio source; and / or When the APP corresponding to the first target audio source is triggered, the correspondence between the first audio playback device and the first target audio source is set.
2. The audio output control method according to claim 1, characterized in that, The number of the first audio playback devices is one or more, and the number of the first target audio sources is one or more; The correspondence includes the correspondence between one or more of the first audio playback devices and one or more of the first target audio sources.
3. The audio output control method according to claim 1, characterized in that, The first audio playback device is a Bluetooth device; the step of transmitting the first target audio track to the first audio playback device according to the correspondence includes: The first target audio track is transmitted to the Bluetooth protocol stack via the IPC link corresponding to the Bluetooth device, so that the Bluetooth protocol stack distributes the first target audio track to the Bluetooth device according to the correspondence.
4. The audio output control method according to claim 1, characterized in that, The step of identifying all audio track inputs to obtain the first target audio track input corresponding to the first target audio source according to the correspondence relationship includes: Obtain the application UIDs corresponding to all audio track inputs, and obtain the first target audio track input based on the application UIDs corresponding to the audio track inputs and the correspondence, wherein the correspondence includes the application UIDs corresponding to the first target audio source.
5. An electronic device, characterized in that, The electronic device includes a module for performing the method as described in any one of claims 1 to 4.
6. An electronic device, characterized in that, Including memory and processor; The memory is used to store computer programs; The processor is used to execute the computer program to implement the method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Audio playing method, device and terminal
CN102768846A