diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 35324efd..8366f244 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -9598,11 +9598,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; @@ -9619,8 +9618,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;