media-playback: MediaInfo.hardware says hardware when decoding fell back to software #464

Open
opened 2026-11-13 14:05:33 +00:00 by charles · 0 comments
Owner

Follow-up from the review of PR #460 (Task 64, #404), minor finding.

MediaInfo.hardware is filled in demux_main (crates/fluxer-media-playback/src/player.rs) from VideoDecoder::hardware() as soon as the hardware decoder opens, and PlayerEvent::Opened is sent before anything is decoded. It can be wrong in two ways:

  1. hw::get_format falls back to the first software pixel format when FFmpeg does not offer the hardware one for this stream (unsupported profile, size or bit depth). Decoding then runs in software while MediaInfo.hardware says Some(kind).
  2. A hardware decode error mid-stream reopens the decoder in software (DecodeError::Hardware), and nothing reports the change.

Steps to reproduce: open a stream whose profile the GPU's VAAPI/D3D11VA cannot decode (e.g. H.264 4:4:4 or 10-bit H.264 on most GPUs) with HwPreference::Auto on a machine where hardware_decoders() is not empty: Opened(info) has hardware: Some(Vaapi) and frames are decoded in software.

Why deferred: the fix needs an interface decision for Task 67's consumer, which reads MediaInfo once: either Opened waits for the first decoded frame (it then knows the pixel format), or a new event (e.g. PlayerEvent::Hardware(Option<HwKind>)) reports the decoder actually in use and its changes. hardware is used only for --debug-info and diagnostics, so playback is unaffected.

Seen on branch textchat-64-media-playback-crate (commit ae3c1f7).

Follow-up from the review of PR #460 (Task 64, #404), minor finding. `MediaInfo.hardware` is filled in `demux_main` (`crates/fluxer-media-playback/src/player.rs`) from `VideoDecoder::hardware()` as soon as the hardware decoder **opens**, and `PlayerEvent::Opened` is sent before anything is decoded. It can be wrong in two ways: 1. `hw::get_format` falls back to the first software pixel format when FFmpeg does not offer the hardware one for this stream (unsupported profile, size or bit depth). Decoding then runs in software while `MediaInfo.hardware` says `Some(kind)`. 2. A hardware decode error mid-stream reopens the decoder in software (`DecodeError::Hardware`), and nothing reports the change. Steps to reproduce: open a stream whose profile the GPU's VAAPI/D3D11VA cannot decode (e.g. H.264 4:4:4 or 10-bit H.264 on most GPUs) with `HwPreference::Auto` on a machine where `hardware_decoders()` is not empty: `Opened(info)` has `hardware: Some(Vaapi)` and frames are decoded in software. Why deferred: the fix needs an interface decision for Task 67's consumer, which reads `MediaInfo` once: either `Opened` waits for the first decoded frame (it then knows the pixel format), or a new event (e.g. `PlayerEvent::Hardware(Option<HwKind>)`) reports the decoder actually in use and its changes. `hardware` is used only for `--debug-info` and diagnostics, so playback is unaffected. Seen on branch `textchat-64-media-playback-crate` (commit ae3c1f7).
charles added this to the Text chat milestone 2026-11-13 14:05:33 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
charles/fluxer-native#464
No description provided.