diff options
author | Linux Build Service Account <lnxbuild@localhost> | 2017-06-13 11:18:14 -0600 |
---|---|---|
committer | Linux Build Service Account <lnxbuild@localhost> | 2017-06-13 11:18:14 -0600 |
commit | f83bb7630c5f7f6f6bf93a07ff03931251f0e349 (patch) | |
tree | 7b32db2bbe10cef4f191c60284ca107bf9deb43e | |
parent | b3cdad7838f144ee650a1c1e09ccba17960bce1b (diff) | |
parent | 6de709811acb151357360855602b59f2b7b2bcea (diff) | |
download | hardware_qcom_audio-f83bb7630c5f7f6f6bf93a07ff03931251f0e349.tar.gz hardware_qcom_audio-f83bb7630c5f7f6f6bf93a07ff03931251f0e349.tar.bz2 hardware_qcom_audio-f83bb7630c5f7f6f6bf93a07ff03931251f0e349.zip |
Promotion of audio-userspace.lnx.2.2.c2-00039.
CRs Change ID Subject
--------------------------------------------------------------------------------------------------------------
2052745 I74269ffe15ef021bf57f5bea4eada44f67c51981 hal: Fix underrun in Compress VOIP path
2051669 I878486d8e0805d9fccae524c5fc2fc6240dfe8f9 policy_hal: fix VoIP rx path use ULL usecase
Change-Id: I8055ffdb0d904835a0c59afe43b887978f1d5d76
CRs-Fixed: 2052745, 2051669
-rw-r--r-- | hal/audio_hw.c | 21 | ||||
-rw-r--r-- | policy_hal/AudioPolicyManager.cpp | 3 |
2 files changed, 23 insertions, 1 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c index 93871e5d..0feb123d 100644 --- a/hal/audio_hw.c +++ b/hal/audio_hw.c @@ -3228,7 +3228,26 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer, out->config.channels * format_to_bitwidth_table[out->hal_op_format])); } else { - ret = pcm_write(out->pcm, (void *)buffer, bytes); + /* + * To avoid underrun in DSP when the application is not pumping + * data at required rate, check for the no. of bytes and ignore + * pcm_write if it is less than actual buffer size. + * It is a work around to a change in compress VOIP driver. + */ + if ((out->flags & AUDIO_OUTPUT_FLAG_VOIP_RX) && + bytes < (out->config.period_size * out->config.channels * + audio_bytes_per_sample(out->format))) { + size_t voip_buf_size = + out->config.period_size * out->config.channels * + audio_bytes_per_sample(out->format); + ALOGE("%s:VOIP underrun: bytes received %zu, required:%zu\n", + __func__, bytes, voip_buf_size); + usleep(((uint64_t)voip_buf_size - bytes) * + 1000000 / audio_stream_out_frame_size(stream) / + out_get_sample_rate(&out->stream.common)); + ret = 0; + } else + ret = pcm_write(out->pcm, (void *)buffer, bytes); } release_out_focus(out); diff --git a/policy_hal/AudioPolicyManager.cpp b/policy_hal/AudioPolicyManager.cpp index cb22dc75..41847e78 100644 --- a/policy_hal/AudioPolicyManager.cpp +++ b/policy_hal/AudioPolicyManager.cpp @@ -1625,6 +1625,9 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice( flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_VOIP_RX | AUDIO_OUTPUT_FLAG_DIRECT); ALOGD("Set VoIP and Direct output flags for PCM format"); + } else { + //If VoIP is going in audio path, make VoIP use primary output + flags = (audio_output_flags_t)(AUDIO_OUTPUT_FLAG_FAST|AUDIO_OUTPUT_FLAG_PRIMARY); } } } |