summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShalini Manjunatha <shalma@codeaurora.org>2021-02-01 12:23:49 +0530
committerShalini Manjunatha <shalma@codeaurora.org>2021-02-02 13:45:54 +0530
commitc8cd3e98d1c7b935c74caae4cda0a5f842411547 (patch)
tree8edfb1235590cbd669db906141b747c7a930b137
parent5e44b789ee872607355eb729da023a056d15d4fd (diff)
hal: route use cases properly to SCO device when it arrives
When ever BT_SCO=ON arrives, make sure to route all use cases to SCO device, otherwise due to delay in BT_SCO=ON and lack of synchronization for create audio patch request for SCO device, some times use case not routed properly to SCO device during VOIP call Change-Id: I360d195858c26ace18e92fc0975ff3108ba866e4
-rw-r--r--hal/audio_hw.c25
1 files changed, 24 insertions, 1 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 8a6011b3..3b784b82 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -8747,7 +8747,30 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs)
/* When set to false, HAL should disable EC and NS */
if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0){
adev->bt_sco_on = true;
- } else {
+ /*
+ * When ever BT_SCO=ON arrives, make sure to route
+ * all use cases to SCO device, otherwise due to delay in
+ * BT_SCO=ON and lack of synchronization with create audio patch
+ * request for SCO device, some times use case not routed properly to
+ * SCO device
+ */
+ 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_btsco_device(SND_DEVICE_NONE, usecase->in_snd_device))) {
+ ALOGD("BT_SCO ON, switch all in use case to it");
+ select_devices(adev, usecase->id);
+ }
+ if (usecase->stream.out && (usecase->type == PCM_PLAYBACK) &&
+ (!is_btsco_device(usecase->out_snd_device, SND_DEVICE_NONE))) {
+ ALOGD("BT_SCO ON, switch all out use case to it");
+ select_devices(adev, usecase->id);
+ }
+ }
+ }
+ else {
adev->bt_sco_on = false;
audio_extn_sco_reset_configuration();
}