Repository navigation
fix(recording): Windows encoders repeat a stalled frame only after three intervals - #2669
Draft
richiemcilroy wants to merge 3 commits into
Draft
richiemcilroy wants to merge 3 commits into
richiemcilroy wants to merge 3 commits into
Conversation
…ree intervals, behind real time
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…r cannot oversleep
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Windows recordings repeated the last frame as soon as one frame interval passed without a new one, which duplicated camera frames under ordinary arrival jitter. Also in cap-v0.6.0.
Cause
Every Windows encoder loop (screen and camera, MP4 and fragmented, and the out-of-process muxer) waited
recv_timeout(frame_interval). On a timeout it re-encoded the last frame stamped one interval later. That is the slot the next real frame is stamped for when it is only slightly late.sequenceDiagram participant Camera participant Encoder Camera->>Encoder: frame 9 (t = 0.300) Note over Encoder: no frame within 33.3 ms Encoder->>Encoder: repeat frame 9 at t = 0.333 Camera->>Encoder: frame 10 (t = 0.333), 1 ms late Encoder->>Encoder: same timestamp: muxer moves it to 0.333344The real frame then lasts 11 µs. The real-capture oracle on Windows (#2667) found 11 to 41 duplicated camera frames per 8 s recording (pts
0.266667, 0.266678).Fix
FramePacer(crates/recording/src/output_pipeline/frame_pacing.rs) decides when to repeat, for all seven loops:SharedPauseState::flag).Unit tests cover jittered frames (no repeats), a stall (repeats on the grid, behind real time), a pause, and the end of the stream.
Measured
recording/studio-camera/startup-drops, real capture on hosted Windows, synthetic 30 fps camera:Still open, and separate from pacing: the remaining duplicate is near the start of the track (0.33 s), and the first 3.5 s of camera frames sit 66.7 ms off their steady offset, which main shows too.