diff options
Diffstat (limited to 'services/camera/libcameraservice/gui/RingBufferConsumer.cpp')
-rw-r--r-- | services/camera/libcameraservice/gui/RingBufferConsumer.cpp | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp index e4ec5fd..f8562ec 100644 --- a/services/camera/libcameraservice/gui/RingBufferConsumer.cpp +++ b/services/camera/libcameraservice/gui/RingBufferConsumer.cpp @@ -41,7 +41,8 @@ RingBufferConsumer::RingBufferConsumer(const sp<IGraphicBufferConsumer>& consume uint32_t consumerUsage, int bufferCount) : ConsumerBase(consumer), - mBufferCount(bufferCount) + mBufferCount(bufferCount), + mLatestTimestamp(0) { mConsumer->setConsumerUsageBits(consumerUsage); mConsumer->setMaxAcquiredBufferCount(bufferCount); @@ -152,6 +153,14 @@ status_t RingBufferConsumer::clear() { return OK; } +nsecs_t RingBufferConsumer::getLatestTimestamp() { + Mutex::Autolock _l(mMutex); + if (mBufferItemList.size() == 0) { + return 0; + } + return mLatestTimestamp; +} + void RingBufferConsumer::pinBufferLocked(const BufferItem& item) { List<RingBufferItem>::iterator it, end; @@ -302,6 +311,13 @@ void RingBufferConsumer::onFrameAvailable() { item.mTimestamp, mBufferItemList.size(), mBufferCount); + if (item.mTimestamp < mLatestTimestamp) { + BI_LOGE("Timestamp decreases from %" PRId64 " to %" PRId64, + mLatestTimestamp, item.mTimestamp); + } + + mLatestTimestamp = item.mTimestamp; + item.mGraphicBuffer = mSlots[item.mBuf].mGraphicBuffer; } // end of mMutex lock |