Skip to content

fix(hdr): latch HDR colorspace so a transient SDR reinit can't downgrade the stream#283

Open
sh00bx wants to merge 1 commit into
Nonary:masterfrom
sh00bx:pr/hdr-latch
Open

fix(hdr): latch HDR colorspace so a transient SDR reinit can't downgrade the stream#283
sh00bx wants to merge 1 commit into
Nonary:masterfrom
sh00bx:pr/hdr-latch

Conversation

@sh00bx

@sh00bx sh00bx commented Jun 22, 2026

Copy link
Copy Markdown

Problem

A virtual display created for an HDR session briefly re-enumerates as SDR during a capture reinit — the double-refresh / HDR-profile mode change ~1s into a session momentarily drops the output to G22 8-bit. make_encode_device re-reads is_hdr() on every reinit, so the encoder was rebuilt for an 8-bit SDR colorspace mid-session and streamed SDR frames to an HDR client. That faults the client decoder ("decoder reported error") and tears the session down.

The legacy dd_wa_hdr_toggle workaround that previously masked this was removed in the v1.14 display refactor; this covers the capture-side path that the display-device config-apply does not.

Fix

Latch the established-HDR state per session (a field on sync_session_ctx_t for sync capture, a local in the async capture loop) so that once an HDR-requested session has actually established HDR, a momentary is_hdr() == false during a reinit can no longer downgrade the wire colorspace. Genuinely-SDR sources never latch because hdr_display is never true for them.

Single-file change in src/video.cpp (+29/-3).

🤖 Generated with Claude Code

…ade the stream

A virtual display created for an HDR session briefly re-enumerates as SDR
during a capture reinit (the double-refresh / HDR-profile mode change ~1s into
a session momentarily drops the output to G22 8-bit). make_encode_device
re-reads is_hdr() on every reinit, so the encoder was rebuilt for an 8-bit SDR
colorspace mid-session and streamed SDR frames to an HDR client, which faults
the client decoder ("decoder reported error") and tears the session down.

Latch the established-HDR state per session (a field on sync_session_ctx_t for
sync capture, a local in the async capture loop) so that once an HDR-requested
session has actually established HDR, a momentary is_hdr()==false during a
reinit can no longer downgrade the wire colorspace. Genuinely-SDR sources never
latch because hdr_display is never true for them.

The legacy dd_wa_hdr_toggle workaround that previously masked this was removed
in the v1.14 display refactor; this covers the capture-side path that the
display-device config-apply does not.
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