diff options
author | James Dong <jdong@google.com> | 2010-09-14 11:48:11 -0700 |
---|---|---|
committer | James Dong <jdong@google.com> | 2010-09-14 13:21:08 -0700 |
commit | 7589ebfbfd1e01217b21861fd4b7bfdcc26c2e84 (patch) | |
tree | 358b51273c6fd8103e879f3e024e23b80f7a9fae /media/libstagefright/AudioSource.cpp | |
parent | eea35ce87f179098215b590fbb21162cca5ff8da (diff) | |
download | frameworks_base-7589ebfbfd1e01217b21861fd4b7bfdcc26c2e84.zip frameworks_base-7589ebfbfd1e01217b21861fd4b7bfdcc26c2e84.tar.gz frameworks_base-7589ebfbfd1e01217b21861fd4b7bfdcc26c2e84.tar.bz2 |
Fix audio input sample timestamp when audio driver loses audio samples
Change-Id: Ic0f1489f710929af50e7714867ae5153b3242dd8
Diffstat (limited to 'media/libstagefright/AudioSource.cpp')
-rw-r--r-- | media/libstagefright/AudioSource.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/media/libstagefright/AudioSource.cpp b/media/libstagefright/AudioSource.cpp index 8d7ada3..29f16d8 100644 --- a/media/libstagefright/AudioSource.cpp +++ b/media/libstagefright/AudioSource.cpp @@ -256,6 +256,8 @@ status_t AudioSource::read( if (numLostBytes > kMaxBufferSize) { mPrevLostBytes = numLostBytes - kMaxBufferSize; numLostBytes = kMaxBufferSize; + } else { + mPrevLostBytes = 0; } CHECK_EQ(numLostBytes & 1, 0); @@ -275,8 +277,9 @@ status_t AudioSource::read( memset(buffer->data(), 0, numLostBytes); buffer->set_range(0, numLostBytes); if (numFramesRecorded == 0) { - buffer->meta_data()->setInt64(kKeyTime, mStartTimeUs); + buffer->meta_data()->setInt64(kKeyAnchorTime, mStartTimeUs); } + buffer->meta_data()->setInt64(kKeyTime, mStartTimeUs + mPrevSampleTimeUs); buffer->meta_data()->setInt64(kKeyDriftTime, readTimeUs - mInitialReadTimeUs); mPrevSampleTimeUs = timestampUs; *out = buffer; |