summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/media/stagefright/SurfaceMediaSource.h5
-rw-r--r--media/libstagefright/SurfaceMediaSource.cpp13
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) {