Loading services/camera/libcameraservice/device3/Camera3OutputStream.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -1410,18 +1410,24 @@ void Camera3OutputStream::returnPrefetchedBuffersLocked() { } nsecs_t Camera3OutputStream::syncTimestampToDisplayLocked(nsecs_t t) { nsecs_t currentTime = systemTime(); if (!mFixedFps) { mLastCaptureTime = t; mLastPresentTime = currentTime; return t; } ParcelableVsyncEventData parcelableVsyncEventData; auto res = mDisplayEventReceiver.getLatestVsyncEventData(&parcelableVsyncEventData); if (res != OK) { ALOGE("%s: Stream %d: Error getting latest vsync event data: %s (%d)", __FUNCTION__, mId, strerror(-res), res); mLastCaptureTime = t; mLastPresentTime = t; mLastPresentTime = currentTime; return t; } const VsyncEventData& vsyncEventData = parcelableVsyncEventData.vsync; nsecs_t currentTime = systemTime(); nsecs_t minPresentT = mLastPresentTime + vsyncEventData.frameInterval / 2; // Find the best presentation time without worrying about previous frame's Loading Loading @@ -1526,8 +1532,8 @@ nsecs_t Camera3OutputStream::syncTimestampToDisplayLocked(nsecs_t t) { } } if (expectedPresentT == mLastPresentTime && expectedPresentT <= vsyncEventData.frameTimelines[maxTimelines].expectedPresentationTime) { if (expectedPresentT == mLastPresentTime && expectedPresentT < vsyncEventData.frameTimelines[maxTimelines-1].expectedPresentationTime) { // Couldn't find a reasonable presentation time. Using last frame's // presentation time would cause a frame drop. The best option now // is to use the next VSync as long as the last presentation time Loading services/camera/libcameraservice/device3/Camera3OutputStream.h +1 −1 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ class Camera3OutputStream : static constexpr nsecs_t kSpacingResetIntervalNs = 50000000LL; // 50 millisecond static constexpr nsecs_t kTimelineThresholdNs = 1000000LL; // 1 millisecond static constexpr float kMaxIntervalRatioDeviation = 0.05f; static constexpr int kMaxTimelines = 3; static constexpr int kMaxTimelines = 2; nsecs_t syncTimestampToDisplayLocked(nsecs_t t); // Re-space frames by delaying queueBuffer so that frame delivery has Loading services/camera/libcameraservice/device3/PreviewFrameSpacer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ bool PreviewFrameSpacer::threadLoop() { return true; } // Cache the frame to match readout time interval, for up to 33ms // Cache the frame to match readout time interval, for up to kMaxFrameWaitTime nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval; nsecs_t frameWaitTime = std::min(kMaxFrameWaitTime, expectedQueueTime - currentTime); if (frameWaitTime > 0 && mPendingBuffers.size() < 2) { Loading services/camera/libcameraservice/device3/PreviewFrameSpacer.h +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class PreviewFrameSpacer : public Thread { nsecs_t mLastCameraPresentTime = 0; static constexpr nsecs_t kWaitDuration = 5000000LL; // 50ms static constexpr nsecs_t kFrameIntervalThreshold = 80000000LL; // 80ms static constexpr nsecs_t kMaxFrameWaitTime = 33333333LL; // 33ms static constexpr nsecs_t kMaxFrameWaitTime = 10000000LL; // 10ms }; }; //namespace camera3 Loading Loading
services/camera/libcameraservice/device3/Camera3OutputStream.cpp +10 −4 Original line number Diff line number Diff line Loading @@ -1410,18 +1410,24 @@ void Camera3OutputStream::returnPrefetchedBuffersLocked() { } nsecs_t Camera3OutputStream::syncTimestampToDisplayLocked(nsecs_t t) { nsecs_t currentTime = systemTime(); if (!mFixedFps) { mLastCaptureTime = t; mLastPresentTime = currentTime; return t; } ParcelableVsyncEventData parcelableVsyncEventData; auto res = mDisplayEventReceiver.getLatestVsyncEventData(&parcelableVsyncEventData); if (res != OK) { ALOGE("%s: Stream %d: Error getting latest vsync event data: %s (%d)", __FUNCTION__, mId, strerror(-res), res); mLastCaptureTime = t; mLastPresentTime = t; mLastPresentTime = currentTime; return t; } const VsyncEventData& vsyncEventData = parcelableVsyncEventData.vsync; nsecs_t currentTime = systemTime(); nsecs_t minPresentT = mLastPresentTime + vsyncEventData.frameInterval / 2; // Find the best presentation time without worrying about previous frame's Loading Loading @@ -1526,8 +1532,8 @@ nsecs_t Camera3OutputStream::syncTimestampToDisplayLocked(nsecs_t t) { } } if (expectedPresentT == mLastPresentTime && expectedPresentT <= vsyncEventData.frameTimelines[maxTimelines].expectedPresentationTime) { if (expectedPresentT == mLastPresentTime && expectedPresentT < vsyncEventData.frameTimelines[maxTimelines-1].expectedPresentationTime) { // Couldn't find a reasonable presentation time. Using last frame's // presentation time would cause a frame drop. The best option now // is to use the next VSync as long as the last presentation time Loading
services/camera/libcameraservice/device3/Camera3OutputStream.h +1 −1 Original line number Diff line number Diff line Loading @@ -432,7 +432,7 @@ class Camera3OutputStream : static constexpr nsecs_t kSpacingResetIntervalNs = 50000000LL; // 50 millisecond static constexpr nsecs_t kTimelineThresholdNs = 1000000LL; // 1 millisecond static constexpr float kMaxIntervalRatioDeviation = 0.05f; static constexpr int kMaxTimelines = 3; static constexpr int kMaxTimelines = 2; nsecs_t syncTimestampToDisplayLocked(nsecs_t t); // Re-space frames by delaying queueBuffer so that frame delivery has Loading
services/camera/libcameraservice/device3/PreviewFrameSpacer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -68,7 +68,7 @@ bool PreviewFrameSpacer::threadLoop() { return true; } // Cache the frame to match readout time interval, for up to 33ms // Cache the frame to match readout time interval, for up to kMaxFrameWaitTime nsecs_t expectedQueueTime = mLastCameraPresentTime + readoutInterval; nsecs_t frameWaitTime = std::min(kMaxFrameWaitTime, expectedQueueTime - currentTime); if (frameWaitTime > 0 && mPendingBuffers.size() < 2) { Loading
services/camera/libcameraservice/device3/PreviewFrameSpacer.h +1 −1 Original line number Diff line number Diff line Loading @@ -85,7 +85,7 @@ class PreviewFrameSpacer : public Thread { nsecs_t mLastCameraPresentTime = 0; static constexpr nsecs_t kWaitDuration = 5000000LL; // 50ms static constexpr nsecs_t kFrameIntervalThreshold = 80000000LL; // 80ms static constexpr nsecs_t kMaxFrameWaitTime = 33333333LL; // 33ms static constexpr nsecs_t kMaxFrameWaitTime = 10000000LL; // 10ms }; }; //namespace camera3 Loading