Camera: Reduce latency for dejittering
There is a tradeoff between dejittering and latency. The more we delay
the presentation of frames, the longer latency there is.
- Only look ahead for 2 frames in the vsync timeline. And do not exceed
2+1 vsync timestamps when spacing out fixed frame rates in lockstep with
display vsync.
- Disable synchronizing presentation time to vsync for variable frame
rate. Fixed frame rate and video mode is typically more tolerant to
higher latency and prefers smoother user experience.
- Reduce the upper bound of holding onto buffers to 10ms.
Test: Measure photon-to-photon latency
Bug: 239775097
Change-Id: I601a0fadf89529922fd1bd5d0a17ba80832b4cab
diff --git a/services/camera/libcameraservice/device3/Camera3OutputStream.h b/services/camera/libcameraservice/device3/Camera3OutputStream.h
index 741bca2..db988a0 100644
--- a/services/camera/libcameraservice/device3/Camera3OutputStream.h
+++ b/services/camera/libcameraservice/device3/Camera3OutputStream.h
@@ -432,7 +432,7 @@
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