policy_hal: avoid open stereo channel output for voip_rx flag
Stereo output is started with setting voip_rx flag. This is not
allowed due to voip_rx profile is not supported.
Add channel mask and sample rate check to ensure voip_rx flag is set
when using correct channel and sample rate.
CRs-Fixed: 2414061
Change-Id: Iae9252915006b7f8b695a1e4680845f2e4e3ac8f
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 345f9e4..2fb85bb 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1491,7 +1491,10 @@
}
} else {
if (stream == AUDIO_STREAM_VOICE_CALL &&
- audio_is_linear_pcm(config->format)) {
+ audio_is_linear_pcm(config->format) &&
+ (config->channel_mask == 1) &&
+ (config->sample_rate == 8000 || config->sample_rate == 16000 ||
+ config->sample_rate == 32000 || config->sample_rate == 48000)) {
//check if VoIP output is not opened already
bool voip_pcm_already_in_use = false;
for (size_t i = 0; i < mOutputs.size(); i++) {