diff options
author | James Dong <jdong@google.com> | 2011-03-30 16:04:09 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2011-03-30 16:30:00 -0700 |
commit | 8a1a0fd1dc8c612f3ba7db955db11a18b5209ed4 (patch) | |
tree | 001ba49afcd5fa4bb20de80afbd4d8deca6ea8f1 /media | |
parent | 7544b23e52c004cda817874c54d88080b6e90bdc (diff) | |
download | frameworks_base-8a1a0fd1dc8c612f3ba7db955db11a18b5209ed4.zip frameworks_base-8a1a0fd1dc8c612f3ba7db955db11a18b5209ed4.tar.gz frameworks_base-8a1a0fd1dc8c612f3ba7db955db11a18b5209ed4.tar.bz2 |
When read() from AudioRecord returns 0 or negative value, report an error to application. DO NOT MERGE.
Change-Id: I3a66fd0ed3f6b90350d706a608a39d8b4a398e32
related-to-bug: 4195127
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/AudioSource.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index 29f16d8..a84365f 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -287,9 +287,10 @@ status_t AudioSource::read( } ssize_t n = mRecord->read(buffer->data(), buffer->size()); - if (n < 0) { + if (n <= 0) { + LOGE("Read from AudioRecord returns: %ld", n); buffer->release(); - return (status_t)n; + return UNKNOWN_ERROR; } int64_t recordDurationUs = (1000000LL * n >> 1) / sampleRate; |