Update multichannel audio policy handling
Ensure AUDIO_FORMAT_PCM_FLOAT and AUDIO_FORMAT_PCM_32_BIT
have proper precedence.
Allow more mixer channels than 2.
Change-Id: I02af97dad6218b25cbada4d93077a213314c6725
diff --git a/services/audiopolicy/AudioPolicyManager.cpp b/services/audiopolicy/AudioPolicyManager.cpp
index c5248fe..a0322d6 100644
--- a/services/audiopolicy/AudioPolicyManager.cpp
+++ b/services/audiopolicy/AudioPolicyManager.cpp
@@ -5494,12 +5494,14 @@
return channelMask;
}
+/* format in order of increasing preference */
const audio_format_t AudioPolicyManager::AudioPort::sPcmFormatCompareTable[] = {
AUDIO_FORMAT_DEFAULT,
AUDIO_FORMAT_PCM_16_BIT,
AUDIO_FORMAT_PCM_8_24_BIT,
AUDIO_FORMAT_PCM_24_BIT_PACKED,
AUDIO_FORMAT_PCM_32_BIT,
+ AUDIO_FORMAT_PCM_FLOAT,
};
int AudioPolicyManager::AudioPort::compareFormats(audio_format_t format1,
@@ -5541,7 +5543,9 @@
}
audio_format_t format = AUDIO_FORMAT_DEFAULT;
- audio_format_t bestFormat = BEST_MIXER_FORMAT;
+ audio_format_t bestFormat =
+ AudioPolicyManager::AudioPort::sPcmFormatCompareTable[
+ ARRAY_SIZE(AudioPolicyManager::AudioPort::sPcmFormatCompareTable) - 1];
// For mixed output and inputs, use best mixer output format. Do not
// limit format otherwise
if ((mType != AUDIO_PORT_TYPE_MIX) ||