Skip to content

fix(d3d11): prevent cross-device frame reuse - #80

Merged
Shinokawa merged 1 commit into
mainfrom
codex/fix-d3d11-frame-flash
Aug 4, 2026
Merged

fix(d3d11): prevent cross-device frame reuse#80
Shinokawa merged 1 commit into
mainfrom
codex/fix-d3d11-frame-flash

Conversation

@Shinokawa

Copy link
Copy Markdown
Member

Summary

  • render D3D11VA frames on the decoder's D3D11 device instead of reopening decoder surfaces through an unsynchronized shared handle
  • enable D3D11 multithread protection before the renderer shares the decoder's immediate context
  • remove the obsolete cross-device import path and report imported frames as direct zero-copy

Why

Playback traces showed strictly ordered 41/42 ms PTS intervals with no seeks, drops, audio underflows, surface resizes, or presentation stalls while the visible output occasionally inserted a frame with an object's position from another point in time.

The active path used a renderer device separate from the decoder and sampled a shared decoder surface without an explicit cross-device completion fence. Once the retained AVFrame was released, the decoder could reuse that surface before the renderer GPU had sampled it, producing a one-frame temporal flash.

Keeping decode and render work on the same protected D3D11 device preserves command ordering through surface reuse.

Verification

  • cargo fmt --all -- --check
  • cargo test -p erika --lib --target x86_64-pc-windows-msvc renderer_stats_distinguish_direct_and_shared_zero_copy
  • flutter build windows --debug --verbose
  • manually replayed the original NipaPlay reproduction window around 07:10 multiple times; the incorrect intermediate frame no longer appeared

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@Shinokawa
Shinokawa merged commit cdae6b5 into main Aug 4, 2026
12 checks passed
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.

1 participant