summaryrefslogtreecommitdiffstats
path: root/media/libstagefright/AudioSource.cpp
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-09-14 11:48:11 -0700
committerJames Dong <jdong@google.com>2010-09-14 13:21:08 -0700
commit67e9269eaeab41a6c9a18794ebb32cbd1414381c (patch)
treeb20fe6ebd403b7aa39c5db5b9e2fb53272c4ac1a /media/libstagefright/AudioSource.cpp
parente0aed6ddcb4e3c301b80aa26706b6052dab42c41 (diff)
downloadframeworks_av-67e9269eaeab41a6c9a18794ebb32cbd1414381c.zip
frameworks_av-67e9269eaeab41a6c9a18794ebb32cbd1414381c.tar.gz
frameworks_av-67e9269eaeab41a6c9a18794ebb32cbd1414381c.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.cpp5
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;