Repository navigation
perf(seek): keyframe-aware forward decoding and seek stats - #68
Merged
Merged
Conversation
Build a presentation-order frame index with keyframe flags from container packets. A seek now compares decoding forward from the current position with seeking to the nearest keyframe and picks the cheaper path, instead of seeking on every jump larger than one frame. The index is built lazily only when a seek is already likely, and forward decoding keeps the decoder state (no av_seek_frame, no flush); the target frame is still decoded by ShowFrameAt. Expose SeekStats (used_container, frames_decoded, seek_io_ms, decode_ms) and add seek_frames/seek_io to the performance log. Fixes #66
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.
Summary
Fixes #66: frame selection no longer re-decodes from the previous keyframe on every forward jump.
What changed
(pts, keyframe)and sorted into presentation order; a keyframe index list is kept.av_seek_frame, no flush); onlyShowFrameAtconverts the requested frame.used_container,frames_decoded,seek_io_ms,decode_ms; the performance log gainsseek_frames=andseek_io=.Verification
ctest: 72/72 pass.ForwardSmallSeekDecodesOnlyTheGap(no container seek,frames_decoded == 4, PTS 0.5)BackwardSeekUsesContainerSeek(container seek, PTS 0.2)tidy.shon the changed files: 0 issues.Expected on a long-GOP file: a +12 frame forward click decodes ~12 frames instead of a full GOP; the first large/backward jump pays a one-time index build.
Not included
thread_count/thread_type)