Merge "policy_hal: update custom policy for SCO volume against AOSP"
diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp
index 3056a2c..bce91d5 100644
--- a/policy_hal/AudioPolicyManager.cpp
+++ b/policy_hal/AudioPolicyManager.cpp
@@ -1447,9 +1447,14 @@
return 0;
}
- if (mApmConfigs->isCompressVOIPEnabled()) {
- if (stream == AUDIO_STREAM_VOICE_CALL &&
- audio_is_linear_pcm(config->format)) {
+ /*
+ * Check for VOIP Flag override for voice streams using linear pcm,
+ * but not when intended for uplink device(i.e. Telephony Tx)
+ */
+ if (stream == AUDIO_STREAM_VOICE_CALL &&
+ audio_is_linear_pcm(config->format) &&
+ !devices.onlyContainsDevicesWithType(AUDIO_DEVICE_OUT_TELEPHONY_TX)) {
+ if (mApmConfigs->isCompressVOIPEnabled()) {
// let voice stream to go with primary output by default
// in case direct voip is bypassed
bool use_primary_out = true;
@@ -1493,13 +1498,9 @@
if (use_primary_out) {
*flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY);
}
- }
- } else {
- if (stream == AUDIO_STREAM_VOICE_CALL &&
- 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)) {
+ } else if ((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++) {
@@ -1523,7 +1524,7 @@
ALOGV("Set VoIP and Direct output flags for PCM format");
}
}
- } /* compress_voip_enabled */
+ } /* voip flag override block end */
//IF VOIP is going to be started at the same time as when
//vr is enabled, get VOIP to fallback to low latency