diff options
| author | Andreas Huber <andih@google.com> | 2012-10-01 16:45:05 -0700 |
|---|---|---|
| committer | Android Git Automerger <android-git-automerger@android.com> | 2012-10-01 16:45:05 -0700 |
| commit | 5db05850d02939e63800ae5b1fcf53a767f2e895 (patch) | |
| tree | 91c4dc0e0b1898117ef83793e3095b072e66748e | |
| parent | c0256c71182ed9c028e9f5078b64828b8e01f199 (diff) | |
| parent | 1a0d1670b4304f294530f4ca9ce68defad6445dc (diff) | |
| download | frameworks_av-5db05850d02939e63800ae5b1fcf53a767f2e895.zip frameworks_av-5db05850d02939e63800ae5b1fcf53a767f2e895.tar.gz frameworks_av-5db05850d02939e63800ae5b1fcf53a767f2e895.tar.bz2 | |
am 1a0d1670: Merge "Optionally have SurfaceMediaSource return absolute timestamps" into jb-mr1-dev
* commit '1a0d1670b4304f294530f4ca9ce68defad6445dc':
Optionally have SurfaceMediaSource return absolute timestamps
| -rw-r--r-- | include/media/stagefright/SurfaceMediaSource.h | 5 | ||||
| -rw-r--r-- | media/libstagefright/SurfaceMediaSource.cpp | 13 |
2 files changed, 15 insertions, 3 deletions
diff --git a/include/media/stagefright/SurfaceMediaSource.h b/include/media/stagefright/SurfaceMediaSource.h index 82e5965..e56527d 100644 --- a/include/media/stagefright/SurfaceMediaSource.h +++ b/include/media/stagefright/SurfaceMediaSource.h @@ -116,6 +116,9 @@ public: // To be called before start() status_t setMaxAcquiredBufferCount(size_t count); + // To be called before start() + status_t setUseAbsoluteTimestamps(); + protected: // Implementation of the BufferQueue::ConsumerListener interface. These @@ -212,6 +215,8 @@ private: size_t mMaxAcquiredBufferCount; + bool mUseAbsoluteTimestamps; + // mFrameAvailableCondition condition used to indicate whether there // is a frame available for dequeuing Condition mFrameAvailableCondition; diff --git a/media/libstagefright/SurfaceMediaSource.cpp b/media/libstagefright/SurfaceMediaSource.cpp index 97f9c7c..3c002fc 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) { |
