summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndy Hung <hunga@google.com>2016-09-19 18:30:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2016-09-19 18:30:04 +0000
commitf6e202f58fde963533b457220799414d0d3db02d (patch)
treea56c742a4f018caa998f4b3c5d257f5c8321b216
parentdf65ad4ac45b428cb1c20abced6563659397cd82 (diff)
parentda9b56b59c8cca4b86fe26d1d4d41c14d0c58877 (diff)
downloadandroid_hardware_qcom_audio-f6e202f58fde963533b457220799414d0d3db02d.tar.gz
android_hardware_qcom_audio-f6e202f58fde963533b457220799414d0d3db02d.tar.bz2
android_hardware_qcom_audio-f6e202f58fde963533b457220799414d0d3db02d.zip
Merge "Fix out_write frame count to match return code." into nyc-mr1-dev
-rw-r--r--hal/audio_hw.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 35b726e0..e68535fd 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2063,14 +2063,16 @@ static ssize_t out_write(struct audio_stream_out *stream, const void *buffer,
else
ret = pcm_write(out->pcm, (void *)buffer, bytes);
- if (ret == 0)
- out->written += bytes / (out->config.channels * sizeof(short));
-
release_out_focus(out, ns);
}
}
exit:
+ // For PCM we always consume the buffer and return #bytes regardless of ret.
+ if (out->usecase != USECASE_AUDIO_PLAYBACK_OFFLOAD) {
+ out->written += bytes / (out->config.channels * sizeof(short));
+ }
+
pthread_mutex_unlock(&out->lock);
if (ret != 0) {