summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author James Dong <jdong@google.com> 2011-03-31 11:20:40 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2011-03-31 11:20:40 -0700
commitea5d2c584490424be6bbc27dec58b4f9868d631e (patch)
treea1b84389b5f042a20daacbf5b75c269d06f89843
parenta482d83ccf35ccd6cc29a9e1ace3d77b5f28d013 (diff)
parent8a1a0fd1dc8c612f3ba7db955db11a18b5209ed4 (diff)
Merge "When read() from AudioRecord returns 0 or negative value, report an error to application. DO NOT MERGE." into gingerbread
-rw-r--r--media/libstagefright/AudioSource.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index 29f16d806777..a84365fba7c2 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;