Skip to content

fix(decoder): keep copied frame images alive with their frames - #65

Open
trmosala wants to merge 1 commit into
hgaiser:mainfrom
trmosala:fix/pooled-frame-lifetime
Open

trmosala wants to merge 1 commit into
hgaiser:mainfrom
trmosala:fix/pooled-frame-lifetime

Conversation

@trmosala

Copy link
Copy Markdown
Contributor

Fixes #64.

A frame copied into the reorder pool lost its Vulkan image when its decoder was dropped, even though the frame was still alive, so reading it afterwards crashed. The docs promise the image stays valid for as long as the frame lives, and DPB frames already keep theirs alive.

Pool images now use the same reference-counted owner as DPB images (DpbImage). Buffered and handed-out frames each hold a reference; the pool reuses an image once it holds the only one, and the last owner destroys it. That replaces the pool's free/buffered/handed-out states and release queue, so the change removes more than it adds.

Testing (RTX 4080 SUPER, NVIDIA 620.70.06)

  • New ignored test pooled_frame_outlives_decoder: downloads both planes of a copied frame, drops the decoder, downloads them again and compares, then checks the allocation is released with the frame. It crashes without the fix.
  • Everything CI runs passes except workspace Clippy, which reports the same three drop_non_drop warnings as unmodified main. cargo test -- --ignored passes, including all 35 decode-stream tests.
  • Under the validation layer with sync checks, the new test reports the decode-to-copy hazards that fix(decoder): clear the sync-validation hazards in the copy path #63 fixes, and nothing else. With fix(decoder): clear the sync-validation hazards in the copy path #63 applied as well it reports no findings.

🤖 Created with GPT-6.2 Astra in Codex and reviewed with Claude Opus 5.5 in Claude Code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] A copied DecodedFrame is destroyed with its decoder; reading it afterwards crashes

1 participant