Loading hal/audio_hw.c +6 −0 Original line number Diff line number Diff line Loading @@ -2912,6 +2912,9 @@ static int stop_output_stream(struct stream_out *out) adev->offload_effects_stop_output(out->handle, out->pcm_device_id); } if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, false); /* 1. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info); Loading Loading @@ -3071,6 +3074,9 @@ int start_output_stream(struct stream_out *out) select_devices(adev, out->usecase); } if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, true); ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)", __func__, adev->snd_card, out->pcm_device_id, out->config.format); Loading hal/voice.c +36 −6 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -228,6 +228,7 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) uc_info->in_snd_device = SND_DEVICE_NONE; uc_info->out_snd_device = SND_DEVICE_NONE; adev->voice.use_device_mute = false; if (audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) { ALOGE("start_call: couldn't find BT SCO, SCO is not ready"); Loading Loading @@ -476,13 +477,21 @@ int voice_set_mic_mute(struct audio_device *adev, bool state) int err = 0; adev->voice.mic_mute = state; if (audio_extn_hfp_is_active(adev)) { err = hfp_set_mic_mute(adev, state); } else if (adev->mode == AUDIO_MODE_IN_CALL) { /* Use device mute if incall music delivery usecase is in progress */ if (adev->voice.use_device_mute) err = platform_set_device_mute(adev->platform, state, "tx"); else err = platform_set_mic_mute(adev->platform, state); ALOGV("%s: voice mute status=%d, use_device_mute flag=%d", __func__, state, adev->voice.use_device_mute); } else if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) { err = voice_extn_compress_voip_set_mic_mute(adev, state); } return err; } Loading @@ -491,6 +500,27 @@ bool voice_get_mic_mute(struct audio_device *adev) return adev->voice.mic_mute; } /* * Following function is called when incall music uplink usecase is * created or destroyed while mic is muted. If incall music uplink * usecase is active, apply voice device mute to mute only voice Tx * path and not the mixed voice Tx + inncall-music path. Revert to * voice stream mute once incall music uplink usecase is inactive */ void voice_set_device_mute_flag(struct audio_device *adev, bool state) { if (adev->voice.mic_mute) { if (state) { platform_set_device_mute(adev->platform, true, "tx"); platform_set_mic_mute(adev->platform, false); } else { platform_set_mic_mute(adev->platform, true); platform_set_device_mute(adev->platform, false, "tx"); } } adev->voice.use_device_mute = state; } int voice_set_volume(struct audio_device *adev, float volume) { int vol, err = 0; Loading hal/voice.h +4 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -61,6 +61,7 @@ struct voice { struct voice_session session[MAX_VOICE_SESSIONS]; int tty_mode; bool mic_mute; bool use_device_mute; float volume; bool in_call; }; Loading Loading @@ -101,4 +102,6 @@ void voice_check_and_update_aanc_path(struct audio_device *adev, snd_device_t out_snd_device, bool enable); bool voice_is_call_state_active(struct audio_device *adev); void voice_set_device_mute_flag (struct audio_device *adev, bool state); #endif //VOICE_H Loading
hal/audio_hw.c +6 −0 Original line number Diff line number Diff line Loading @@ -2912,6 +2912,9 @@ static int stop_output_stream(struct stream_out *out) adev->offload_effects_stop_output(out->handle, out->pcm_device_id); } if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, false); /* 1. Get and set stream specific mixer controls */ disable_audio_route(adev, uc_info); Loading Loading @@ -3071,6 +3074,9 @@ int start_output_stream(struct stream_out *out) select_devices(adev, out->usecase); } if (out->usecase == USECASE_INCALL_MUSIC_UPLINK) voice_set_device_mute_flag(adev, true); ALOGV("%s: Opening PCM device card_id(%d) device_id(%d) format(%#x)", __func__, adev->snd_card, out->pcm_device_id, out->config.format); Loading
hal/voice.c +36 −6 Original line number Diff line number Diff line /* * Copyright (c) 2013-2017, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -228,6 +228,7 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) uc_info->in_snd_device = SND_DEVICE_NONE; uc_info->out_snd_device = SND_DEVICE_NONE; adev->voice.use_device_mute = false; if (audio_is_bluetooth_sco_device(uc_info->devices) && !adev->bt_sco_on) { ALOGE("start_call: couldn't find BT SCO, SCO is not ready"); Loading Loading @@ -476,13 +477,21 @@ int voice_set_mic_mute(struct audio_device *adev, bool state) int err = 0; adev->voice.mic_mute = state; if (audio_extn_hfp_is_active(adev)) { err = hfp_set_mic_mute(adev, state); } else if (adev->mode == AUDIO_MODE_IN_CALL) { /* Use device mute if incall music delivery usecase is in progress */ if (adev->voice.use_device_mute) err = platform_set_device_mute(adev->platform, state, "tx"); else err = platform_set_mic_mute(adev->platform, state); ALOGV("%s: voice mute status=%d, use_device_mute flag=%d", __func__, state, adev->voice.use_device_mute); } else if (adev->mode == AUDIO_MODE_IN_COMMUNICATION) { err = voice_extn_compress_voip_set_mic_mute(adev, state); } return err; } Loading @@ -491,6 +500,27 @@ bool voice_get_mic_mute(struct audio_device *adev) return adev->voice.mic_mute; } /* * Following function is called when incall music uplink usecase is * created or destroyed while mic is muted. If incall music uplink * usecase is active, apply voice device mute to mute only voice Tx * path and not the mixed voice Tx + inncall-music path. Revert to * voice stream mute once incall music uplink usecase is inactive */ void voice_set_device_mute_flag(struct audio_device *adev, bool state) { if (adev->voice.mic_mute) { if (state) { platform_set_device_mute(adev->platform, true, "tx"); platform_set_mic_mute(adev->platform, false); } else { platform_set_mic_mute(adev->platform, true); platform_set_device_mute(adev->platform, false, "tx"); } } adev->voice.use_device_mute = state; } int voice_set_volume(struct audio_device *adev, float volume) { int vol, err = 0; Loading
hal/voice.h +4 −1 Original line number Diff line number Diff line /* * Copyright (c) 2013-2016, The Linux Foundation. All rights reserved. * Copyright (c) 2013-2018, The Linux Foundation. All rights reserved. * Not a contribution. * * Copyright (C) 2013 The Android Open Source Project Loading Loading @@ -61,6 +61,7 @@ struct voice { struct voice_session session[MAX_VOICE_SESSIONS]; int tty_mode; bool mic_mute; bool use_device_mute; float volume; bool in_call; }; Loading Loading @@ -101,4 +102,6 @@ void voice_check_and_update_aanc_path(struct audio_device *adev, snd_device_t out_snd_device, bool enable); bool voice_is_call_state_active(struct audio_device *adev); void voice_set_device_mute_flag (struct audio_device *adev, bool state); #endif //VOICE_H