summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornadlabak <pavel@doshaska.net>2016-01-21 22:20:26 +0100
committerArne Coucheron <arco68@gmail.com>2016-04-24 10:54:36 -0700
commitd330e5b1c1bb1ce0ef6a4411ef7c912b5af7b2b8 (patch)
tree22e2ded0eabefd95b0fa5e708195e1fecf6c8906
parentb932690a3731dcccf9c851bf6556c4dd18941702 (diff)
downloadhardware_qcom_audio-d330e5b1c1bb1ce0ef6a4411ef7c912b5af7b2b8.tar.gz
hardware_qcom_audio-d330e5b1c1bb1ce0ef6a4411ef7c912b5af7b2b8.tar.bz2
hardware_qcom_audio-d330e5b1c1bb1ce0ef6a4411ef7c912b5af7b2b8.zip
alsa_sound: Fix handling of zero size write request
Previously, periodSize number of bytes from the buffer pointer location were always written to PCM even in the case when the write call specified 0 bytes buffer size. This caused short pop noise at the beginning of the playback after the "audio flinger: force audio path start from normal mixer" fake write() of 0 bytes introduction in audioflinger. RM-208 Change-Id: Ifeb353fed01a2f2b7e771a7ccb7d422f77a69228 (cherry picked from commit cb0a9ef95d65dc5d872e15afeac9c6b2fc74c51b)
-rw-r--r--legacy/alsa_sound/AudioStreamOutALSA.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/legacy/alsa_sound/AudioStreamOutALSA.cpp b/legacy/alsa_sound/AudioStreamOutALSA.cpp
index 0db56494..9d6ea89e 100644
--- a/legacy/alsa_sound/AudioStreamOutALSA.cpp
+++ b/legacy/alsa_sound/AudioStreamOutALSA.cpp
@@ -112,6 +112,10 @@ ssize_t AudioStreamOutALSA::write(const void *buffer, size_t bytes)
int write_pending = bytes;
+ if (bytes == 0) {
+ return 0;
+ }
+
if((strcmp(mHandle->useCase, SND_USE_CASE_VERB_IP_VOICECALL)) &&
(strcmp(mHandle->useCase, SND_USE_CASE_MOD_PLAY_VOIP))) {
mParent->mLock.lock();