Skip to content

bugfix: hardware decoder issue in certain files, added support to swi…#57

Merged
tapframe merged 1 commit into
NuvioMedia:Devfrom
anilabhadatta:Dev
Jun 19, 2026
Merged

bugfix: hardware decoder issue in certain files, added support to swi…#57
tapframe merged 1 commit into
NuvioMedia:Devfrom
anilabhadatta:Dev

Conversation

@anilabhadatta

Copy link
Copy Markdown
Contributor

Edited player_bridge.cpp
Edited player_bridge.cpp
Viewed controls.html:1-23

Here is the updated Pull Request description that properly explains the codec and hardware decoder logic:


Summary

Fixed playback black screens on Windows by correcting the decoderPriority UI-to-native mapping and resolving a critical hardware decoder codec compatibility issue by switching from forced D3D11VA to smart auto-probing.

PR type

  • Reproducible bug fix
  • UI glitch/bug fix
  • Behavior bug/regression fix
  • Small maintenance only, with no UI or behavior change
  • Docs accuracy fix
  • Translation/localization only
  • Approved larger or directional change

Why

We discovered two major issues causing black screens and playback failures on Windows:

  1. Hardware Decoder Compatibility (The Core Issue): Previously, the player was hardcoded to use hwdec=d3d11va (forcing the AMD GPU's Direct Rendering path). However, different GPUs support different codec profiles. For example, when playing a VC-1 or unsupported Dolby Vision stream, forcing the AMD decoder resulted in silent failures and black screens. By changing the base configuration to hwdec=auto, MPV is now allowed to intelligently probe the system's capabilities at runtime. On dual-GPU systems (e.g., AMD + NVIDIA), auto correctly discovers which GPU can actually handle the specific codec (e.g., selecting nvdec-copy via NVIDIA CUDA for VC-1) instead of forcing a crash on the AMD card.
  2. Decoder Priority Mapping Offset: The UI settings send integer priorities (0: Device Only, 1: Prefer Device, 2: App Decoders/CPU), but the C++ bridge was checking for 1, 2, and 3. This meant user selections were completely ignored, falling through to broken base cases.

Desktop scope

Windows only (composeApp/src/desktopMain/native/windows/player_bridge.cpp).

Issue or approval

No linked issue - fixes direct playback crash/black screen regression on Windows native player.

UI / behavior impact

  • No UI change
  • No behavior change
  • UI changed only to fix a documented glitch/bug
  • Behavior changed only to fix a documented bug/regression
  • UI change has explicit maintainer approval
  • Behavior change has explicit maintainer approval

Policy check

  • I have read and understood CONTRIBUTING.md.
  • This PR is small, focused, and limited to one problem.
  • This PR is scoped to the desktop app, desktop packaging, desktop documentation, or shared code required for desktop behavior.
  • This PR is not cosmetic-only.
  • Any UI change fixes a linked glitch/bug and includes visual proof, or this PR has no UI change.
  • Any behavior change fixes a linked bug/regression or has explicit approval, or this PR has no behavior change.
  • This PR does not bundle unrelated refactors, cleanups, formatting, or drive-by changes.
  • This PR does not add dependencies, architecture changes, migrations, or product-direction changes without explicit approval.
  • I listed the testing performed below.

Scope boundaries

This fix does not change the UI text or alter how the Kotlin UI handles its state. It strictly aligns the C++ backend to receive the correct state and lets the MPV engine perform native codec probing.

Testing

Tested on Windows with a multi-GPU setup (AMD + NVIDIA) using various codecs (including VC-1 and HEVC).

  • Auto-probing success: Verified that decoderPriority == 0 (Device Only) runs hwdec=auto. Log outputs proved that MPV successfully tests and selects the optimal decoder (nvdec-copy on NVIDIA) when the AMD direct path fails.
  • CPU Fallback: Verified decoderPriority == 1 (Prefer Device) correctly applies vd-lavc-software-fallback=yes alongside auto, providing a safety net if no GPU supports the codec.
  • Pure Software: Verified decoderPriority == 2 (App Decoders) runs hwdec=no to force software decoding for absolute stability.

Screenshots / Video

Before:
Screenshot 2026-06-19 022948

After:
image

Breaking changes

None.

Linked issues

26

Note to Author:

Please do check if the code changes are as expected, and hopefully, it should not break in any scenario. If I am missing anything, do let me know.
I have done the changes only for the Windows OS,

Current System Specs
AMD Ryzen 6800HS
32GB DDR5
NVIDIA RTX 3080 8GB Laptop Variant

…tch between CPU/GPU decoder in playback settings
@tapframe tapframe merged commit f42334b into NuvioMedia:Dev Jun 19, 2026
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.

2 participants