diff options
author | Zhou Song <zhous@codeaurora.org> | 2021-01-14 16:48:03 +0800 |
---|---|---|
committer | Zhou Song <zhous@codeaurora.org> | 2021-01-27 17:27:00 +0800 |
commit | 5e44b789ee872607355eb729da023a056d15d4fd (patch) | |
tree | 69618ba44e817658647aa4a7ed3cdb74a03fb6e4 | |
parent | 3bbcee7a5ba7fa4506624f122a97ee7f1f24636c (diff) |
hal: don't mute stream with combo device during a2dpsuspended
For active usecases on combo device, stream should still be audible
on the non-a2dp device, so don't mute stream if it has combo device.
Change-Id: Ib03dd7761d4e972233c633850bb480119ad6b503
-rw-r--r-- | hal/audio_hw.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index ee2ef52a..8a6011b3 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -10370,8 +10370,6 @@ int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *out, bool { struct audio_usecase *uc_info; struct audio_usecase *usecase; - float left_p; - float right_p; struct listnode devices; struct listnode *node; @@ -10420,33 +10418,31 @@ int check_a2dp_restore_l(struct audio_device *adev, struct stream_out *out, bool break; } } - left_p = out->volume_l; - right_p = out->volume_r; - out->a2dp_muted = true; - if (is_offload_usecase(out->usecase)) { - if (out->offload_state == OFFLOAD_STATE_PLAYING) - compress_pause(out->compr); - out_set_compr_volume(&out->stream, (float)0, (float)0); - } else if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP) { - out_set_voip_volume(&out->stream, (float)0, (float)0); - } else { - out_set_pcm_volume(&out->stream, (float)0, (float)0); - /* wait for stale pcm drained before switching to speaker */ - uint32_t latency = - (out->config.period_count * out->config.period_size * 1000) / - (out->config.rate); - usleep(latency * 1000); + if (uc_info->out_snd_device == SND_DEVICE_OUT_BT_A2DP) { + out->a2dp_muted = true; + if (is_offload_usecase(out->usecase)) { + if (out->offload_state == OFFLOAD_STATE_PLAYING) + compress_pause(out->compr); + out_set_compr_volume(&out->stream, (float)0, (float)0); + } else if (out->usecase == USECASE_AUDIO_PLAYBACK_VOIP) { + out_set_voip_volume(&out->stream, (float)0, (float)0); + } else { + out_set_pcm_volume(&out->stream, (float)0, (float)0); + /* wait for stale pcm drained before switching to speaker */ + uint32_t latency = + (out->config.period_count * out->config.period_size * 1000) / + (out->config.rate); + usleep(latency * 1000); + } } select_devices(adev, out->usecase); - ALOGD("%s: switched to device:%s and mute stream", - __func__, platform_get_snd_device_name(uc_info->out_snd_device)); + ALOGD("%s: switched to device:%s and stream muted:%d", __func__, + platform_get_snd_device_name(uc_info->out_snd_device), out->a2dp_muted); if (is_offload_usecase(out->usecase)) { if (out->offload_state == OFFLOAD_STATE_PLAYING) compress_resume(out->compr); } assign_devices(&out->device_list, &devices); - out->volume_l = left_p; - out->volume_r = right_p; } pthread_mutex_unlock(&out->latch_lock); } |