diff options
| author | 2011-02-09 13:58:06 -0800 | |
|---|---|---|
| committer | 2011-02-09 13:58:06 -0800 | |
| commit | 455644ee1cad8554aa3c2a00e3e639bca032c981 (patch) | |
| tree | 328e5727edf580aa97989d19f1c5de76481e473f | |
| parent | 6b9ef860aa4346329ce76d7efe5173cc4e4cf007 (diff) | |
| parent | 10a5e2794d9d1b0172a9fd344eed106f5823f025 (diff) | |
Merge "Catch read error from AudioRecord and do not assert"
| -rw-r--r-- | media/libstagefright/AudioSource.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index f96df180e179..7a1d73b46c03 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); |