Release detached FFmpeg seek frame on video-loop exit - #141
Draft
Blackspirits wants to merge 1 commit into
Draft
Blackspirits wants to merge 1 commit into
Blackspirits wants to merge 1 commit into
Conversation
Blackspirits
commented
Sep 15, 2026
Blackspirits
left a comment
Owner
Author
There was a problem hiding this comment.
Final adversarial review on 4b6cb9ff2762facb2ae3dfb0c09937ef6af5f48d after CI SubtitleEdit#280: no blocker found. lastDropped remains singly owned on every normal path; the finally only sees it when ownership is still detached. VideoFrameQueue.Return() disposes safely after queue shutdown, so teardown cannot repool a dead-session buffer. No merge/promotion performed.
This was referenced Sep 16, 2026
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.
Purpose
Independent FFmpeg ownership follow-up to merged upstream PR SubtitleEdit#14878 on the common audited base
3e4d052adc78464e71bbd5154880d935fd592960.This is a current-base revalidation/port of the previously-audited #94 finding.
VideoLoop()keeps one converted seek frame inlastDroppedoutsideVideoFrameQueue; if the loop exits or throws before a normal path consumes it, that unmanaged BGRA buffer becomes unreachable.Current upstream
SubtitleEdit/subtitleeditmain was rechecked atd6917286e355976da953d0ee22208b4bf9461699; no relevant drift or open upstream PR was found.Finding fixed
During seek decode, frames before the requested target are skipped while the most recent converted frame is retained in
lastDropped, outside both the active queue and reusable pool.Normal paths already return/push it and set it to null. The missing path was video-loop exit/exception while ownership was still detached.
VideoFrameowns unmanaged memory and has no finalizer, so a 1080p retained frame can leak several megabytes.Fix
lastDroppedto the fullVideoLoop()lifetime;finally;VideoFrameQueue.Return()disposes instead of repooling when the queue is already closed, so the finally path is safe on both normal and teardown exits.Scope / branch state
0252d55fd2f95752425c2e30b70363e6af7a93e83e4d052adc78464e71bbd5154880d935fd5929604b6cb9ff2762facb2ae3dfb0c09937ef6af5f48dd6917286e355976da953d0ee22208b4bf9461699AI assistance: ChatGPT was used to compare detached-frame ownership against the current FFmpeg stack, revalidate #94 and verify queue-close return semantics.
Final CI
Authoritative run: SubtitleEdit#280 on
4b6cb9ff2762facb2ae3dfb0c09937ef6af5f48dFinal adversarial review was performed on this exact HEAD after CI; no blocker found.