Skip to content

Fix hdrMode=1 query string to use Enable HDR checkbox - #242

Merged
TheElixZammuto merged 1 commit into
TheElixZammuto:masterfrom
andygrundman:andyg.xbox-fix-hdrMode
Jan 6, 2026
Merged

TheElixZammuto merged 1 commit into
TheElixZammuto:masterfrom
andygrundman:andyg.xbox-fix-hdrMode

Conversation

@andygrundman

@andygrundman andygrundman commented Jan 5, 2026 •

Copy link
Copy Markdown
Collaborator

This fixes a bug where the weird hdrMode=1 query string, and other junk was always being sent. This broke Sunshine's "auto-switch-to-HDR" feature. Now the MAIN10 variant of H265 is only reported when the HDR checkbox is enabled.

Fixes #238

(config->supportedVideoFormats & VIDEO_FORMAT_MASK_10BIT) ? "&hdrMode=1&clientHdrCapVersion=0&clientHdrCapSupportedFlagsInUint32=0&clientHdrCapMetaDataId=NV_STATIC_METADATA_TYPE_1&clientHdrCapDisplayData=0x0x0x0x0x0x0x0x0x0x0" : ""

Summary by CodeRabbit

  • Bug Fixes
    • H.265 Main 10 video format availability is now contingent on HDR being enabled. The format will only be offered to users when HDR support is explicitly turned on.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai

coderabbitai Bot commented Jan 5, 2026 •

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The pull request modifies MoonlightClient::StartStreaming to conditionally enable H.265 MAIN10 video format only when HDR is explicitly enabled, rather than enabling it by default for non-Xbox One VCR configurations.

Changes

Cohort / File(s) Summary
Video Format Conditional Logic
State/MoonlightClient.cpp
Made VIDEO_FORMAT_H265_MAIN10 addition conditional on sConfig->enableHDR flag; previously this format was always enabled when not on Xbox One VCR

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~5 minutes

Possibly related PRs

Poem

🐰 A format most fine, H.265 MAIN10,
Now dances with HDR when enabled, you know!
No more automatic, just when you decree—
Conditional beauty in streaming so free! 🎬

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main change: fixing the hdrMode query string parameter to be conditional on the Enable HDR checkbox rather than always being appended.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9ea9d79 and d4208e5.

📒 Files selected for processing (1)
  • State/MoonlightClient.cpp
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: LAGonauta
Repo: TheElixZammuto/moonlight-xbox PR: 167
File: State/MoonlightHost.h:38-38
Timestamp: 2025-02-27T02:36:15.388Z
Learning: When using hdmiDisplayMode in the MoonlightHost::Connect() method, a null check should be performed since hdmiDisplayMode might be null when loading previously saved hosts without display information. The MoonlightClient constructor should either handle null parameters or the Connect() method should initialize hdmiDisplayMode with a default value before passing it.
📚 Learning: 2025-02-27T02:36:15.388Z
Learnt from: LAGonauta
Repo: TheElixZammuto/moonlight-xbox PR: 167
File: State/MoonlightHost.h:38-38
Timestamp: 2025-02-27T02:36:15.388Z
Learning: When using hdmiDisplayMode in the MoonlightHost::Connect() method, a null check should be performed since hdmiDisplayMode might be null when loading previously saved hosts without display information. The MoonlightClient constructor should either handle null parameters or the Connect() method should initialize hdmiDisplayMode with a default value before passing it.

Applied to files:

  • State/MoonlightClient.cpp
🔇 Additional comments (1)
State/MoonlightClient.cpp (1)

265-270: LGTM! Correct fix for HDR auto-switching.

The conditional check on sConfig->enableHDR properly gates the VIDEO_FORMAT_H265_MAIN10 capability, ensuring 10-bit HDR format is only advertised when the user has explicitly enabled HDR. This allows Sunshine's auto-HDR switching to function correctly instead of being forced into HDR mode unconditionally.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@TheElixZammuto
TheElixZammuto merged commit eb8599a into TheElixZammuto:master Jan 6, 2026
1 check 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.

Streams always starts with HDR

2 participants