Loading services/camera/libcameraservice/device3/PreviewFrameSpacer.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,9 @@ bool PreviewFrameSpacer::threadLoop() { } // Cache the frame to match readout time interval, for up to kMaxFrameWaitTime nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval; // Because the code between here and queueBuffer() takes time to execute, make sure the // presentationInterval is slightly shorter than readoutInterval. nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval - kFrameAdjustThreshold; nsecs_t frameWaitTime = std::min(kMaxFrameWaitTime, expectedQueueTime - currentTime); if (frameWaitTime > 0 && mPendingBuffers.size() < 2) { mBufferCond.waitRelative(mLock, frameWaitTime); Loading @@ -78,9 +80,9 @@ bool PreviewFrameSpacer::threadLoop() { } currentTime = systemTime(); } ALOGV("%s: readoutInterval %" PRId64 ", queueInterval %" PRId64 ", waited for %" PRId64 ALOGV("%s: readoutInterval %" PRId64 ", waited for %" PRId64 ", timestamp %" PRId64, __FUNCTION__, readoutInterval, currentTime - mLastCameraPresentTime, frameWaitTime, buffer.timestamp); mPendingBuffers.size() < 2 ? frameWaitTime : 0, buffer.timestamp); mPendingBuffers.pop(); queueBufferToClientLocked(buffer, currentTime); return true; Loading services/camera/libcameraservice/device3/PreviewFrameSpacer.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class PreviewFrameSpacer : public Thread { static constexpr nsecs_t kWaitDuration = 5000000LL; // 50ms static constexpr nsecs_t kFrameIntervalThreshold = 80000000LL; // 80ms static constexpr nsecs_t kMaxFrameWaitTime = 10000000LL; // 10ms static constexpr nsecs_t kFrameAdjustThreshold = 2000000LL; // 2ms }; }; //namespace camera3 Loading Loading
services/camera/libcameraservice/device3/PreviewFrameSpacer.cpp +5 −3 Original line number Diff line number Diff line Loading @@ -69,7 +69,9 @@ bool PreviewFrameSpacer::threadLoop() { } // Cache the frame to match readout time interval, for up to kMaxFrameWaitTime nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval; // Because the code between here and queueBuffer() takes time to execute, make sure the // presentationInterval is slightly shorter than readoutInterval. nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval - kFrameAdjustThreshold; nsecs_t frameWaitTime = std::min(kMaxFrameWaitTime, expectedQueueTime - currentTime); if (frameWaitTime > 0 && mPendingBuffers.size() < 2) { mBufferCond.waitRelative(mLock, frameWaitTime); Loading @@ -78,9 +80,9 @@ bool PreviewFrameSpacer::threadLoop() { } currentTime = systemTime(); } ALOGV("%s: readoutInterval %" PRId64 ", queueInterval %" PRId64 ", waited for %" PRId64 ALOGV("%s: readoutInterval %" PRId64 ", waited for %" PRId64 ", timestamp %" PRId64, __FUNCTION__, readoutInterval, currentTime - mLastCameraPresentTime, frameWaitTime, buffer.timestamp); mPendingBuffers.size() < 2 ? frameWaitTime : 0, buffer.timestamp); mPendingBuffers.pop(); queueBufferToClientLocked(buffer, currentTime); return true; Loading
services/camera/libcameraservice/device3/PreviewFrameSpacer.h +1 −0 Original line number Diff line number Diff line Loading @@ -86,6 +86,7 @@ class PreviewFrameSpacer : public Thread { static constexpr nsecs_t kWaitDuration = 5000000LL; // 50ms static constexpr nsecs_t kFrameIntervalThreshold = 80000000LL; // 80ms static constexpr nsecs_t kMaxFrameWaitTime = 10000000LL; // 10ms static constexpr nsecs_t kFrameAdjustThreshold = 2000000LL; // 2ms }; }; //namespace camera3 Loading