summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioSource.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2011-02-09 12:42:11 -0800
committerJames Dong <jdong@google.com>2011-02-09 12:49:31 -0800
commit722555f01ace262c2aba9e1ca5d9794ce30c564f (patch)
tree726bee219d148faa972ceb3d06713f5ce94f5fa3 /media/libstagefright/AudioSource.cpp
parent37865df43b68ae34ddb6f6450dbef301f92f3618 (diff)
downloadframeworks_av-722555f01ace262c2aba9e1ca5d9794ce30c564f.zip
frameworks_av-722555f01ace262c2aba9e1ca5d9794ce30c564f.tar.gz
frameworks_av-722555f01ace262c2aba9e1ca5d9794ce30c564f.tar.bz2
Catch read error from AudioRecord and do not assert
bug - 3439313 Change-Id: Ie29d6e4945978ef27fc3e5849e467d895c7736d3
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r--media/libstagefright/AudioSource.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp
index f96df18..7a1d73b 100644
--- a/media/libstagefright/AudioSource.cpp
+++ b/media/libstagefright/AudioSource.cpp
@@ -235,7 +235,6 @@ status_t AudioSource::read(
timestampUs += ((1000000LL * (numLostBytes >> 1)) +
(sampleRate >> 1)) / sampleRate;
- CHECK(timestampUs > mPrevSampleTimeUs);
if (mCollectStats) {
mTotalLostFrames += (numLostBytes >> 1);
}
@@ -252,9 +251,10 @@ status_t AudioSource::read(
}
ssize_t n = mRecord->read(buffer->data(), buffer->size());
- if (n < 0) {
+ if (n <= 0) {
buffer->release();
- return (status_t)n;
+ LOGE("Read from AudioRecord returns %d", n);
+ return UNKNOWN_ERROR;
}
int64_t recordDurationUs = (1000000LL * n >> 1) / sampleRate;
@@ -283,7 +283,6 @@ status_t AudioSource::read(
buffer->meta_data()->setInt64(kKeyTime, mStartTimeUs + mPrevSampleTimeUs);
buffer->meta_data()->setInt64(kKeyDriftTime, readTimeUs - mInitialReadTimeUs);
- CHECK(timestampUs > mPrevSampleTimeUs);
mPrevSampleTimeUs = timestampUs;
LOGV("initial delay: %lld, sample rate: %d, timestamp: %lld",
mStartTimeUs, sampleRate, timestampUs);