a2dp: Fix BT SCO Tx configuration during a2dp to sco transition
-For voice call tx backend is configured with a2dp sampling rate
leading to distorted audio during voice call.
-Don't set tx backend sample rate for a2dp if abr is not enabled.
Change-Id: I7cdb0a5c98b550665cfaafb02cd9151579d7138c
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index 19c839c..36065c9 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -1183,20 +1183,21 @@
rate_str = SPEECH_TX_SAMPLE_RATE;
else
rate_str = ABR_TX_SAMPLE_RATE;
- }
- ALOGD("%s: set backend tx sample rate = %s", __func__, rate_str);
- ctl_sample_rate = mixer_get_ctl_by_name(a2dp.adev->mixer,
- MIXER_SOURCE_SAMPLE_RATE_TX);
- if (!ctl_sample_rate) {
- ALOGE("%s: ERROR backend sample rate mixer control not identifed", __func__);
- is_configured = false;
- goto fail;
- }
- if (mixer_ctl_set_enum_by_string(ctl_sample_rate, rate_str) != 0) {
- ALOGE("%s: Failed to set backend sample rate = %s", __func__, rate_str);
- is_configured = false;
- goto fail;
+ ALOGD("%s: set backend tx sample rate = %s", __func__, rate_str);
+ ctl_sample_rate = mixer_get_ctl_by_name(a2dp.adev->mixer,
+ MIXER_SOURCE_SAMPLE_RATE_TX);
+ if (!ctl_sample_rate) {
+ ALOGE("%s: ERROR backend sample rate mixer control not identifed", __func__);
+ is_configured = false;
+ goto fail;
+ }
+
+ if (mixer_ctl_set_enum_by_string(ctl_sample_rate, rate_str) != 0) {
+ ALOGE("%s: Failed to set backend sample rate = %s", __func__, rate_str);
+ is_configured = false;
+ goto fail;
+ }
}
}
} else {