diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2016-04-04 03:24:20 -0600 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2016-04-04 03:24:20 -0600 |
commit | 2a1c53ce39c42b53785029b7b25f74fff9ebb919 (patch) | |
tree | 85642176d4158ab484d423c80efe68f2780abb75 | |
parent | 8594349545aae6b38098dc14acbd0c0b13a5c7be (diff) | |
parent | 492b2fe6d50c0d6b6808ef5be769044b54ce2a83 (diff) | |
download | android_hardware_qcom_audio-2a1c53ce39c42b53785029b7b25f74fff9ebb919.tar.gz android_hardware_qcom_audio-2a1c53ce39c42b53785029b7b25f74fff9ebb919.tar.bz2 android_hardware_qcom_audio-2a1c53ce39c42b53785029b7b25f74fff9ebb919.zip |
Merge 492b2fe6d50c0d6b6808ef5be769044b54ce2a83 on remote branch
Change-Id: I7068f93316ae78399ec51d0600a001c20a98eb11
-rwxr-xr-x[-rw-r--r--] | hal/audio_hw.c | 8 | ||||
-rw-r--r-- | hal/msm8974/platform.c | 13 | ||||
-rw-r--r-- | hal/msm8974/platform.h | 4 | ||||
-rw-r--r-- | hal/voice_extn/compress_voip.c | 46 | ||||
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 14 |
5 files changed, 68 insertions, 17 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index fc7c84ea..d7a3169c 100644..100755 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -2782,7 +2782,8 @@ static int in_set_parameters(struct audio_stream *stream, const char *kvpairs) if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) && (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION) && (voice_extn_compress_voip_is_format_supported(in->format)) && - (in->config.rate == 8000 || in->config.rate == 16000) && + (in->config.rate == 8000 || in->config.rate == 16000 || + in->config.rate == 32000 || in->config.rate == 48000 ) && (audio_channel_count_from_in_mask(in->channel_mask) == 1)) { err = voice_extn_compress_voip_open_input_stream(in); if (err != 0) { @@ -3434,6 +3435,8 @@ static int adev_set_parameters(struct audio_hw_device *dev, const char *kvpairs) struct audio_usecase *usecase; ALOGD("Received sound card OFFLINE status"); set_snd_card_state(adev,SND_CARD_STATE_OFFLINE); + //close compress sessions on OFFLINE status + close_compress_sessions(adev); } else if (strstr(snd_card_status, "ONLINE")) { ALOGD("Received sound card ONLINE status"); set_snd_card_state(adev,SND_CARD_STATE_ONLINE); @@ -3784,7 +3787,8 @@ static int adev_open_input_stream(struct audio_hw_device *dev, if ((in->source == AUDIO_SOURCE_VOICE_COMMUNICATION) && (in->dev->mode == AUDIO_MODE_IN_COMMUNICATION) && (voice_extn_compress_voip_is_format_supported(in->format)) && - (in->config.rate == 8000 || in->config.rate == 16000) && + (in->config.rate == 8000 || in->config.rate == 16000 || + in->config.rate == 32000 || in->config.rate == 48000) && (audio_channel_count_from_in_mask(in->channel_mask) == 1)) { voice_extn_compress_voip_open_input_stream(in); } diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c index d9e7745c..c8edd3ee 100644 --- a/hal/msm8974/platform.c +++ b/hal/msm8974/platform.c @@ -2686,11 +2686,16 @@ snd_device_t platform_get_input_snd_device(void *platform, audio_devices_t out_d if (in_device & AUDIO_DEVICE_IN_BUILTIN_MIC) { if (channel_count == 2) { snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_STEREO; - } else if (adev->active_input->enable_ns) - snd_device = SND_DEVICE_IN_VOICE_REC_MIC_NS; - else if (my_data->fluence_type != FLUENCE_NONE && + } else if (my_data->fluence_type != FLUENCE_NONE && my_data->fluence_in_voice_rec) { - snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE; + if (my_data->fluence_type & FLUENCE_QUAD_MIC) { + snd_device = SND_DEVICE_IN_HANDSET_QMIC; + } else { + snd_device = SND_DEVICE_IN_VOICE_REC_DMIC_FLUENCE; + } + platform_set_echo_reference(adev->platform, true, out_device); + } else if (adev->active_input->enable_ns) { + snd_device = SND_DEVICE_IN_VOICE_REC_MIC_NS; } else { snd_device = SND_DEVICE_IN_VOICE_REC_MIC; } diff --git a/hal/msm8974/platform.h b/hal/msm8974/platform.h index 6263f4e0..4f2bb3d5 100644 --- a/hal/msm8974/platform.h +++ b/hal/msm8974/platform.h @@ -263,7 +263,7 @@ enum { #define PLAYBACK_OFFLOAD_DEVICE2 17 #endif -#ifdef PLATFORM_APQ8084 +#if defined (PLATFORM_APQ8084) || defined (PLATFORM_MSM8996) #define PLAYBACK_OFFLOAD_DEVICE3 18 #define PLAYBACK_OFFLOAD_DEVICE4 34 #define PLAYBACK_OFFLOAD_DEVICE5 35 @@ -272,7 +272,7 @@ enum { #define PLAYBACK_OFFLOAD_DEVICE8 38 #define PLAYBACK_OFFLOAD_DEVICE9 39 #endif -#if defined (PLATFORM_MSM8994) || defined (PLATFORM_MSM8996) +#ifdef PLATFORM_MSM8994 #define PLAYBACK_OFFLOAD_DEVICE3 18 #define PLAYBACK_OFFLOAD_DEVICE4 37 #define PLAYBACK_OFFLOAD_DEVICE5 38 diff --git a/hal/voice_extn/compress_voip.c b/hal/voice_extn/compress_voip.c index 61a7f3e7..74046179 100644 --- a/hal/voice_extn/compress_voip.c +++ b/hal/voice_extn/compress_voip.c @@ -38,6 +38,8 @@ #define COMPRESS_VOIP_IO_BUF_SIZE_NB 320 #define COMPRESS_VOIP_IO_BUF_SIZE_WB 640 +#define COMPRESS_VOIP_IO_BUF_SIZE_SWB 1280 +#define COMPRESS_VOIP_IO_BUF_SIZE_FB 1920 struct pcm_config pcm_config_voip_nb = { .channels = 1, @@ -55,6 +57,22 @@ struct pcm_config pcm_config_voip_wb = { .format = PCM_FORMAT_S16_LE, }; +struct pcm_config pcm_config_voip_swb = { + .channels = 1, + .rate = 32000, /* changed when the stream is opened */ + .period_size = COMPRESS_VOIP_IO_BUF_SIZE_SWB/2, + .period_count = 10, + .format = PCM_FORMAT_S16_LE, +}; + +struct pcm_config pcm_config_voip_fb = { + .channels = 1, + .rate = 48000, /* changed when the stream is opened */ + .period_size = COMPRESS_VOIP_IO_BUF_SIZE_FB/2, + .period_count = 10, + .format = PCM_FORMAT_S16_LE, +}; + struct voip_data { struct pcm *pcm_rx; struct pcm *pcm_tx; @@ -467,15 +485,24 @@ void voice_extn_compress_voip_in_get_parameters(struct stream_in *in, int voice_extn_compress_voip_out_get_buffer_size(struct stream_out *out) { - if (out->config.rate == 16000) + if (out->config.rate == 48000) + return COMPRESS_VOIP_IO_BUF_SIZE_FB; + else if (out->config.rate== 32000) + return COMPRESS_VOIP_IO_BUF_SIZE_SWB; + else if (out->config.rate == 16000) return COMPRESS_VOIP_IO_BUF_SIZE_WB; else return COMPRESS_VOIP_IO_BUF_SIZE_NB; + } int voice_extn_compress_voip_in_get_buffer_size(struct stream_in *in) { - if (in->config.rate == 16000) + if (in->config.rate == 48000) + return COMPRESS_VOIP_IO_BUF_SIZE_FB; + else if (in->config.rate== 32000) + return COMPRESS_VOIP_IO_BUF_SIZE_SWB; + else if (in->config.rate == 16000) return COMPRESS_VOIP_IO_BUF_SIZE_WB; else return COMPRESS_VOIP_IO_BUF_SIZE_NB; @@ -570,7 +597,11 @@ int voice_extn_compress_voip_open_output_stream(struct stream_out *out) out->supported_channel_masks[0] = AUDIO_CHANNEL_OUT_MONO; out->channel_mask = AUDIO_CHANNEL_OUT_MONO; out->usecase = USECASE_COMPRESS_VOIP_CALL; - if (out->sample_rate == 16000) + if (out->sample_rate == 48000) + out->config = pcm_config_voip_fb; + else if (out->sample_rate == 32000) + out->config = pcm_config_voip_swb; + else if (out->sample_rate == 16000) out->config = pcm_config_voip_wb; else out->config = pcm_config_voip_nb; @@ -624,7 +655,11 @@ int voice_extn_compress_voip_open_input_stream(struct stream_in *in) goto done; in->usecase = USECASE_COMPRESS_VOIP_CALL; - if (in->config.rate == 16000) + if (in->config.rate == 48000) + in->config = pcm_config_voip_fb; + else if (in->config.rate == 32000) + in->config = pcm_config_voip_swb; + else if (in->config.rate == 16000) in->config = pcm_config_voip_wb; else in->config = pcm_config_voip_nb; @@ -716,7 +751,8 @@ bool voice_extn_compress_voip_is_config_supported(struct audio_config *config) ret = voice_extn_compress_voip_is_format_supported(config->format); if (ret) { if ((popcount(config->channel_mask) == 1) && - (config->sample_rate == 8000 || config->sample_rate == 16000)) + (config->sample_rate == 8000 || config->sample_rate == 16000 || + config->sample_rate == 32000 || config->sample_rate == 48000)) ret = ((voip_data.sample_rate == 0) ? true: (voip_data.sample_rate == config->sample_rate)); else diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index 34527cbe..6ba5fddd 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -1422,7 +1422,8 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( if ((stream == AUDIO_STREAM_VOICE_CALL) && (channelMask == 1) && - (samplingRate == 8000 || samplingRate == 16000)) { + (samplingRate == 8000 || samplingRate == 16000 || + samplingRate == 32000 || samplingRate == 48000)) { // Allow Voip direct output only if: // audio mode is MODE_IN_COMMUNCATION; AND // voip output is not opened already; AND @@ -1903,10 +1904,15 @@ status_t AudioPolicyManagerCustom::startInput(audio_io_handle_t input, // If the already active input uses AUDIO_SOURCE_HOTWORD then it is closed, // otherwise the active input continues and the new input cannot be started. sp<AudioInputDescriptor> activeDesc = mInputs.valueFor(activeInput); - if (activeDesc->mInputSource == AUDIO_SOURCE_HOTWORD) { + if ((activeDesc->mInputSource == AUDIO_SOURCE_HOTWORD) && + !activeDesc->hasPreemptedSession(session)) { ALOGW("startInput(%d) preempting low-priority input %d", input, activeInput); - stopInput(activeInput, activeDesc->mSessions.itemAt(0)); - releaseInput(activeInput, activeDesc->mSessions.itemAt(0)); + audio_session_t activeSession = activeDesc->mSessions.itemAt(0); + SortedVector<audio_session_t> sessions = activeDesc->getPreemptedSessions(); + sessions.add(activeSession); + inputDesc->setPreemptedSessions(sessions); + stopInput(activeInput, activeSession); + releaseInput(activeInput, activeSession); } else { ALOGE("startInput(%d) failed: other input %d already started", input, activeInput); return INVALID_OPERATION; |