summaryrefslogtreecommitdiffstats
path: root/hal
diff options
context:
space:
mode:
authorZhou Song <zhous@codeaurora.org>2019-09-09 14:17:40 +0800
committerGerrit - the friendly Code Review server <code-review@localhost>2019-10-09 19:22:36 -0700
commit280230029f8f20b7cc9d92be5f57c453dac0301c (patch)
tree0a547767776e62d21f812331948ff571373474ba /hal
parent8e528ebdfdc9a441cda844cc30f69bea97da4fd8 (diff)
downloadandroid_hardware_qcom_audio-280230029f8f20b7cc9d92be5f57c453dac0301c.tar.gz
android_hardware_qcom_audio-280230029f8f20b7cc9d92be5f57c453dac0301c.tar.bz2
android_hardware_qcom_audio-280230029f8f20b7cc9d92be5f57c453dac0301c.zip
hal: tear down a2dp path for non-offloaded streams when suspended
When A2dp device is already active and A2dpsuspended=true is received, audio route will be switched to sco mic and BT firmware will open the RX path as 8KHz, while a2dp playback can still keep sending data over slimbus, this can cause noise heard in the BT headset. To avoid this, tear down the A2dp playback before SCO is enabled. Change-Id: Ic0b8d1c725340a3a2878d11717631c45c81dc721
Diffstat (limited to 'hal')
-rw-r--r--hal/audio_hw.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index b17e4b2f..4e851027 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -9509,11 +9509,10 @@ static int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *ou
pthread_mutex_unlock(&out->compr_mute_lock);
}
} else {
- // mute compress stream if suspended
- pthread_mutex_lock(&out->compr_mute_lock);
- if ((out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) &&
- (!out->a2dp_compress_mute)) {
- if (!out->standby) {
+ if (out->flags & AUDIO_OUTPUT_FLAG_COMPRESS_OFFLOAD) {
+ // mute compress stream if suspended
+ pthread_mutex_lock(&out->compr_mute_lock);
+ if (!out->a2dp_compress_mute && !out->standby) {
ALOGD("%s: selecting speaker and muting stream", __func__);
devices = out->devices;
out->devices = AUDIO_DEVICE_OUT_SPEAKER;
@@ -9530,8 +9529,12 @@ static int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *ou
out->volume_l = left_p;
out->volume_r = right_p;
}
+ pthread_mutex_unlock(&out->compr_mute_lock);
+ } else {
+ // tear down a2dp path for non offloaded streams
+ if (audio_extn_a2dp_source_is_suspended())
+ out_standby_l(&out->stream.common);
}
- pthread_mutex_unlock(&out->compr_mute_lock);
}
ALOGV("%s: exit", __func__);
return 0;