Loading hal/audio_hw.c +11 −4 Original line number Diff line number Diff line Loading @@ -918,8 +918,14 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) (usecase->in_snd_device != SND_DEVICE_NONE) && (usecase->out_snd_device != SND_DEVICE_NONE)) { status = platform_switch_voice_call_device_pre(adev->platform); /* Disable sidetone only if voice call already exists */ if (voice_is_call_state_active(adev)) } if (((usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { /* Disable sidetone only if voice/voip call already exists */ if (voice_is_call_state_active(adev) || voice_extn_compress_voip_is_started(adev)) voice_set_sidetone(adev, usecase->out_snd_device, false); } Loading Loading @@ -963,8 +969,9 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) out_snd_device, in_snd_device); enable_audio_route_for_voice_usecases(adev, usecase); /* Enable sidetone only if voice call already exists */ if (voice_is_call_state_active(adev)) /* Enable sidetone only if voice/voip call already exists */ if (voice_is_call_state_active(adev) || voice_extn_compress_voip_is_started(adev)) voice_set_sidetone(adev, out_snd_device, true); } Loading hal/voice_extn/compress_voip.c +30 −22 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ static int voip_stop_call(struct audio_device *adev) __func__, USECASE_COMPRESS_VOIP_CALL); return -EINVAL; } voice_set_sidetone(adev, uc_info->out_snd_device, false); /* 1. Close the PCM devices */ if (voip_data.pcm_rx) { Loading Loading @@ -365,19 +366,6 @@ static int voip_start_call(struct audio_device *adev, goto error_start_voip; } ALOGD("%s: Opening PCM playback device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_rx_id); voip_data.pcm_rx = pcm_open(adev->snd_card, pcm_dev_rx_id, flags, voip_config); if (voip_data.pcm_rx && !pcm_is_ready(voip_data.pcm_rx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_rx)); pcm_close(voip_data.pcm_rx); voip_data.pcm_rx = NULL; ret = -EIO; goto error_start_voip; } ALOGD("%s: Opening PCM capture device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_tx_id); voip_data.pcm_tx = pcm_open(adev->snd_card, Loading @@ -385,24 +373,34 @@ static int voip_start_call(struct audio_device *adev, PCM_IN, voip_config); if (voip_data.pcm_tx && !pcm_is_ready(voip_data.pcm_tx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_tx)); pcm_close(voip_data.pcm_rx); pcm_close(voip_data.pcm_tx); voip_data.pcm_tx = NULL; if (voip_data.pcm_rx) { ret = -EIO; goto error_start_voip; } ALOGD("%s: Opening PCM playback device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_rx_id); voip_data.pcm_rx = pcm_open(adev->snd_card, pcm_dev_rx_id, flags, voip_config); if (voip_data.pcm_rx && !pcm_is_ready(voip_data.pcm_rx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_rx)); pcm_close(voip_data.pcm_rx); voip_data.pcm_rx = NULL; if (voip_data.pcm_tx) { pcm_close(voip_data.pcm_tx); voip_data.pcm_tx = NULL; } ret = -EIO; goto error_start_voip; } pcm_start(voip_data.pcm_rx); pcm_start(voip_data.pcm_tx); pcm_start(voip_data.pcm_rx); voice_set_sidetone(adev, uc_info->out_snd_device, true); voice_extn_compress_voip_set_volume(adev, adev->voice.volume); if (ret < 0) { ALOGE("%s: error %d\n", __func__, ret); goto error_start_voip; } } else { ALOGV("%s: voip usecase is already enabled", __func__); if (voip_data.out_stream) Loading Loading @@ -813,3 +811,13 @@ bool voice_extn_compress_voip_is_config_supported(struct audio_config *config) } return ret; } bool voice_extn_compress_voip_is_started(struct audio_device *adev) { bool ret = false; if (voice_extn_compress_voip_is_active(adev) && voip_data.pcm_tx && voip_data.pcm_rx) ret = true; return ret; } hal/voice_extn/voice_extn.h +7 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ bool voice_extn_compress_voip_pcm_prop_check(); bool voice_extn_compress_voip_is_active(struct audio_device *adev); bool voice_extn_compress_voip_is_format_supported(audio_format_t format); bool voice_extn_compress_voip_is_config_supported(struct audio_config *config); bool voice_extn_compress_voip_is_started(struct audio_device *adev); #else static int voice_extn_compress_voip_close_output_stream(struct audio_stream *stream __unused) { Loading Loading @@ -264,6 +265,12 @@ static bool voice_extn_compress_voip_is_config_supported(struct audio_config *co ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__); return true; } static bool voice_extn_compress_voip_is_started(struct audio_device *adev __unused) { ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__); return false; } #endif #endif //VOICE_EXTN_H Loading
hal/audio_hw.c +11 −4 Original line number Diff line number Diff line Loading @@ -918,8 +918,14 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) (usecase->in_snd_device != SND_DEVICE_NONE) && (usecase->out_snd_device != SND_DEVICE_NONE)) { status = platform_switch_voice_call_device_pre(adev->platform); /* Disable sidetone only if voice call already exists */ if (voice_is_call_state_active(adev)) } if (((usecase->type == VOICE_CALL) || (usecase->type == VOIP_CALL)) && (usecase->out_snd_device != SND_DEVICE_NONE)) { /* Disable sidetone only if voice/voip call already exists */ if (voice_is_call_state_active(adev) || voice_extn_compress_voip_is_started(adev)) voice_set_sidetone(adev, usecase->out_snd_device, false); } Loading Loading @@ -963,8 +969,9 @@ int select_devices(struct audio_device *adev, audio_usecase_t uc_id) out_snd_device, in_snd_device); enable_audio_route_for_voice_usecases(adev, usecase); /* Enable sidetone only if voice call already exists */ if (voice_is_call_state_active(adev)) /* Enable sidetone only if voice/voip call already exists */ if (voice_is_call_state_active(adev) || voice_extn_compress_voip_is_started(adev)) voice_set_sidetone(adev, out_snd_device, true); } Loading
hal/voice_extn/compress_voip.c +30 −22 Original line number Diff line number Diff line Loading @@ -294,6 +294,7 @@ static int voip_stop_call(struct audio_device *adev) __func__, USECASE_COMPRESS_VOIP_CALL); return -EINVAL; } voice_set_sidetone(adev, uc_info->out_snd_device, false); /* 1. Close the PCM devices */ if (voip_data.pcm_rx) { Loading Loading @@ -365,19 +366,6 @@ static int voip_start_call(struct audio_device *adev, goto error_start_voip; } ALOGD("%s: Opening PCM playback device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_rx_id); voip_data.pcm_rx = pcm_open(adev->snd_card, pcm_dev_rx_id, flags, voip_config); if (voip_data.pcm_rx && !pcm_is_ready(voip_data.pcm_rx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_rx)); pcm_close(voip_data.pcm_rx); voip_data.pcm_rx = NULL; ret = -EIO; goto error_start_voip; } ALOGD("%s: Opening PCM capture device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_tx_id); voip_data.pcm_tx = pcm_open(adev->snd_card, Loading @@ -385,24 +373,34 @@ static int voip_start_call(struct audio_device *adev, PCM_IN, voip_config); if (voip_data.pcm_tx && !pcm_is_ready(voip_data.pcm_tx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_tx)); pcm_close(voip_data.pcm_rx); pcm_close(voip_data.pcm_tx); voip_data.pcm_tx = NULL; if (voip_data.pcm_rx) { ret = -EIO; goto error_start_voip; } ALOGD("%s: Opening PCM playback device card_id(%d) device_id(%d)", __func__, adev->snd_card, pcm_dev_rx_id); voip_data.pcm_rx = pcm_open(adev->snd_card, pcm_dev_rx_id, flags, voip_config); if (voip_data.pcm_rx && !pcm_is_ready(voip_data.pcm_rx)) { ALOGE("%s: %s", __func__, pcm_get_error(voip_data.pcm_rx)); pcm_close(voip_data.pcm_rx); voip_data.pcm_rx = NULL; if (voip_data.pcm_tx) { pcm_close(voip_data.pcm_tx); voip_data.pcm_tx = NULL; } ret = -EIO; goto error_start_voip; } pcm_start(voip_data.pcm_rx); pcm_start(voip_data.pcm_tx); pcm_start(voip_data.pcm_rx); voice_set_sidetone(adev, uc_info->out_snd_device, true); voice_extn_compress_voip_set_volume(adev, adev->voice.volume); if (ret < 0) { ALOGE("%s: error %d\n", __func__, ret); goto error_start_voip; } } else { ALOGV("%s: voip usecase is already enabled", __func__); if (voip_data.out_stream) Loading Loading @@ -813,3 +811,13 @@ bool voice_extn_compress_voip_is_config_supported(struct audio_config *config) } return ret; } bool voice_extn_compress_voip_is_started(struct audio_device *adev) { bool ret = false; if (voice_extn_compress_voip_is_active(adev) && voip_data.pcm_tx && voip_data.pcm_rx) ret = true; return ret; }
hal/voice_extn/voice_extn.h +7 −0 Original line number Diff line number Diff line Loading @@ -145,6 +145,7 @@ bool voice_extn_compress_voip_pcm_prop_check(); bool voice_extn_compress_voip_is_active(struct audio_device *adev); bool voice_extn_compress_voip_is_format_supported(audio_format_t format); bool voice_extn_compress_voip_is_config_supported(struct audio_config *config); bool voice_extn_compress_voip_is_started(struct audio_device *adev); #else static int voice_extn_compress_voip_close_output_stream(struct audio_stream *stream __unused) { Loading Loading @@ -264,6 +265,12 @@ static bool voice_extn_compress_voip_is_config_supported(struct audio_config *co ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__); return true; } static bool voice_extn_compress_voip_is_started(struct audio_device *adev __unused) { ALOGE("%s: COMPRESS_VOIP_ENABLED is not defined", __func__); return false; } #endif #endif //VOICE_EXTN_H