Release detached seek frame when the FFmpeg video loop exits - #94
Draft
Blackspirits wants to merge 1 commit into
Draft
Release detached seek frame when the FFmpeg video loop exits#94Blackspirits wants to merge 1 commit into
Blackspirits wants to merge 1 commit into
Conversation
Blackspirits
commented
Sep 13, 2026
Blackspirits
left a comment
Owner
Author
There was a problem hiding this comment.
Independent adversarial re-check on current upstream: lastDropped remains detached from VideoFrameQueue while seeking and owns unmanaged HGlobal memory. The enlarged padded/aligned VideoFrame allocation makes the leak more expensive, not less. Returning it from the video-loop finally is safe because VideoFrameQueue.Return disposes immediately after queue close. Full CI #34778788393 passed restore, build and the complete suite on the first run; UITests reported 5,151 passed, 9 skipped, 0 failed. Retry was not used. No blocker identified. Keep draft; no merge performed.
This was referenced Sep 13, 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.
Summary
During seek handling,
lastDroppedholds one convertedVideoFrameoutsideVideoFrameQueuewhile decoding advances from the key frame to the requested target.If the video loop exits or throws before that frame is presented/returned, the frame becomes unreachable.
VideoFrameowns unmanaged HGlobal memory and has no finalizer.This current-base port:
lastDroppedto the full video-loop lifetime;finally;VideoFrameQueue.Returndisposes frames when closed.Validation
c77c4b428649ce7030e6cf218b4d7c384b955232VideoFrameallocation; the allocation is larger now, so leaking it is no less relevantFfmpegPlayer.csAI assistance: ChatGPT was used to revalidate unmanaged frame ownership after the BGRA buffer layout changed.