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
This commit is contained in:
parent
7a2f2c0669
commit
c576a45590
|
@ -9589,11 +9589,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;
|
||||
|
@ -9610,8 +9609,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;
|
||||
|
|
Loading…
Reference in New Issue