audio: add support for multichannel to dual mono conversion
Add support to set channel mix coffecients to convert from
multichannel to dual mono.
CRs-Fixed: 2211047
Change-Id: I2ecd8babfe53ca48b6e596dce0579e95879ce7e0
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index d35ff0d..034f491 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -3213,6 +3213,8 @@
}
break;
}
+ platform_set_stream_channel_map(adev->platform, out->channel_mask,
+ out->pcm_device_id, &out->channel_map_param.channel_map[0]);
ALOGV("%s: pcm_prepare", __func__);
if (pcm_is_ready(out->pcm)) {
@@ -3226,8 +3228,6 @@
goto error_open;
}
}
- platform_set_stream_channel_map(adev->platform, out->channel_mask,
- out->pcm_device_id, &out->channel_map_param.channel_map[0]);
// apply volume for voip playback after path is set up
if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP)
out_set_voip_volume(&out->stream, out->volume_l, out->volume_r);
@@ -3987,6 +3987,13 @@
pthread_mutex_unlock(&out->lock);
}
+ err = str_parms_get_str(parms, AUDIO_PARAMETER_DUAL_MONO, value,
+ sizeof(value));
+ if (err >= 0) {
+ if (!strncmp("true", value, sizeof("true")) || atoi(value))
+ audio_extn_send_dual_mono_mixing_coefficients(out);
+ }
+
err = str_parms_get_str(parms, AUDIO_PARAMETER_STREAM_PROFILE, value, sizeof(value));
if (err >= 0) {
strlcpy(out->profile, value, sizeof(out->profile));
@@ -4597,6 +4604,8 @@
ret = -EINVAL;
goto exit;
}
+ if (out->set_dual_mono)
+ audio_extn_send_dual_mono_mixing_coefficients(out);
}
if (adev->is_channel_status_set == false && (out->devices & AUDIO_DEVICE_OUT_AUX_DIGITAL)){
@@ -5969,6 +5978,7 @@
out->a2dp_compress_mute = false;
out->hal_output_suspend_supported = 0;
out->dynamic_pm_qos_config_supported = 0;
+ out->set_dual_mono = false;
if ((flags & AUDIO_OUTPUT_FLAG_BD) &&
(property_get_bool("vendor.audio.matrix.limiter.enable", false)))