summaryrefslogtreecommitdiffstats
path: root/media/libmedia/AudioRecord.cpp
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2014-01-14 15:46:38 -0800
committerGlenn Kasten <gkasten@google.com>2014-01-16 11:51:05 -0800
commitd8a9d0220e84ae0b5049385aa9b1a0d8ea02b5bb (patch)
treeb5d225289ed7b931c53bd555999fdfa23b8df694 /media/libmedia/AudioRecord.cpp
parenta238b9b43a2b8dac60e0fd8700daa6cd4f644547 (diff)
downloadframeworks_av-d8a9d0220e84ae0b5049385aa9b1a0d8ea02b5bb.zip
frameworks_av-d8a9d0220e84ae0b5049385aa9b1a0d8ea02b5bb.tar.gz
frameworks_av-d8a9d0220e84ae0b5049385aa9b1a0d8ea02b5bb.tar.bz2
Cleanup loop termination logic in AudioRecord::obtainBuffer()
Apply the same change to AudioRecord, that was already done for AudioTrack in this CL: > Change-Id: I0fc48117946364cb255afd653195498891f622bd If the proxy->obtainBuffer at the end of the "do" loop fails with status DEAD_OBJECT, and the restoreRecord_l during the next trip of the "do" loop also fails, then the value of the buffer fields will be based on the previous proxy->obtainBuffer that returned DEAD_OBJECT. This will have cleared the buffer, but it's tricky. So instead explicitly clear the buffer after restoreRecord_l, before breaking out of the loop. Change-Id: Ifc97f2ab7b8195d6b149502bb5d765d2983b07be
Diffstat (limited to 'media/libmedia/AudioRecord.cpp')
-rw-r--r--media/libmedia/AudioRecord.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/media/libmedia/AudioRecord.cpp b/media/libmedia/AudioRecord.cpp
index e39a475..f332313 100644
--- a/media/libmedia/AudioRecord.cpp
+++ b/media/libmedia/AudioRecord.cpp
@@ -591,6 +591,9 @@ status_t AudioRecord::obtainBuffer(Buffer* audioBuffer, const struct timespec *r
if (newSequence == oldSequence) {
status = restoreRecord_l("obtainBuffer");
if (status != NO_ERROR) {
+ buffer.mFrameCount = 0;
+ buffer.mRaw = NULL;
+ buffer.mNonContig = 0;
break;
}
}