Loading hal/audio_hw.c +6 −0 Original line number Diff line number Diff line Loading @@ -1980,6 +1980,9 @@ static int stop_output_stream(struct stream_out *out) audio_low_latency_hint_end(); } 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 @@ -2103,6 +2106,9 @@ int start_output_stream(struct stream_out *out) audio_extn_extspk_update(adev->extspk); 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); if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { Loading hal/audio_hw.h +1 −0 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ struct audio_device { bool enable_voicerx; bool enable_hfp; bool mic_break_enabled; bool use_voice_device_mute; int snd_card; void *platform; Loading hal/msm8974/platform.c +1 −1 Original line number Diff line number Diff line Loading @@ -2479,7 +2479,7 @@ int platform_set_mic_mute(void *platform, bool state) __func__, mixer_ctl_name); return -EINVAL; } ALOGV("Setting voice mute state: %d", state); ALOGV("%s: Setting voice mute state: %d", __func__, state); mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values)); if (my_data->csd != NULL) { Loading hal/voice.c +32 −2 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) uc_info->devices = adev->current_call_output ->devices; uc_info->in_snd_device = SND_DEVICE_NONE; uc_info->out_snd_device = SND_DEVICE_NONE; adev->use_voice_device_mute = false; list_add_tail(&adev->usecase_list, &uc_info->list); Loading Loading @@ -356,11 +357,19 @@ int voice_check_and_set_incall_music_usecase(struct audio_device *adev, int voice_set_mic_mute(struct audio_device *adev, bool state) { int err = 0; struct audio_usecase *usecase = NULL; adev->voice.mic_mute = state; if (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_IN_COMMUNICATION) adev->mode == AUDIO_MODE_IN_COMMUNICATION) { /* Use device mute if incall music delivery usecase is in progress */ if (adev->use_voice_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_voice_device_mute_flag=%d", __func__, state, adev->use_voice_device_mute); } return err; } Loading @@ -370,6 +379,25 @@ 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->use_voice_device_mute = state; } int voice_set_volume(struct audio_device *adev, float volume) { int vol, err = 0; Loading Loading @@ -516,6 +544,8 @@ void voice_init(struct audio_device *adev) adev->voice.volume = 1.0f; adev->voice.mic_mute = false; adev->voice.in_call = false; adev->use_voice_device_mute = false; for (i = 0; i < MAX_VOICE_SESSIONS; i++) { adev->voice.session[i].pcm_rx = NULL; adev->voice.session[i].pcm_tx = NULL; Loading hal/voice.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,4 +95,6 @@ void voice_set_sidetone(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 @@ -1980,6 +1980,9 @@ static int stop_output_stream(struct stream_out *out) audio_low_latency_hint_end(); } 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 @@ -2103,6 +2106,9 @@ int start_output_stream(struct stream_out *out) audio_extn_extspk_update(adev->extspk); 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); if (out->usecase == USECASE_AUDIO_PLAYBACK_OFFLOAD) { Loading
hal/audio_hw.h +1 −0 Original line number Diff line number Diff line Loading @@ -329,6 +329,7 @@ struct audio_device { bool enable_voicerx; bool enable_hfp; bool mic_break_enabled; bool use_voice_device_mute; int snd_card; void *platform; Loading
hal/msm8974/platform.c +1 −1 Original line number Diff line number Diff line Loading @@ -2479,7 +2479,7 @@ int platform_set_mic_mute(void *platform, bool state) __func__, mixer_ctl_name); return -EINVAL; } ALOGV("Setting voice mute state: %d", state); ALOGV("%s: Setting voice mute state: %d", __func__, state); mixer_ctl_set_array(ctl, set_values, ARRAY_SIZE(set_values)); if (my_data->csd != NULL) { Loading
hal/voice.c +32 −2 Original line number Diff line number Diff line Loading @@ -170,6 +170,7 @@ int voice_start_usecase(struct audio_device *adev, audio_usecase_t usecase_id) uc_info->devices = adev->current_call_output ->devices; uc_info->in_snd_device = SND_DEVICE_NONE; uc_info->out_snd_device = SND_DEVICE_NONE; adev->use_voice_device_mute = false; list_add_tail(&adev->usecase_list, &uc_info->list); Loading Loading @@ -356,11 +357,19 @@ int voice_check_and_set_incall_music_usecase(struct audio_device *adev, int voice_set_mic_mute(struct audio_device *adev, bool state) { int err = 0; struct audio_usecase *usecase = NULL; adev->voice.mic_mute = state; if (adev->mode == AUDIO_MODE_IN_CALL || adev->mode == AUDIO_MODE_IN_COMMUNICATION) adev->mode == AUDIO_MODE_IN_COMMUNICATION) { /* Use device mute if incall music delivery usecase is in progress */ if (adev->use_voice_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_voice_device_mute_flag=%d", __func__, state, adev->use_voice_device_mute); } return err; } Loading @@ -370,6 +379,25 @@ 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->use_voice_device_mute = state; } int voice_set_volume(struct audio_device *adev, float volume) { int vol, err = 0; Loading Loading @@ -516,6 +544,8 @@ void voice_init(struct audio_device *adev) adev->voice.volume = 1.0f; adev->voice.mic_mute = false; adev->voice.in_call = false; adev->use_voice_device_mute = false; for (i = 0; i < MAX_VOICE_SESSIONS; i++) { adev->voice.session[i].pcm_rx = NULL; adev->voice.session[i].pcm_tx = NULL; Loading
hal/voice.h +2 −0 Original line number Diff line number Diff line Loading @@ -95,4 +95,6 @@ void voice_set_sidetone(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