diff options
author | Narsinga Rao Chella <nrchella@codeaurora.org> | 2015-08-14 18:00:08 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2015-08-26 03:42:51 -0700 |
commit | 116142b2b97350e1898707d21ad0a8c7a7e2fac5 (patch) | |
tree | 3b66c80f9c655245331bd98b85dab105756b6d30 /hal/voice_extn | |
parent | bd40126d216181e2a67f732b17f8dbe0671cbb2b (diff) | |
download | hardware_qcom_audio-116142b2b97350e1898707d21ad0a8c7a7e2fac5.tar.gz hardware_qcom_audio-116142b2b97350e1898707d21ad0a8c7a7e2fac5.tar.bz2 hardware_qcom_audio-116142b2b97350e1898707d21ad0a8c7a7e2fac5.zip |
hal: enable sidetone for VoIP calls on voice path
Add support for sidetone for VoIP calls on voice path.
Enable/disbale sidetone during VoIP call set up/tear down
and also during device switch.
CRs-fixed: 890371
Change-Id: Ib79eed79ddcd2bfed1d9bc322195036736a67cb2
Diffstat (limited to 'hal/voice_extn')
-rw-r--r-- | hal/voice_extn/compress_voip.c | 52 | ||||
-rw-r--r-- | hal/voice_extn/voice_extn.h | 7 |
2 files changed, 37 insertions, 22 deletions
diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c index b8c38fd1..f7c99c52 100644 --- a/hal/voice_extn/compress_voip.c +++ b/hal/voice_extn/compress_voip.c @@ -238,6 +238,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) { @@ -309,6 +310,19 @@ static int voip_start_call(struct audio_device *adev, 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, + pcm_dev_tx_id, + 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_tx); + voip_data.pcm_tx = NULL; + 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, @@ -318,35 +332,19 @@ static int voip_start_call(struct audio_device *adev, 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, - pcm_dev_tx_id, - 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); - voip_data.pcm_tx = NULL; - if (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) @@ -726,3 +724,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; +} diff --git a/hal/voice_extn/voice_extn.h b/hal/voice_extn/voice_extn.h index 4a04adb8..af0ad08b 100644 --- a/hal/voice_extn/voice_extn.h +++ b/hal/voice_extn/voice_extn.h @@ -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) { @@ -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 |