summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLakshman Chaluvaraju <lchalu@codeaurora.org>2021-06-18 14:32:41 +0530
committerLakshman Chaluvaraju <lchalu@codeaurora.org>2021-07-07 17:33:20 +0530
commit6cbe136ea1fc6e15d0a5d16b7f2730a7875c4f9c (patch)
tree0f08ee306ce6e1748e4e8210fe2efbeb81e350ac
parent2cc132a765140dd64412d9f6578a449322e0dfc5 (diff)
a2dp : pcm prepare fail for input during a2dp suspend and reconfig
Start input is failing due to race condition in a2dp suspend and a2dp connection/disconnection. If a2dp suspend params are and then a2dp disconnection comes, reseting the suspended flag can cause a2dp_is_ready function return invalid value during start input and hence pcm prepare fails. Avoid setting a2dp suspend state to false if sco is still on. Change-Id: I83950ddd0d4d3bbe6f30846cba48f6eb88c14690
-rw-r--r--hal/audio_extn/a2dp.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/hal/audio_extn/a2dp.c b/hal/audio_extn/a2dp.c
index d0170db0..cade8cdb 100644
--- a/hal/audio_extn/a2dp.c
+++ b/hal/audio_extn/a2dp.c
@@ -992,6 +992,8 @@ static void open_a2dp_source() {
ALOGE("Failed to open source stream for a2dp: status %d", ret);
}
a2dp.bt_state_source = A2DP_STATE_CONNECTED;
+ if (!a2dp.adev->bt_sco_on)
+ a2dp.a2dp_source_suspended = false;
} else {
ALOGD("Called a2dp open with improper state %d", a2dp.bt_state_source);
}
@@ -1088,7 +1090,8 @@ static int close_a2dp_output()
}
a2dp.a2dp_source_started = false;
a2dp.a2dp_source_total_active_session_requests = 0;
- a2dp.a2dp_source_suspended = false;
+ if (!a2dp.adev->bt_sco_on)
+ a2dp.a2dp_source_suspended = false;
a2dp.bt_encoder_format = CODEC_TYPE_INVALID;
a2dp.enc_sampling_rate = 48000;
a2dp.enc_channels = 2;
@@ -2946,6 +2949,13 @@ int a2dp_set_parameters(struct str_parms *parms, bool *reconfig)
goto param_handled;
}
+ ret = str_parms_get_str(parms, "BT_SCO", value, sizeof(value));
+ if (ret >= 0) {
+ if (strcmp(value, AUDIO_PARAMETER_VALUE_ON) == 0) {
+ a2dp.a2dp_source_suspended = true;
+ }
+ }
+
param_handled:
ALOGV("end of a2dp setparam");
return status;