基于Android11简单分析audio_policy_configuration.xml

news/2024/12/21 22:18:28/

 开篇先贴上一个高通的例子,后续基于此文件做具体分析。

1 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2 <!-- Copyright (c) 2016-2019, The Linux Foundation. All rights reserved
3      Not a Contribution.
4 -->
5 <!-- Copyright (C) 2015 The Android Open Source Project
6 
7      Licensed under the Apache License, Version 2.0 (the "License");
8      you may not use this file except in compliance with the License.
9      You may obtain a copy of the License at
10 
11           http://www.apache.org/licenses/LICENSE-2.0
12 
13      Unless required by applicable law or agreed to in writing, software
14      distributed under the License is distributed on an "AS IS" BASIS,
15      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16      See the License for the specific language governing permissions and
17      limitations under the License.
18 -->
19 
20 <audioPolicyConfiguration version="1.0" xmlns:xi="http://www.w3.org/2001/XInclude">
21     <!-- version section contains a “version” tag in the form “major.minor” e.g version=”1.0” -->
22 
23     <!-- Global configuration Decalaration -->
24     <globalConfiguration speaker_drc_enabled="true"/>
25 
26     <!-- Modules section:
27         There is one section per audio HW module present on the platform.
28         Each module section will contains two mandatory tags for audio HAL “halVersion” and “name”.
29         The module names are the same as in current .conf file:
30                 “primary”, “A2DP”, “remote_submix”, “USB”
31         Each module will contain the following sections:
32         “devicePorts”: a list of device descriptors for all input and output devices accessible via this
33         module.
34         This contains both permanently attached devices and removable devices.
35             "gain": constraints applied to the millibel values:
36                 - maxValueMB >= minValueMB
37                 - defaultValueMB >= minValueMB && defaultValueMB <= maxValueMB
38                 - (maxValueMB - minValueMB) % stepValueMB == 0
39                 - (defaultValueMB - minValueMB) % stepValueMB == 0
40         “mixPorts”: listing all output and input streams exposed by the audio HAL
41         “routes”: list of possible connections between input and output devices or between stream and
42         devices.
43             "route": is defined by an attribute:
44                 -"type": <mux|mix> means all sources are mutual exclusive (mux) or can be mixed (mix)
45                 -"sink": the sink involved in this route
46                 -"sources": all the sources than can be connected to the sink via vis route
47         “attachedDevices”: permanently attached devices.
48         The attachedDevices section is a list of devices names. The names correspond to device names
49         defined in <devicePorts> section.
50         “defaultOutputDevice”: device to be used by default when no policy rule applies
51     -->
52     <modules>
53         <!-- Primary Audio HAL -->
54         <module name="primary" halVersion="3.0">
55             <attachedDevices>
56                 <item>Media Bus</item>
57                 <item>Sys Notification Bus</item>
58                 <item>Nav Guidance Bus</item>
59                 <item>Phone Bus</item>
60                 <item>Tts Bus</item>
61                 <item>Vr Tts Bus</item>
62                 <item>Boot Music Bus</item>
63                 <item>Chime Tts Bus</item>
64                 <item>BT Codriver Bus</item>
65                 <item>Projection Vr Tts Bus</item>
66                 <item>Ringtone Bus</item>
67                 <item>Built-In Mic</item>
68                 <item>Built-In Back Mic</item>
69                 <item>FM Tuner</item>
70                 <item>Speaker</item>
71                 <item>Projection Vr Bus In</item>
72                 <item>Projection Phone Bus In</item>
73                 <item>Local Vr Bus In</item>
74                 <item>Projection Esiri Bus In</item>
75             </attachedDevices>
76             <defaultOutputDevice>Media Bus</defaultOutputDevice>
77             <mixPorts>
78                 <mixPort name="media" role="source"
79                          flags="AUDIO_OUTPUT_FLAG_PRIMARY">
80                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
81                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
82                 </mixPort>
83                 <mixPort name="sys_notification" role="source">
84                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
85                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
86                 </mixPort>
87                 <mixPort name="nav_guidance" role="source">
88                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
89                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
90                 </mixPort>
91                 <mixPort name="phone" role="source">
92                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
93                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
94                 </mixPort>
95                 <mixPort name="tts" role="source">
96                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
97                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
98                 </mixPort>
99                 <mixPort name="vr_tts" role="source">
100                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
101                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
102                 </mixPort>
103                 <mixPort name="boot_music" role="source">
104                     <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
105                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
106                 </mixPort>
107                 <mixPort name="chime_tts" role="source">
108                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
109                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
110                 </mixPort>
111                 <mixPort name="bt_codriver" role="source"
112                          flags="AUDIO_OUTPUT_FLAG_RIGHT_ZONE">
113                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
114                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
115                 </mixPort>
116                 <mixPort name="primary output" role="source" flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY">
117                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
118                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
119                 </mixPort>
120                 <mixPort name="raw" role="source"
121                         flags="AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_RAW">
122                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
123                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
124                 </mixPort>
125                 <mixPort name="deep_buffer" role="source"
126                         flags="AUDIO_OUTPUT_FLAG_DEEP_BUFFER">
127                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
128                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
129                 </mixPort>
130                 <mixPort name="mmap_no_irq_out" role="source" flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_MMAP_NOIRQ">
131                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
132                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
133                 </mixPort>
134                 <mixPort name="hifi_playback" role="source" />
135                 <mixPort name="compress_passthrough" role="source"
136                         flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
137                     <profile name="" format="dynamic"
138                              samplingRates="dynamic" channelMasks="dynamic"/>
139                 </mixPort>
140                 <mixPort name="direct_pcm" role="source"
141                         flags="AUDIO_OUTPUT_FLAG_DIRECT">
142                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
143                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
144                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
145                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
146                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
147                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
148                     <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
149                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
150                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
151                   <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
152                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
153                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
154                 </mixPort>
155 
156                 <mixPort name="bt_codriver_direct_pcm" role="source"
157                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_RIGHT_ZONE">
158                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
159                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
160                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
161                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
162                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
163                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
164                     <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
165                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
166                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
167                   <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
168                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000,352800,384000"
169                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
170                 </mixPort>
171                 <mixPort name="compressed_offload" role="source"
172                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
173                     <profile name="" format="AUDIO_FORMAT_MP3"
174                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
175                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
176                     <profile name="" format="AUDIO_FORMAT_FLAC"
177                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
178                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
179                     <profile name="" format="AUDIO_FORMAT_ALAC"
180                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
181                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
182                     <profile name="" format="AUDIO_FORMAT_APE"
183                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
184                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
185                     <profile name="" format="AUDIO_FORMAT_AAC_LC"
186                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
187                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
188                     <profile name="" format="AUDIO_FORMAT_AAC_HE_V1"
189                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
190                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
191                     <profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
192                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
193                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
194                     <profile name="" format="AUDIO_FORMAT_DTS"
195                              samplingRates="32000,44100,48000"
196                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1"/>
197                     <profile name="" format="AUDIO_FORMAT_DTS_HD"
198                              samplingRates="32000,44100,48000,64000,88200,96000,128000,176400,192000"
199                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
200                     <profile name="" format="AUDIO_FORMAT_WMA"
201                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
202                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
203                     <profile name="" format="AUDIO_FORMAT_WMA_PRO"
204                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
205                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
206                     <profile name="" format="AUDIO_FORMAT_VORBIS"
207                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
208                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
209                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
210                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
211                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
212                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V1"
213                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
214                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
215                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V2"
216                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
217                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
218                 </mixPort>
219 
220                 <mixPort name="bt_codriver_offload" role="source"
221                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING|AUDIO_OUTPUT_FLAG_RIGHT_ZONE">
222                     <profile name="" format="AUDIO_FORMAT_MP3"
223                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
224                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
225                     <profile name="" format="AUDIO_FORMAT_FLAC"
226                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
227                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
228                     <profile name="" format="AUDIO_FORMAT_ALAC"
229                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
230                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
231                     <profile name="" format="AUDIO_FORMAT_APE"
232                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
233                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
234                     <profile name="" format="AUDIO_FORMAT_AAC_LC"
235                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
236                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
237                     <profile name="" format="AUDIO_FORMAT_AAC_HE_V1"
238                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
239                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
240                     <profile name="" format="AUDIO_FORMAT_AAC_HE_V2"
241                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
242                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
243                     <profile name="" format="AUDIO_FORMAT_DTS"
244                              samplingRates="32000,44100,48000"
245                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1"/>
246                     <profile name="" format="AUDIO_FORMAT_DTS_HD"
247                              samplingRates="32000,44100,48000,64000,88200,96000,128000,176400,192000"
248                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
249                     <profile name="" format="AUDIO_FORMAT_WMA"
250                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
251                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
252                     <profile name="" format="AUDIO_FORMAT_WMA_PRO"
253                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
254                              channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_2POINT1,AUDIO_CHANNEL_OUT_QUAD,AUDIO_CHANNEL_OUT_PENTA,AUDIO_CHANNEL_OUT_5POINT1,AUDIO_CHANNEL_OUT_6POINT1,AUDIO_CHANNEL_OUT_7POINT1"/>
255                     <profile name="" format="AUDIO_FORMAT_VORBIS"
256                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000,128000,176400,192000"
257                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
258                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_LC"
259                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
260                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
261                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V1"
262                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
263                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
264                     <profile name="" format="AUDIO_FORMAT_AAC_ADTS_HE_V2"
265                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,64000,88200,96000"
266                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
267                 </mixPort>
268                 <mixPort name="dsd_compress_passthrough" role="source"
269                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD|AUDIO_OUTPUT_FLAG_NON_BLOCKING">
270                     <profile name="" format="AUDIO_FORMAT_DSD"
271                              samplingRates="2822400,5644800"
272                              channelMasks="AUDIO_CHANNEL_OUT_STEREO,AUDIO_CHANNEL_OUT_MONO"/>
273                 </mixPort>
274                 <mixPort name="voice_tx" role="source">
275                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
276                              samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
277                 </mixPort>
278                 <mixPort name="voip_rx" role="source"
279                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_VOIP_RX">
280                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
281                              samplingRates="8000,16000,32000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
282                 </mixPort>
283                 <mixPort name="projection_vr_downlink" role="source">
284                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
285                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
286                 </mixPort>
287                 <mixPort name="projection_phone_downlink" role="source"
288                          flags="AUDIO_OUTPUT_FLAG_DIRECT|AUDIO_OUTPUT_FLAG_DIRECT_PROJECTION">
289                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
290                              samplingRates="8000,16000,24000,32000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
291                 </mixPort>
292                 <mixPort name="ringtone" role="source">
293                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
294                              samplingRates="16000,44100,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
295                 </mixPort>
296 
297                 <mixPort name="primary input" role="sink" maxOpenCount="2" maxActiveCount="2">
298                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
299                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
300                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_INDEX_MASK_7"/>
301                 </mixPort>
302                 <mixPort name="surround_sound" role="sink">
303                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
304                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
305                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_IN_5POINT1,AUDIO_CHANNEL_INDEX_MASK_6"/>
306                 </mixPort>
307                 <mixPort name="record_24" role="sink">
308                     <profile name="" format="AUDIO_FORMAT_PCM_24_BIT_PACKED"
309                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
310                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
311                     <profile name="" format="AUDIO_FORMAT_PCM_8_24_BIT"
312                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000,96000,192000"
313                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3,AUDIO_CHANNEL_INDEX_MASK_4"/>
314                 </mixPort>
315                 <mixPort name="voice_rx" role="sink">
316                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
317                              samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
318                 </mixPort>
319                 <mixPort name="mmap_no_irq_in" role="sink" flags="AUDIO_INPUT_FLAG_MMAP_NOIRQ">
320                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
321                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
322                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_3"/>
323                 </mixPort>
324                 <mixPort name="projection_vr_uplink" role="sink" flags="AUDIO_INPUT_FLAG_PROJECTION_VR">
325                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
326                              samplingRates="8000,16000,24000"
327                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
328                 </mixPort>
329                 <mixPort name="projection_phone_uplink" role="sink" flags="AUDIO_INPUT_FLAG_PROJECTION_PHONE">
330                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
331                              samplingRates="8000,16000,24000,32000,48000"
332                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
333                 </mixPort>
334                 <mixPort name="local_vr_uplink" role="sink" flags="AUDIO_INPUT_FLAG_LOCAL_VR">
335                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
336                              samplingRates="16000"
337                              channelMasks="AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_INDEX_MASK_7"/>
338                 </mixPort>
339                 <mixPort name="projection_esiri_uplink" role="sink">
340                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
341                              samplingRates="16000"
342                              channelMasks="AUDIO_CHANNEL_INDEX_MASK_7,AUDIO_CHANNEL_INDEX_MASK_8"/>
343                 </mixPort>
344             </mixPorts>
345 
346             <devicePorts>
347                 <!-- Output devices declaration, i.e. Sink DEVICE PORT -->
348                 <devicePort tagName="Media Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
349                         address="BUS00_MEDIA">
350                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
351                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
352                     <gains>
353                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
354                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
355                     </gains>
356                 </devicePort>
357                 <devicePort tagName="Sys Notification Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
358                         address="BUS01_SYS_NOTIFICATION">
359                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
360                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
361                     <gains>
362                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
363                                 minValueMB="-7800" maxValueMB="-4800" defaultValueMB="-4800" stepValueMB="3000"/>
364                     </gains>
365                 </devicePort>
366                 <devicePort tagName="Nav Guidance Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
367                         address="BUS02_NAV_GUIDANCE">
368                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
369                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
370                     <gains>
371                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
372                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
373                     </gains>
374                 </devicePort>
375                 <devicePort tagName="Phone Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
376                         address="BUS03_PHONE">
377                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
378                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
379                     <gains>
380                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
381                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
382                     </gains>
383                 </devicePort>
384                 <devicePort tagName="Tts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
385                         address="BUS04_TTS">
386                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
387                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
388                     <gains>
389                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
390                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
391                     </gains>
392                 </devicePort>
393                 <devicePort tagName="Vr Tts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
394                         address="BUS05_VR_TTS">
395                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
396                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
397                     <gains>
398                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
399                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
400                     </gains>
401                 </devicePort>
402                 <devicePort tagName="Boot Music Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
403                         address="BUS07_BOOT_MUSIC">
404                     <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
405                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
406                     <gains>
407                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
408                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
409                     </gains>
410                 </devicePort>
411                 <devicePort tagName="Chime Tts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
412                         address="BUS08_CHIME_TTS">
413                     <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
414                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
415                     <gains>
416                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
417                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
418                     </gains>
419                 </devicePort>
420                 <devicePort tagName="BT Codriver Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
421                         address="BUS09_BT_CODRIVER">
422                     <profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
423                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
424                     <gains>
425                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
426                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
427                     </gains>
428                 </devicePort>
429                 <devicePort tagName="Projection Vr Tts Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
430                         address="BUS11_PROJECTION_VR_TTS">
431                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
432                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
433                     <gains>
434                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
435                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
436                     </gains>
437                 </devicePort>
438                 <devicePort tagName="Ringtone Bus" role="sink" type="AUDIO_DEVICE_OUT_BUS"
439                         address="BUS12_RINGTONE">
440                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
441                              samplingRates="16000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
442                     <gains>
443                         <gain name="" mode="AUDIO_GAIN_MODE_JOINT"
444                                 minValueMB="-7800" maxValueMB="0" defaultValueMB="-5800" stepValueMB="200"/>
445                     </gains>
446                 </devicePort>
447                 <devicePort tagName="Earpiece" type="AUDIO_DEVICE_OUT_EARPIECE" role="sink">
448                    <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
449                             samplingRates="48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
450                 </devicePort>
451                 <devicePort tagName="Speaker" role="sink" type="AUDIO_DEVICE_OUT_SPEAKER" address="">
452                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
453                              samplingRates="8000,16000,24000,32000,48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
454                 </devicePort>
455                 <devicePort tagName="Wired Headset" type="AUDIO_DEVICE_OUT_WIRED_HEADSET" role="sink">
456                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
457                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
458                 </devicePort>
459                 <devicePort tagName="Wired Headphones" type="AUDIO_DEVICE_OUT_WIRED_HEADPHONE" role="sink">
460                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
461                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
462                 </devicePort>
463                 <devicePort tagName="Line" type="AUDIO_DEVICE_OUT_LINE" role="sink">
464                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
465                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
466                 </devicePort>
467                 <devicePort tagName="BT SCO" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO" role="sink">
468                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
469                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
470                 </devicePort>
471                 <devicePort tagName="BT SCO Headset" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_HEADSET" role="sink">
472                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
473                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
474                 </devicePort>
475                 <devicePort tagName="BT SCO Car Kit" type="AUDIO_DEVICE_OUT_BLUETOOTH_SCO_CARKIT" role="sink">
476                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
477                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
478                 </devicePort>
479                 <devicePort tagName="BT SCO All" type="AUDIO_DEVICE_OUT_ALL_SCO" role="sink">
480                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
481                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO"/>
482                 </devicePort>
483                 <devicePort tagName="Telephony Tx" type="AUDIO_DEVICE_OUT_TELEPHONY_TX" role="sink">
484                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
485                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
486                 </devicePort>
487                 <devicePort tagName="HDMI" type="AUDIO_DEVICE_OUT_AUX_DIGITAL" role="sink">
488                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
489                              samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000" channelMasks="dynamic"/>
490                 </devicePort>
491                 <devicePort tagName="Proxy" type="AUDIO_DEVICE_OUT_PROXY" role="sink">
492                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
493                              samplingRates="8000,11025,16000,22050,32000,44100,48000,64000,88200,96000,128000,176400,192000" channelMasks="dynamic"/>
494                 </devicePort>
495                 <devicePort tagName="FM" type="AUDIO_DEVICE_OUT_FM" role="sink">
496                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
497                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_MONO,AUDIO_CHANNEL_OUT_STEREO"/>
498                 </devicePort>
499                 <devicePort tagName="BT A2DP Out" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP" role="sink">
500                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
501                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
502                 </devicePort>
503                 <devicePort tagName="BT A2DP Headphones" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_HEADPHONES" role="sink">
504                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
505                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
506                 </devicePort>
507                 <devicePort tagName="BT A2DP Speaker" type="AUDIO_DEVICE_OUT_BLUETOOTH_A2DP_SPEAKER" role="sink">
508                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
509                              samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
510                 </devicePort>
511 
512                 <!-- Input devices declaration, i.e. Source DEVICE PORT -->
513                 <devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source">
514                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
515                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
516                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_INDEX_MASK_7"/>
517                 </devicePort>
518                 <devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC" role="source">
519                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
520                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
521                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK,AUDIO_CHANNEL_INDEX_MASK_6,AUDIO_CHANNEL_INDEX_MASK_7"/>
522                 </devicePort>
523                 <devicePort tagName="FM Tuner" type="AUDIO_DEVICE_IN_FM_TUNER" role="source" address="tuner0">
524                     <gains>
525                         <gain name="gain_2" mode="AUDIO_GAIN_MODE_JOINT"
526                               minValueMB="0"
527                               maxValueMB="480"
528                               defaultValueMB="240"
529                               stepValueMB="16"/>
530                     </gains>
531                 </devicePort>
532                 <devicePort tagName="Wired Headset Mic" type="AUDIO_DEVICE_IN_WIRED_HEADSET" role="source">
533                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
534                              samplingRates="8000,11025,12000,16000,22050,24000,32000,44100,48000"
535                              channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO,AUDIO_CHANNEL_IN_FRONT_BACK"/>
536                 </devicePort>
537                 <devicePort tagName="BT SCO Headset Mic" type="AUDIO_DEVICE_IN_BLUETOOTH_SCO_HEADSET" role="source">
538                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
539                              samplingRates="8000,16000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
540                 </devicePort>
541                 <devicePort tagName="Telephony Rx" type="AUDIO_DEVICE_IN_TELEPHONY_RX" role="source">
542                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
543                              samplingRates="8000,16000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO"/>
544                 </devicePort>
545                 <devicePort tagName="Projection Vr Bus In" type="AUDIO_DEVICE_IN_BUS" role="source"
546                         address="BUS01_PROJECTION_VR_BUS_IN">
547                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
548                              samplingRates="16000,24000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
549                 </devicePort>
550                 <devicePort tagName="Projection Phone Bus In" type="AUDIO_DEVICE_IN_BUS" role="source"
551                         address="BUS02_PROJECTION_PHONE_BUS_IN">
552                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
553                              samplingRates="8000,16000,24000,32000,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
554                 </devicePort>
555                 <devicePort tagName="Local Vr Bus In" type="AUDIO_DEVICE_IN_BUS" role="source"
556                         address="BUS03_LOCAL_VR_BUS_IN">
557                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
558                              samplingRates="16000" channelMasks="AUDIO_CHANNEL_INDEX_MASK_4,AUDIO_CHANNEL_INDEX_MASK_7"/>
559                 </devicePort>
560                 <devicePort tagName="Projection Esiri Bus In" type="AUDIO_DEVICE_IN_BUS" role="source"
561                         address="BUS05_PROJECTION_ESIRI_BUS_IN">
562                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
563                              samplingRates="16000" channelMasks="AUDIO_CHANNEL_INDEX_MASK_7,AUDIO_CHANNEL_INDEX_MASK_8"/>
564                 </devicePort>
565             </devicePorts>
566             <!-- route declaration, i.e. list all available sources for a given sink -->
567             <routes>
568                 <route type="mix" sink="Media Bus"
569                        sources="media,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
570                 <route type="mix" sink="Sys Notification Bus"
571                        sources="sys_notification"/>
572                 <route type="mix" sink="Nav Guidance Bus"
573                        sources="nav_guidance"/>
574                 <route type="mix" sink="Phone Bus"
575                        sources="phone"/>
576                 <route type="mix" sink="Tts Bus"
577                        sources="tts"/>
578                 <route type="mix" sink="Vr Tts Bus"
579                        sources="vr_tts"/>
580                 <route type="mix" sink="Boot Music Bus"
581                        sources="boot_music"/>
582                 <route type="mix" sink="Chime Tts Bus"
583                        sources="chime_tts"/>
584                 <route type="mix" sink="BT Codriver Bus"
585                        sources="bt_codriver,bt_codriver_offload,bt_codriver_direct_pcm"/>
586                 <route type="mix" sink="Projection Vr Tts Bus"
587                        sources="projection_vr_downlink"/>
588                 <route type="mix" sink="Ringtone Bus"
589                        sources="ringtone"/>
590                 <route type="mix" sink="Earpiece"
591                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
592                 <route type="mix" sink="Speaker"
593                        sources="primary output,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out,projection_phone_downlink"/>
594                 <route type="mix" sink="Wired Headset"
595                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,dsd_compress_passthrough,voip_rx,mmap_no_irq_out"/>
596                 <route type="mix" sink="Wired Headphones"
597                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,dsd_compress_passthrough,voip_rx,mmap_no_irq_out"/>
598                 <route type="mix" sink="Line"
599                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,dsd_compress_passthrough,voip_rx,mmap_no_irq_out"/>
600                 <route type="mix" sink="HDMI"
601                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,compress_passthrough,voip_rx"/>
602                 <route type="mix" sink="Proxy"
603                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload"/>
604                 <route type="mix" sink="FM"
605                        sources="primary output"/>
606                 <route type="mix" sink="BT SCO All"
607                        sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
608                 <route type="mix" sink="Telephony Tx"
609                        sources="voice_tx"/>
610                 <route type="mix" sink="voice_rx"
611                        sources="Telephony Rx"/>
612                 <route type="mix" sink="primary input"
613                        sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
614                 <route type="mix" sink="surround_sound"
615                        sources="Built-In Mic,Built-In Back Mic"/>
616                 <route type="mix" sink="record_24"
617                        sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
618                 <route type="mix" sink="mmap_no_irq_in"
619                        sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic"/>
620                 <route type="mix" sink="BT A2DP Out"
621                        sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
622                 <route type="mix" sink="BT A2DP Headphones"
623                        sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
624                 <route type="mix" sink="BT A2DP Speaker"
625                        sources="primary output,deep_buffer,direct_pcm,compressed_offload,voip_rx"/>
626                 <route type="mix" sink="projection_vr_uplink"
627                        sources="Projection Vr Bus In"/>
628                 <route type="mix" sink="projection_phone_uplink"
629                        sources="Projection Phone Bus In"/>
630                 <route type="mix" sink="local_vr_uplink"
631                        sources="Local Vr Bus In"/>
632                 <route type="mix" sink="projection_esiri_uplink"
633                        sources="Projection Esiri Bus In"/>
634             </routes>
635 
636         </module>
637
638         <!-- A2DP Audio HAL -->
639         <module name="a2dp" halVersion="2.0">
640             <mixPorts>
641                 <mixPort name="a2dp input" role="sink">
642                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
643                              samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
644                 </mixPort>
645             </mixPorts>
646 
647             <devicePorts>
648                 <devicePort tagName="BT A2DP In" type="AUDIO_DEVICE_IN_BLUETOOTH_A2DP" role="source">
649                     <profile name="" format="AUDIO_FORMAT_PCM_16_BIT"
650                              samplingRates="44100,48000" channelMasks="AUDIO_CHANNEL_IN_MONO,AUDIO_CHANNEL_IN_STEREO"/>
651                 </devicePort>
652             </devicePorts>
653 
654             <routes>
655                 <route type="mix" sink="a2dp input"
656                        sources="BT A2DP In"/>
657             </routes>
658         </module>

概括来说,这个文件定义了系统会使用到的音频设备,支持的音频流,以及设备与流之间的走向关系。devicePort对应设备,mixPort对应流,routes对应走向关系。

module:

每个module标签对应有自己hal,也就是hal的源码实现都不一样,如primary、usb、a2dp等。

需要注意的是AudioFlinger中通过hal接口IDevicesFactory.openDevice(string device) 打开的就是这个module,而不是一个真实的扬声器或者耳机之类的设备。

每个module都会有一个audio_hal的实现,通常会命名为audio_hw.c,代码路径如下:

android/vendor/qcom/opensource/audio-hal/primary-hal/hal/
android/system/bt/audio_a2dp_hw/
对应到设备端,会看到有两个库,分别是:

audio.primary.sdm845.so
audio.a2dp.default.so


attachedDevices:


永久连接的设备,是devicePort中的一部分。

defaultOutputDevice:


当无策略规则适用时默认会使用这个设备

mixPort:


每一个mixPort都对应一个音频输入或者输出流,配置了自己的格式、采样率以及mask。

其中role有两个角色,source代表此流可以用于输出,如输出到扬声器。sink代表此流可以用于接受输入,如麦克风采集到数据后输出到此流。

flag和profile用于指定此流支持的一些属性配置。

MixPort中的flag

AUDIO_OUTPUT_FLAG

Description

AUDIO_OUTPUT_FLAG_PRIMARY

表示音频流需要输出到主输出设备,一般用于铃声类声音

AUDIO_OUTPUT_FLAG_DIRECT

表示音频流直接输出到音频设备,不需要软件混音,一般用于 HDMI 设备声音输出

AUDIO_OUTPUT_FLAG_FAST

表示音频流需要快速输出到音频设备,一般用于按键音、游戏背景音等对时延要求高的场景

AUDIO_OUTPUT_FLAG_DEEP_BUFFER

表示音频流输出可以接受较大的时延,一般用于音乐、视频播放等对时延要求不高的场景

AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD

表示音频流没有经过软件解码,需要输出到硬件解码器,

devicePort:

包含可从此模块访问的所有输入和输出设备(包括永久连接的设备和可移除设备)的设备描述符列表。有实际的物理设备,在android中有定义的设备类型,比如AUDIO_DEVICE_OUT_SPEAKER、AUDIO_DEVICE_IN_HDMI、AUDIO_DEVICE_OUT_BLUETOOTH_A2DP等等,也可以是动态插拔的外设。同样role有source和sink两个角色。profile于指定此流支持的一些属性配置,表示支持sampleRate、format和channelMask。

devicePort标签可以理解为一个device设备,设备也分output和input,但是不在像mixport那样以role来分,而是以type中含有的关键字“IN”和“OUT”来分,type用于设备的唯一标识。

routes:

route是把deviceport和mixport连接起来的路由,数据由一个stream输出到另一个device,或者从一个device输出到另一个stream,简单来说就是连接设备和流,列出所有可能的连接。

type:表示所有音源相互排斥(mux)或可以混合(mix)。

sink: 可以是设备,也可以是流。每一个route只有一个sink。

source: 同样可以是设备,也可以是流。每一个route中可包含多个source。

<route type="mix" sink="Earpiece" sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out"/>
<route type="mix" sink="primary input" sources="Built-In Mic,Built-In Back Mic,Wired Headset Mic,BT SCO Headset Mic,FM Tuner,Telephony Rx"/>
<route type="mix" sink="Speaker" sources="primary output,direct_pcm,compressed_offload,voip_rx,mmap_no_irq_out,projection_phone_downlink"/><route type="mix" sink="Wired Headset" sources="primary output,raw,deep_buffer,direct_pcm,compressed_offload,dsd_compress_passthrough,voip_rx,mmap_no_irq_out"/>

以上配置可以解释为:

1.假定音频流要输出到耳机或扬声器,那么可以采用的音频流(mixPort)可以是primary output, raw 等等。

2.假定音频流要输出到primary input。那么可以使用的设备有 Built-In Mic,Built-In Back Mic等麦克风。

从配置文件中可以看到不同的sink,可能有相同的source。那么具体采用那个source会根据音频策略来决定。比如:

1. 从上层传来了一个compressed_offload的流,到底是输出到耳机还是内置扬声器,会根据是否插入耳机和耳机的优先级来判定。

2. 上层传来请求录音请求,不管是普通录音,还是voip语音电话录音,会从可用的录音设备中查找优先级最高的一个设备进行录音。

audio_policy_configuration初始化逻辑:

audio_policy_configuration.xml在AudioPolicyManager初始化时会被解析。

首先遍历module,再分别遍历输出mixport和输入mixport。如果mixport找到的设备出现在attachedDevices中才会打开此流。

4866 void AudioPolicyManager::onNewAudioModulesAvailableInt(DeviceVector *newDevices)
4867  {
4868      for (const auto& hwModule : mHwModulesAll) {
4869          if (std::find(mHwModules.begin(), mHwModules.end(), hwModule) != mHwModules.end()) {
4870              continue;
4871          }
4872          hwModule->setHandle(mpClientInterface->loadHwModule(hwModule->getName()));
4873          if (hwModule->getHandle() == AUDIO_MODULE_HANDLE_NONE) {
4874              ALOGW("could not open HW module %s", hwModule->getName());
4875              continue;
4876          }
4877          mHwModules.push_back(hwModule);
4878          // open all output streams needed to access attached devices
4879          // except for direct output streams that are only opened when they are actually
4880          // required by an app.
4881          // This also validates mAvailableOutputDevices list
4882          for (const auto& outProfile : hwModule->getOutputProfiles()) {
4883              if (!outProfile->canOpenNewIo()) {
4884                  ALOGE("Invalid Output profile max open count %u for profile %s",
4885                        outProfile->maxOpenCount, outProfile->getTagName().c_str());
4886                  continue;
4887              }
4888              if (!outProfile->hasSupportedDevices()) {
4889                  ALOGW("Output profile contains no device on module %s", hwModule->getName());
4890                  continue;
4891              }
4892              if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_TTS) != 0) {
4893                  mTtsOutputAvailable = true;
4894              }
4895              if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT) != 0) {
4896                  continue;
4897              }
4898              const DeviceVector &supportedDevices = outProfile->getSupportedDevices();
4899              DeviceVector availProfileDevices = supportedDevices.filter(mOutputDevicesAll);
4900              sp<DeviceDescriptor> supportedDevice = 0;
4901              if (supportedDevices.contains(mDefaultOutputDevice)) {
4902                  supportedDevice = mDefaultOutputDevice;
4903              } else {
4904                  // choose first device present in profile's SupportedDevices also part of
4905                  // mAvailableOutputDevices.
4906                  if (availProfileDevices.isEmpty()) {
4907                      continue;
4908                  }
4909                  supportedDevice = availProfileDevices.itemAt(0);
4910              }
4911              if (!mOutputDevicesAll.contains(supportedDevice)) {
4912                  continue;
4913              }
4914              sp<SwAudioOutputDescriptor> outputDesc = new SwAudioOutputDescriptor(outProfile,
4915                                                                                   mpClientInterface);
4916              audio_io_handle_t output = AUDIO_IO_HANDLE_NONE;
4917              status_t status = outputDesc->open(nullptr, DeviceVector(supportedDevice),
4918                                                 AUDIO_STREAM_DEFAULT,
4919                                                 AUDIO_OUTPUT_FLAG_NONE, &output);
4920              if (status != NO_ERROR) {
4921                  ALOGW("Cannot open output stream for devices %s on hw module %s",
4922                        supportedDevice->toString().c_str(), hwModule->getName());
4923                  continue;
4924              }
4925              for (const auto &device : availProfileDevices) {
4926                  // give a valid ID to an attached device once confirmed it is reachable
4927                  if (!device->isAttached()) {
4928                      device->attach(hwModule);
4929                      mAvailableOutputDevices.add(device);
4930                      device->setEncapsulationInfoFromHal(mpClientInterface);
4931                      if (newDevices) newDevices->add(device);
4932                      setEngineDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_AVAILABLE);
4933                  }
4934              }
4935              if (mPrimaryOutput == 0 &&
4936                      outProfile->getFlags() & AUDIO_OUTPUT_FLAG_PRIMARY) {
4937                  mPrimaryOutput = outputDesc;
4938              }
4939              if ((outProfile->getFlags() & AUDIO_OUTPUT_FLAG_DIRECT) != 0) {
4940                  outputDesc->close();
4941              } else {
4942                  addOutput(output, outputDesc);
4943                  ALOGI("open output stream for device %s on hw module %s mSamplingRate = %d, mFormat = %d, mChannelMask = %d, mFlags = %d",
4944                      outputDesc->devices().toString().c_str(), hwModule->getName(), outputDesc->getSamplingRate(),
4945                      outputDesc->getFormat(), outputDesc->getChannelMask(), outProfile->getFlags());
4946                  setOutputDevices(outputDesc,
4947                                   DeviceVector(supportedDevice),
4948                                   true,
4949                                   0,
4950                                   NULL);
4951              }
4952          }
4953          // open input streams needed to access attached devices to validate
4954          // mAvailableInputDevices list
4955          for (const auto& inProfile : hwModule->getInputProfiles()) {
4956              if (!inProfile->canOpenNewIo()) {
4957                  ALOGE("Invalid Input profile max open count %u for profile %s",
4958                        inProfile->maxOpenCount, inProfile->getTagName().c_str());
4959                  continue;
4960              }
4961              if (!inProfile->hasSupportedDevices()) {
4962                  ALOGW("Input profile contains no device on module %s", hwModule->getName());
4963                  continue;
4964              }
4965              // chose first device present in profile's SupportedDevices also part of
4966              // available input devices
4967              const DeviceVector &supportedDevices = inProfile->getSupportedDevices();
4968              DeviceVector availProfileDevices = supportedDevices.filter(mInputDevicesAll);
4969              if (availProfileDevices.isEmpty()) {
4970                  ALOGE("%s: Input device list is empty!", __FUNCTION__);
4971                  continue;
4972              }
4973              sp<AudioInputDescriptor> inputDesc =
4974                      new AudioInputDescriptor(inProfile, mpClientInterface);
4975  
4976              audio_io_handle_t input = AUDIO_IO_HANDLE_NONE;
4977              status_t status = inputDesc->open(nullptr,
4978                                                availProfileDevices.itemAt(0),
4979                                                AUDIO_SOURCE_MIC,
4980                                                AUDIO_INPUT_FLAG_NONE,
4981                                                &input);
4982              if (status != NO_ERROR) {
4983                  ALOGW("Cannot open input stream for device %s on hw module %s",
4984                        availProfileDevices.toString().c_str(),
4985                        hwModule->getName());
4986                  continue;
4987              }
4988              for (const auto &device : availProfileDevices) {
4989                  // give a valid ID to an attached device once confirmed it is reachable
4990                  if (!device->isAttached()) {
4991                      device->attach(hwModule);
4992                      device->importAudioPortAndPickAudioProfile(inProfile, true);
4993                      mAvailableInputDevices.add(device);
4994                      if (newDevices) newDevices->add(device);
4995                      setEngineDeviceConnectionState(device, AUDIO_POLICY_DEVICE_STATE_AVAILABLE);
4996                  }
4997              }
4998              inputDesc->close();
4999          }
5000      }
5001  }

比如在打开primary module时:

1. 遍历第一个输出mixport(primary output),routes中包含primary output的有:Earpiece, Speaker, Wired Headset, Wired Headphones, BT SCO, BT SCO Headset,, BT A2DP Out, BT A2DP Headphones, BT A2DP Speaker, HDMI, USB Device Out, Line, FM, Proxy。这部分设备Earpiece和Speaker存在于attachedDevices中,因此primary output流会被打开。

2. 遍历第六个输出mixport(compress_passthrough),routes中包含compress_passthrough的有:HDMI,这个设备不在attachedDevices中,因此开机初始化时compress_passthrough流不会被打开。只有当HDMI插入时才会打开。


http://www.ppmy.cn/news/1536945.html

相关文章

JavaScript 访问者模式:打造高扩展性的对象结构

一. 前言 在面向对象编程中&#xff0c;访问者模式&#xff08;Visitor Pattern&#xff09;是一种行为设计模式&#xff0c;它允许我们向现有的类结构添加新的操作&#xff0c;而无需修改这些类。这对于需要对类层次结构中的元素进行复杂算法处理的场景非常有用。 本文将详细…

第五十九周周报 IAGNN

文章目录 week 59 IAGNN摘要Abstract一、大数据相关1. 磁盘扩容以及数据恢复2. 单机hbase 二、文献阅读1. 题目2. Abstract3. 网络结构3.1 问题定义3.2 IAGNN 4. 文献解读4.1 Introduction4.2 创新点4.3 实验过程4.4 实验结果 5. 结论参考文献 week 59 IAGNN 摘要 本周阅读了…

多模态简单了解

多模态 1.文本编码2. ViT图像编码器2.1图像矩阵self-attention计算&#xff1a; 3.Transformer多模态3.1CLIP 图文交互3.2 对比学习训练3.3 flamingo 图文交互3.4 LLava 图文交互 1.文本编码 简介&#xff1a; 即通过embedding将字符向量化&#xff0c;进入模型即可。 2. ViT…

selenium-Alert类用于操作提示框/确认弹框(4)

之前文章我们提到&#xff0c;在webdriver.WebDriver类有一个switch_to方法&#xff0c;通过switch_to.alert()可以返回Alert对象&#xff0c;而Alert对象主要用于网页中弹出的提示框/确认框/文本输入框的确认或者取消等动作。 Alert介绍 当在页面定位到提示框/确认框/文本录入…

XILINX MIG驱动

简介 框架图 本章节主要针对MIG读写做详细介绍,首先创建BLOCK DESIGN,工程连接如下图所示: MIG IP介绍 DATAMOVER的配置这里不再做介绍,结合上篇文章讲到DATAMOVER对BRAM进行读写操作,这里通过AXI桥再加一个MIG模块,MIG模块的配置和说明如下: 1、Clock Period:…

JAVA八股文1

1.Java 基础 1.1 语法基础 封装 利用抽象数据类型将数据和基于数据的操作封装在一起&#xff0c;使其构成一个不可分割的独立实体。数据被保护在抽象数据类型的内部&#xff0c;尽可能地隐藏内部的细节&#xff0c;只保留一些对外接口使之与外部发生联系。用户无需知道对象内…

C++语言学习(10):《C++程序设计原理与实践》第五章笔记

第五章是「错误」&#xff0c;探讨了错误类型、错误来源、规避或解决方法&#xff08;调试&#xff09;。 错误的分类 编译时错误链接时错误运行时错误逻辑错误 错误的来源 找到错误的源头&#xff0c;然后去消除或解决错误&#xff1b;而不是从报错现场&#xff0c;逐层…

Dit架构 diffusion范式分类+应用

1.ping 网址 2.ssh nscc/l20 3.crtl,打开vscode的setting 4.win 10修改ssh配置文件及其密钥权限为600 - 晴云孤魂 - 博客园 整体来看&#xff1a; 使用transformer作为其主干网络&#xff0c;代替了原先的UNet 在latent space进行训练&#xff0c;通过transformer处理潜…