Skip to content

fix: stuck camera while moving#1899

Closed
quanghuynh99 wants to merge 14 commits intoHaishinKit:mainfrom
quanghuynh99:fix/stuck-camera-while-moving
Closed

fix: stuck camera while moving#1899
quanghuynh99 wants to merge 14 commits intoHaishinKit:mainfrom
quanghuynh99:fix/stuck-camera-while-moving

Conversation

@quanghuynh99
Copy link
Copy Markdown

Description & motivation

Summary

  • Improves the render timing pipeline in Screen.swift to reduce frame stutter/freezing during fast camera movement.

  • Stabilizes frame pacing and timestamps before creating CMSampleBuffer .
    Root Cause

  • presentationTimeStamp could become non-monotonic when capture/render latency fluctuates.

  • frameDuration could vary too much between consecutive frames during rapid motion.

  • Sudden latency shifts caused visible jitter and short frame stalls.

Type of change

Please delete options that are not relevant.

  • Introduced ScreenTimingSettings with normalized timing bounds.
  • Clamped frameDuration to min/max limits for stable frame pacing.
  • Enforced strictly monotonic presentationTimeStamp using minimumMonotonicStep .
  • Smoothed capture latency with EMA ( videoCaptureLatencySmoothingFactor ) and capped it ( maximumVideoCaptureLatency ).
  • Preserved renderer state (bounds/background/sync clock) when renderer configuration changes.

Demo (video from Android using VLC app that watch video stream from iPhone X):

https://drive.google.com/file/d/186ImpDCjmSb8kGZUJe70n8F7CpUqfKOw/view?usp=sharing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant