Repository navigation
fix(rendering): FFmpeg decoder seeks instead of guessing on backward cache misses - #2665
Merged
Merged
Conversation
…cache misses, and seeks before the request's tick
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.
Removes the last two mechanisms by which the FFmpeg decoder (Linux, and Windows without a D3D11 video device) shows a frame other than the one requested.
Causes
MAX_FRAME_LOOKBACK_TOLERANCE), on the assumption that the requested frame was a VFR hold. When the frame existed but had left the cache, the answer was stale: 1 or 2 storm seeks in 3,000, and 161 seeds of the decoder reference model.FFmpegDecoder::resetseeks with the request time, which avformat rounds to the stream's tick. A request a fraction of a tick before a keyframe landed on that keyframe, one frame past the request (futurein the reference model).Fix
crates/rendering/src/decoder/ffmpeg.rs). A request inside a recorded pts hole is answered with the hole's start frame whether it moves forward or backward; holes are facts about the file and survive resets. Any other backward cache miss seeks, so the reader decodes the requested frame. The tolerance constant is gone.crates/video-decode/src/ffmpeg.rs).resetseeks 2 ms before the request. The reader decodes forward to the requested frame from wherever the seek lands, so the margin costs at most a little decoding and cannot change the answer.Both decode loops (hardware and software fallback) change the same way.
Measured
seek/seek-native/keyframes60/ffmpeg(Linux, Windows)scripts/verify/perf-ab.pyagainst main on Apple silicon, 3 interleaved pairs, median per-pair CPU ratio: export-basic +0.3%, export-jitter-camera-40s +0.4%, seek storms +0.1%, playback-basic -0.2%.pts_to_framenumbers decoded frames with the same floor, so it is left for a change to both.

Confidence Score: 5/5
The PR appears safe to merge; no actionable defects were found.Summary
The PR makes FFmpeg seek on backward cache misses instead of returning a nearby older frame.
No actionable issues were found. This review used code inspection; no builds or tests were run.
Acknowledged deferral:
richiemcilroyleaves the existing grid-rounding mismatch for a separate change because request times and decoded-frame numbering must change together.Reviews (1) · Last reviewed commit: "fix(rendering): FFmpeg decoder seeks ins..." · Reviewed by Greptile