summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2010-09-15 14:51:49 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-15 14:51:49 -0700
commit9f882c0b10ddbd436e24e51db8b1063bc5591d24 (patch)
tree036073bbacfcdf605c6439627bbad7600ed38934 /media
parent968735e580b7728c6a17aff9b7356f9d74dc6eb3 (diff)
parent7589ebfbfd1e01217b21861fd4b7bfdcc26c2e84 (diff)
downloadframeworks_base-9f882c0b10ddbd436e24e51db8b1063bc5591d24.zip
frameworks_base-9f882c0b10ddbd436e24e51db8b1063bc5591d24.tar.gz
frameworks_base-9f882c0b10ddbd436e24e51db8b1063bc5591d24.tar.bz2
Merge "Fix audio input sample timestamp when audio driver loses audio samples" into gingerbread
Diffstat (limited to 'media')
-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;