diff options
author | Chong Zhang <chz@google.com> | 2013-12-26 01:38:35 -0800 |
---|---|---|
committer | Chong Zhang <chz@google.com> | 2014-02-05 15:46:26 -0800 |
commit | 72cecca17d735db6532c45f0a7e10c47ee6f065a (patch) | |
tree | d2f532b1909ea605f10e6044d2f027e7e58a8575 /media/libstagefright/omx/GraphicBufferSource.cpp | |
parent | 412d4744efae64083e4f99a664e3efaba031af48 (diff) | |
download | frameworks_av-72cecca17d735db6532c45f0a7e10c47ee6f065a.zip frameworks_av-72cecca17d735db6532c45f0a7e10c47ee6f065a.tar.gz frameworks_av-72cecca17d735db6532c45f0a7e10c47ee6f065a.tar.bz2 |
Change StagefrightRecorder to use MediaCodec
Bug: 12305192
Change-Id: I72d7cb571be5bd348b58ad650f3269d24c15d350
Diffstat (limited to 'media/libstagefright/omx/GraphicBufferSource.cpp')
-rw-r--r-- | media/libstagefright/omx/GraphicBufferSource.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/media/libstagefright/omx/GraphicBufferSource.cpp b/media/libstagefright/omx/GraphicBufferSource.cpp index 20fa7ce..1e6de55 100644 --- a/media/libstagefright/omx/GraphicBufferSource.cpp +++ b/media/libstagefright/omx/GraphicBufferSource.cpp @@ -45,6 +45,7 @@ GraphicBufferSource::GraphicBufferSource(OMXNodeInstance* nodeInstance, mMaxTimestampGapUs(-1ll), mPrevOriginalTimeUs(-1ll), mPrevModifiedTimeUs(-1ll), + mSkipFramesBeforeNs(-1ll), mRepeatLastFrameGeneration(0), mRepeatLastFrameTimestamp(-1ll), mLatestSubmittedBufferId(-1), @@ -414,7 +415,18 @@ bool GraphicBufferSource::fillCodecBuffer_l() { mBufferSlot[item.mBuf] = item.mGraphicBuffer; } - err = submitBuffer_l(item, cbi); + err = UNKNOWN_ERROR; + + // only submit sample if start time is unspecified, or sample + // is queued after the specified start time + if (mSkipFramesBeforeNs < 0ll || item.mTimestamp >= mSkipFramesBeforeNs) { + // if start time is set, offset time stamp by start time + if (mSkipFramesBeforeNs > 0) { + item.mTimestamp -= mSkipFramesBeforeNs; + } + err = submitBuffer_l(item, cbi); + } + if (err != OK) { ALOGV("submitBuffer_l failed, releasing bq buf %d", item.mBuf); mBufferQueue->releaseBuffer(item.mBuf, item.mFrameNumber, @@ -762,6 +774,14 @@ status_t GraphicBufferSource::setMaxTimestampGapUs(int64_t maxGapUs) { return OK; } + +void GraphicBufferSource::setSkipFramesBeforeUs(int64_t skipFramesBeforeUs) { + Mutex::Autolock autoLock(mMutex); + + mSkipFramesBeforeNs = + (skipFramesBeforeUs > 0) ? (skipFramesBeforeUs * 1000) : -1ll; +} + void GraphicBufferSource::onMessageReceived(const sp<AMessage> &msg) { switch (msg->what()) { case kWhatRepeatLastFrame: |