Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ca457f69 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Camera: Avoid over-delaying frames in PreviewFrameSpacer" into tm-qpr-dev am: d7a6aeea

parents bee2ce45 d7a6aeea
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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);
@@ -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;
+1 −0
Original line number Diff line number Diff line
@@ -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