diff options
author | Andreas Huber <andih@google.com> | 2012-10-01 15:59:54 -0700 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2012-10-01 15:59:54 -0700 |
commit | 0868deae404604b577892413c128d55a2bafc56e (patch) | |
tree | 422a9db60612b598d2de89a854f26e3acf4f8b31 /media | |
parent | ad0d97c7cf620e96a0b088dd9461645a3f8900b7 (diff) |
Optionally have SurfaceMediaSource return absolute timestamps
based on systemTime().
Change-Id: I2eff15dd149a4b737d6e7473d1907cf0c80b6b38
related-to-bug: 7266706
Diffstat (limited to 'media')
-rw-r--r-- | media/libstagefright/SurfaceMediaSource.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp index 97f9c7cc..3c002fca 100644 --- a/media/libstagefright/SurfaceMediaSource.cpp +++ b/media/libstagefright/SurfaceMediaSource.cpp @@ -46,8 +46,8 @@ SurfaceMediaSource::SurfaceMediaSource(uint32_t bufferWidth, uint32_t bufferHeig mNumFramesReceived(0), mNumFramesEncoded(0), mFirstFrameTimestamp(0), - mMaxAcquiredBufferCount(4) // XXX double-check the default -{ + mMaxAcquiredBufferCount(4), // XXX double-check the default + mUseAbsoluteTimestamps(false) { ALOGV("SurfaceMediaSource"); if (bufferWidth == 0 || bufferHeight == 0) { @@ -188,6 +188,13 @@ status_t SurfaceMediaSource::setMaxAcquiredBufferCount(size_t count) { return OK; } +status_t SurfaceMediaSource::setUseAbsoluteTimestamps() { + ALOGV("setUseAbsoluteTimestamps"); + Mutex::Autolock lock(mMutex); + mUseAbsoluteTimestamps = true; + + return OK; +} status_t SurfaceMediaSource::stop() { @@ -298,7 +305,7 @@ status_t SurfaceMediaSource::read( MediaBuffer **buffer, } // check for the timing of this buffer - if (mNumFramesReceived == 0) { + if (mNumFramesReceived == 0 && !mUseAbsoluteTimestamps) { mFirstFrameTimestamp = item.mTimestamp; // Initial delay if (mStartTimeNs > 0) { |