Skip to content

Commit

Permalink
Fix to improve Android alarm context switch latency
Browse files Browse the repository at this point in the history
Allocate different pcm devices for each context used in Android.

Test-done:
- Play different context simulatenously and no audio loss seen

Tracked-On: OAM-129522
Signed-off-by: Wan, Xinxin <xinxin.wan@intel.com>
  • Loading branch information
xinxin-wan committed Feb 27, 2025
1 parent 4f4f88c commit ca641b8
Show file tree
Hide file tree
Showing 5 changed files with 224 additions and 53 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,36 @@

<!-- Audio Zone 0 -->
<item>bus0_media_CARD_0_DEV_1</item>
<item>bus1_navigation_CARD_0_DEV_1</item>
<item>bus2_voice_command_CARD_0_DEV_1</item>
<item>bus3_call_ring_CARD_0_DEV_1</item>
<item>bus4_call_CARD_0_DEV_1</item>
<item>bus5_alarm_CARD_0_DEV_1</item>
<item>bus1_navigation_CARD_0_DEV_5</item>
<item>bus2_voice_command_CARD_0_DEV_5</item>
<item>bus3_call_ring_CARD_0_DEV_6</item>
<item>bus4_call_CARD_0_DEV_6</item>
<item>bus5_alarm_CARD_0_DEV_7</item>
<item>bus6_notification_CARD_0_DEV_1</item>
<item>bus7_system_sound_CARD_0_DEV_1</item>
<item>bus7_system_sound_CARD_0_DEV_7</item>

<item>Built-In Mic</item>
<item>Built-In Back Mic</item>
<item>bottom</item>
<!-- back mic pcm6-->
<item>back</item>
<item>Echo-Reference Mic</item>
<item>i_bus1_CARD_0_DEV_1</item>
<!-- voice assistant pcm 5-->
<item>i_bus1_CARD_0_DEV_5</item>

<!-- Audio Zone 1 -->
<item>bus100_CARD_0_DEV_2</item>
<item>bus101_CARD_0_DEV_3</item>

<!-- In Call-->
<item>bus101_CARD_0_DEV_8</item>

<item>i_bus100_CARD_0_DEV_2</item>


<!-- Audio Zone 2-->
<item>bus200_CARD_0_DEV_3</item>

<item>i_bus200_CARD_0_DEV_3</item>

<!-- Audio Zone 3-->
<item>bus300_CARD_0_DEV_4</item>

<item>i_bus300_CARD_0_DEV_4</item>

</attachedDevices>
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus1_navigation_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus1_navigation_CARD_0_DEV_1">
<devicePort tagName="bus1_navigation_CARD_0_DEV_5" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus1_navigation_CARD_0_DEV_5">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -35,8 +35,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus2_voice_command_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus2_voice_command_CARD_0_DEV_1">
<devicePort tagName="bus2_voice_command_CARD_0_DEV_5" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus2_voice_command_CARD_0_DEV_5">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -45,8 +45,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus3_call_ring_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus3_call_ring_CARD_0_DEV_1">
<devicePort tagName="bus3_call_ring_CARD_0_DEV_6" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus3_call_ring_CARD_0_DEV_6">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -55,8 +55,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus4_call_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus4_call_CARD_0_DEV_1">
<devicePort tagName="bus4_call_CARD_0_DEV_6" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus4_call_CARD_0_DEV_6">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -65,8 +65,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus5_alarm_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus5_alarm_CARD_0_DEV_1">
<devicePort tagName="bus5_alarm_CARD_0_DEV_7" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus5_alarm_CARD_0_DEV_7">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -85,8 +85,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus7_system_sound_CARD_0_DEV_1" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus7_system_sound_CARD_0_DEV_1">
<devicePort tagName="bus7_system_sound_CARD_0_DEV_7" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus7_system_sound_CARD_0_DEV_7">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -96,14 +96,14 @@
</gains>
</devicePort>

<devicePort tagName="Built-In Mic" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"
address="Built-In Mic" >
<devicePort tagName="bottom" type="AUDIO_DEVICE_IN_BUILTIN_MIC" role="source"
address="bottom" >
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
<devicePort tagName="Built-In Back Mic" type="AUDIO_DEVICE_IN_BACK_MIC"
role="source" address="Built-In Back Mic">
<devicePort tagName="back" type="AUDIO_DEVICE_IN_BACK_MIC"
role="source" address="back">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
Expand All @@ -114,8 +114,8 @@
samplingRates="8000 11025 12000 16000 22050 24000 32000 44100 48000"
channelMasks="AUDIO_CHANNEL_IN_MONO AUDIO_CHANNEL_IN_STEREO AUDIO_CHANNEL_IN_FRONT_BACK"/>
</devicePort>
<devicePort tagName="i_bus1_CARD_0_DEV_1" type="AUDIO_DEVICE_IN_BUS"
role="source" address="i_bus1_CARD_0_DEV_1">
<devicePort tagName="i_bus1_CARD_0_DEV_5" type="AUDIO_DEVICE_IN_BUS"
role="source" address="i_bus1_CARD_0_DEV_5">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
Expand All @@ -137,8 +137,8 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>
<devicePort tagName="bus101_CARD_0_DEV_3" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus101_CARD_0_DEV_3">
<devicePort tagName="bus101_CARD_0_DEV_8" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus101_CARD_0_DEV_8">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
Expand All @@ -159,4 +159,53 @@
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>

<!-- Audio zone 2 -->
<devicePort tagName="bus200_CARD_0_DEV_3" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus200_CARD_0_DEV_3">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
<gain name="" mode="AUDIO_GAIN_MODE_JOINT"
minValueMB="-3200" maxValueMB="600"
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>

<devicePort tagName="i_bus200_CARD_0_DEV_3" type="AUDIO_DEVICE_IN_BUS"
role="source" address="i_bus200_CARD_0_DEV_3">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
<gains>
<gain name="" mode="AUDIO_GAIN_MODE_JOINT"
minValueMB="-3200" maxValueMB="600"
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>

<!-- Audio zone 3-->
<devicePort tagName="bus300_CARD_0_DEV_4" role="sink" type="AUDIO_DEVICE_OUT_BUS"
address="bus300_CARD_0_DEV_4">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000" channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
<gains>
<gain name="" mode="AUDIO_GAIN_MODE_JOINT"
minValueMB="-3200" maxValueMB="600"
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>

<devicePort tagName="i_bus300_CARD_0_DEV_4" type="AUDIO_DEVICE_IN_BUS"
role="source" address="i_bus300_CARD_0_DEV_4">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
<gains>
<gain name="" mode="AUDIO_GAIN_MODE_JOINT"
minValueMB="-3200" maxValueMB="600"
defaultValueMB="0" stepValueMB="100"/>
</gains>
</devicePort>

</devicePorts>
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="Built-In Mic" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="Built-In Back Mic" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="Echo-Reference" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
<mixPort name="mixport_input_bus1_zone_0" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
Expand All @@ -88,4 +103,32 @@
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>

<!-- Audio Zone 2-->
<mixPort name="mixport_bus200_CARD_0_DEV_3" role="source"
flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>

<mixPort name="mixport_input_bus200_zone_2" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>

<!-- Audio Zone 3-->
<mixPort name="mixport_bus101_audio_zone_1" role="source"
flags="AUDIO_OUTPUT_FLAG_PRIMARY">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_OUT_STEREO"/>
</mixPort>

<mixPort name="mixport_input_bus300_zone_3" role="sink">
<profile name="" format="AUDIO_FORMAT_PCM_32_BIT"
samplingRates="48000"
channelMasks="AUDIO_CHANNEL_IN_STEREO"/>
</mixPort>
</mixPorts>
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,33 @@

<!-- Audio Zone 0-->
<route type="mix" sink="bus0_media_CARD_0_DEV_1" sources="mixport_bus0_media_out"/>
<route type="mix" sink="bus1_navigation_CARD_0_DEV_1" sources="mixport_bus1_navigation_out"/>
<route type="mix" sink="bus2_voice_command_CARD_0_DEV_1"
<route type="mix" sink="bus1_navigation_CARD_0_DEV_5" sources="mixport_bus1_navigation_out"/>
<route type="mix" sink="bus2_voice_command_CARD_0_DEV_5"
sources="mixport_bus2_voice_command_out"/>
<route type="mix" sink="bus3_call_ring_CARD_0_DEV_1" sources="mixport_bus3_call_ring_out"/>
<route type="mix" sink="bus4_call_CARD_0_DEV_1" sources="mixport_bus4_call_out"/>
<route type="mix" sink="bus5_alarm_CARD_0_DEV_1" sources="mixport_bus5_alarm_out"/>
<route type="mix" sink="bus3_call_ring_CARD_0_DEV_6" sources="mixport_bus3_call_ring_out"/>
<route type="mix" sink="bus4_call_CARD_0_DEV_6" sources="mixport_bus4_call_out"/>
<route type="mix" sink="bus5_alarm_CARD_0_DEV_7" sources="mixport_bus5_alarm_out"/>
<route type="mix" sink="bus6_notification_CARD_0_DEV_1"
sources="mixport_bus6_notification_out"/>
<route type="mix" sink="bus7_system_sound_CARD_0_DEV_1"
<route type="mix" sink="bus7_system_sound_CARD_0_DEV_7"
sources="mixport_bus7_system_sound_out"/>

<route type="mix" sink="primary input"
sources="Built-In Mic,Built-In Back Mic,Echo-Reference Mic"/>
<route type="mix" sink="mixport_input_bus1_zone_0" sources="i_bus1_CARD_0_DEV_1"/>
<route type="mix" sink="primary input" sources="bottom"/>
<route type="mix" sink="Built-In Back Mic" sources="back"/>
<route type="mix" sink="Echo-Reference" sources="Echo-Reference Mic"/>
<route type="mix" sink="mixport_input_bus1_zone_0" sources="i_bus1_CARD_0_DEV_5"/>

<!-- Audio Zone 1-->
<route type="mix" sink="bus100_CARD_0_DEV_2" sources="mixport_bus100_audio_zone_1"/>
<route type="mix" sink="bus101_CARD_0_DEV_3" sources="mixport_bus101_audio_zone_1"/>
<route type="mix" sink="bus101_CARD_0_DEV_8" sources="mixport_bus101_audio_zone_1"/>
<route type="mix" sink="mixport_input_bus100_zone_1" sources="i_bus100_CARD_0_DEV_2"/>

<!-- Audio Zone 2-->
<route type="mix" sink="bus200_CARD_0_DEV_3" sources="mixport_bus200_CARD_0_DEV_3"/>
<route type="mix" sink="mixport_input_bus200_zone_2" sources="i_bus200_CARD_0_DEV_3"/>

<!-- Audio Zone 3-->
<route type="mix" sink="bus300_CARD_0_DEV_4" sources="mixport_bus101_audio_zone_1"/>
<route type="mix" sink="mixport_input_bus300_zone_3" sources="i_bus300_CARD_0_DEV_4"/>

</routes>
Loading

0 comments on commit ca641b8

Please sign in to comment.