Update input read to better handle errors
Clear returned buffer and account for frames read.
Bug: 27545778
Change-Id: Ie7c618b7b50fe28731ccc79ef04b8b2de546cbb2
diff --git a/hal/audio_hw.c b/hal/audio_hw.c
index 296aaab..788e333 100644
--- a/hal/audio_hw.c
+++ b/hal/audio_hw.c
@@ -2066,7 +2066,9 @@
ALOGV("%s: read failed - sleeping for buffer duration", __func__);
usleep(bytes * 1000000 / audio_stream_in_frame_size(stream) /
in_get_sample_rate(&in->stream.common));
- } else {
+ memset(buffer, 0, bytes); // clear return data
+ }
+ if (bytes > 0) {
in->frames_read += bytes / audio_stream_in_frame_size(stream);
}
return bytes;