diff options
author | Glenn Kasten <gkasten@google.com> | 2012-12-17 11:44:20 -0800 |
---|---|---|
committer | Glenn Kasten <gkasten@google.com> | 2012-12-17 17:26:44 -0800 |
commit | 74b8adfbec4b34da7904de544f1e549e21a90426 (patch) | |
tree | 100e0a0a62d362be52e05e8d3988f20f4e5ae7bc /media/libmedia | |
parent | d272d6bf640dcaebeee7405469f9cacfa4bc1b72 (diff) | |
download | frameworks_av-74b8adfbec4b34da7904de544f1e549e21a90426.zip frameworks_av-74b8adfbec4b34da7904de544f1e549e21a90426.tar.gz frameworks_av-74b8adfbec4b34da7904de544f1e549e21a90426.tar.bz2 |
Fix bug with discarded AudioRecord::read count
Formerly, if an AudioRecord::read() got a timeout on obtainBuffer()
after already successfully transferring some data, then it returned zero.
This had the effect of discarding a partial transfer, which resulted in
a gap in the audio data delivered to the app. Now if a timeout occurs
after a partial transfer, it returns that partial transfer count so that
no data is lost.
Change-Id: I0d9c2f4e495a400b56ef916a06613ba26537ca97
Diffstat (limited to 'media/libmedia')
-rw-r--r-- | media/libmedia/AudioRecord.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp index c2ef68c..9fda0a5 100644 --- a/media/libmedia/AudioRecord.cpp +++ b/media/libmedia/AudioRecord.cpp @@ -644,7 +644,8 @@ ssize_t AudioRecord::read(void* buffer, size_t userSize) break; } if (err == status_t(TIMED_OUT)) { - err = 0; + // return partial transfer count + return read; } return ssize_t(err); } |