hal: Ensure during voice call backend in sample rate is fixed at 48kHz
-True native playback uses same backend to play 44.1kHz as well as
48kHz.
-During voice call if backend gets reconfigured to sample rate of
44.1kHz then voice call fails.
-Hence ensure that if voice call is active the backend irrespective
of native playback is fixed at sample rate of 48Khz.
Change-Id: I610d701bd89ae25acdd8cea63d03d77e9f791af6
diff --git a/hal/msm8916/platform.c b/hal/msm8916/platform.c
index f887904..870f64e 100644
--- a/hal/msm8916/platform.c
+++ b/hal/msm8916/platform.c
@@ -5173,6 +5173,7 @@
unsigned int sample_rate;
unsigned int channels;
bool passthrough_enabled = false;
+ bool voice_call_active = false;
int backend_idx = DEFAULT_CODEC_BACKEND;
struct platform_data *my_data = (struct platform_data *)adev->platform;
int na_mode = platform_get_native_support();
@@ -5205,6 +5206,7 @@
bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
channels = CODEC_BACKEND_DEFAULT_CHANNELS;
+ voice_call_active = true;
} else {
/*
* The backend should be configured at highest bit width and/or
@@ -5244,7 +5246,7 @@
}
/* Native playback is preferred for Headphone/HS device over 192Khz */
- if (codec_device_supports_native_playback(usecase->devices)) {
+ if (!voice_call_active && codec_device_supports_native_playback(usecase->devices)) {
if (audio_is_true_native_stream_active(adev)) {
if (check_hdset_combo_device(snd_device)) {
/*
@@ -5255,8 +5257,8 @@
*/
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
- ALOGD("%s:becf: afe: port has to run at 48k for a combo device",
- __func__);
+ ALOGD("%s:becf: afe: port to run at 48k if combo device or in voice call"
+ , __func__);
} else {
/*
* in single BE mode, if native audio playback
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 93b28ca..a434515 100644
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -5062,6 +5062,7 @@
unsigned int sample_rate;
unsigned int channels;
bool passthrough_enabled = false;
+ bool voice_call_active = false;
int backend_idx = DEFAULT_CODEC_BACKEND;
struct platform_data *my_data = (struct platform_data *)adev->platform;
int na_mode = platform_get_native_support();
@@ -5095,6 +5096,7 @@
bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
channels = CODEC_BACKEND_DEFAULT_CHANNELS;
+ voice_call_active = true;
} else {
/*
* The backend should be configured at highest bit width and/or
@@ -5134,7 +5136,7 @@
}
/* Native playback is preferred for Headphone/HS device over 192Khz */
- if (codec_device_supports_native_playback(usecase->devices)) {
+ if (!voice_call_active && codec_device_supports_native_playback(usecase->devices)) {
if (audio_is_true_native_stream_active(adev)) {
if (check_hdset_combo_device(snd_device)) {
/*
@@ -5145,8 +5147,8 @@
*/
sample_rate = CODEC_BACKEND_DEFAULT_SAMPLE_RATE;
bit_width = CODEC_BACKEND_DEFAULT_BIT_WIDTH;
- ALOGD("%s:becf: afe: port has to run at 48k for a combo device",
- __func__);
+ ALOGD("%s:becf: afe: port to run at 48k if combo device or in voice call"
+ , __func__);
} else {
/*
* in single BE mode, if native audio playback