diff options
author | Ramjee Singh <ramjee@codeaurora.org> | 2021-12-14 14:13:41 +0530 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2022-01-03 22:25:48 -0800 |
commit | a337a9688cf9071da86e002d1c40012102818961 (patch) | |
tree | f9b20012e9adc615ea3973613175987b5419eb95 | |
parent | 8a0daeb1b2bee11bdc460f8ae51a3ee05710929c (diff) |
hal: fix bt sco and a2dp concurrency issues
When sco mic device is already active and
SND_DEVICE_OUT_BT_A2DP is enabled, then route
is switched to A2dp, but sco mic can still
keep active which means the BE is already
active, causing the slimbus configuration of
feedback path for A2dp to be ignored.
To fix this, tear down the input stream to
disable bt sco mic before enabling a2dp path.
Change-Id: I42e37e7b192d374401406cfa6dff4b97dca36697
-rw-r--r-- | hal/audio_hw.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 6fbbee33..952116ac 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -1411,6 +1411,20 @@ int enable_snd_device(struct audio_device *adev, } if (SND_DEVICE_OUT_BT_A2DP == snd_device) { + + struct audio_usecase *usecase; + struct listnode *node; + /* Disable SCO Devices and enable handset mic for active input stream */ + list_for_each(node, &adev->usecase_list) { + usecase = node_to_item(node, struct audio_usecase, list); + if (usecase->stream.in && (usecase->type == PCM_CAPTURE) && + is_sco_in_device_type(&usecase->stream.in->device_list)) { + ALOGD("a2dp resumed, switch bt sco mic to handset mic"); + reassign_device_list(&usecase->stream.in->device_list, + AUDIO_DEVICE_IN_BUILTIN_MIC, ""); + select_devices(adev, usecase->id); + } + } if (audio_extn_a2dp_start_playback() < 0) { ALOGE(" fail to configure A2dp Source control path "); goto err; @@ -8780,25 +8794,6 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) } } - ret = str_parms_get_str(parms, "A2dpSuspended", value, sizeof(value)); - if (ret >= 0) { - if (!strncmp(value, "false", 5) && - audio_extn_a2dp_source_is_suspended()) { - struct audio_usecase *usecase; - struct listnode *node; - list_for_each(node, &adev->usecase_list) { - usecase = node_to_item(node, struct audio_usecase, list); - if (usecase->stream.in && (usecase->type == PCM_CAPTURE) && - is_sco_in_device_type(&usecase->stream.in->device_list)) { - ALOGD("a2dp resumed, switch bt sco mic to handset mic"); - reassign_device_list(&usecase->stream.in->device_list, - AUDIO_DEVICE_IN_BUILTIN_MIC, ""); - select_devices(adev, usecase->id); - } - } - } - } - status = voice_set_parameters(adev, parms); if (status != 0) goto done; |