Skip to content

feat(video): add selectable video codecs - #194

Draft
ReenigneArcher wants to merge 3 commits into
masterfrom
feat/decoder-choices
Draft

ReenigneArcher wants to merge 3 commits into
masterfrom
feat/decoder-choices

Conversation

@ReenigneArcher

@ReenigneArcher ReenigneArcher commented May 25, 2026 •

Copy link
Copy Markdown
Member

Description

Add H.264, MPEG-2/H.262, and H.263+ codec selection in Settings → Display. Auto (Prefer MPEG-2) tries MPEG-2 when the host advertises it and uses standard negotiation when MPEG-2 is unavailable or its RTSP handshake fails. Standard Auto prefers H.264, then MPEG-2, then H.263+. An explicit codec choice requests that codec.

  • Save the choice in streaming.video_codec and continue reading legacy streaming.video_decoder settings.
  • Enable the matching FFmpeg decoders and parsers and report the active codec in the stream status and statistics.
  • Keep codec, presentation, and statistics preferences together in client state. Cycling the codec preserves the manual bitrate and both presentation settings.
  • Build on master at dbecb06, including perf(video): hand off decoded frames by reference #349’s frame handoff and Software default at 640×480, 60 FPS, and 3 Mbps.

The common-library pin remains ed6b2da, based on upstream 94c65fd. This PR depends on the open moonlight-common-c #175. Host encoder support is tracked in Sunshine #5194.

TODO:

Screenshot

Issues Fixed or Closed

Roadmap Issues

Testing

  • Windows MSYS2 MinGW64 built the release Xbox ISO and both opt-in experiment ISOs.
  • ctest --test-dir cmake-build-release --output-on-failure passed all 480 tests. The tests cover saved codec migration, explicit and preferred request masks, codec negotiation order, and the codec menu’s interaction with bitrate and presentation settings.
  • The release playback probe decoded prerecorded H.264, MPEG-2, and H.263+ at 640×480 and 60 FPS in xemu. Each codec displayed through both GPU and Software presentation. The guest frame-lifetime check passed.
  • Strict Dockle/Doxygen API docs, shared clang-format, CMake lint, and git diff --check passed.
  • Before the settings refactor, the replayed codec commit matched the saved combined tree byte for byte. The follow-up addresses the reported cpp:S1820 finding in SettingsState.

Live Sunshine negotiation and physical Xbox playback remain unverified. Hosted checks will rerun for the published head.

Type of Change

  • feat: New feature (non-breaking change which adds functionality)
  • fix: Bug fix (non-breaking change which fixes an issue)
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semicolons, etc.)
  • refactor: Code change that neither fixes a bug nor adds a feature
  • perf: Code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit
  • BREAKING CHANGE: Introduces a breaking change (can be combined with any type above)

Checklist

  • Code follows the style guidelines of this project
  • Code has been self-reviewed
  • Code has been commented, particularly in hard-to-understand areas
  • Code docstring/documentation-blocks for new or existing methods/components have been added or updated
  • Tests have been added or updated for new or modified functionality, including regression tests for bug fixes

AI Usage

See our AI usage policy.

  • AI tools were used while preparing this PR

AI tools generated much of the feature and assisted with implementation review, the shared protocol changes, settings migration, rebasing, documentation, and tests.

This pull request was updated by Codex (GPT-6; thinking level not exposed by this session).

@codecov

codecov Bot commented May 25, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 51.08696% with 45 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.83%. Comparing base (d9c10ee) to head (dff1ed2).
⚠️ Report is 51 commits behind head on master.

Files with missing lines Patch % Lines
src/app/settings_storage.cpp 52.38% 12 Missing and 8 partials ⚠️
src/ui/shell_view.cpp 0.00% 11 Missing and 3 partials ⚠️
src/app/client_state.cpp 62.06% 7 Missing and 4 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
- Coverage   63.16%   62.83%   -0.33%     
==========================================
  Files          35       33       -2     
  Lines        5261     5330      +69     
  Branches     2385     2417      +32     
==========================================
+ Hits         3323     3349      +26     
- Misses        935      964      +29     
- Partials     1003     1017      +14     
Flag Coverage Δ
Linux 63.14% <51.68%> (-0.22%) ⬇️
macOS 49.85% <43.03%> (-0.10%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/app/client_state.h 97.91% <100.00%> (+0.04%) ⬆️
src/startup/video_mode.cpp 61.62% <100.00%> (+0.91%) ⬆️
src/streaming/stats_overlay.cpp 100.00% <100.00%> (ø)
src/app/client_state.cpp 66.89% <62.06%> (-0.10%) ⬇️
src/ui/shell_view.cpp 58.52% <0.00%> (-1.61%) ⬇️
src/app/settings_storage.cpp 71.86% <52.38%> (-3.33%) ⬇️

... and 6 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d9c10ee...dff1ed2. Read the comment docs.

@ReenigneArcher
ReenigneArcher force-pushed the feat/decoder-choices branch 2 times, most recently from 0927719 to 5320639 Compare May 25, 2026 16:12
@ReenigneArcher
ReenigneArcher force-pushed the feat/decoder-choices branch 2 times, most recently from c00fc4c to 5a2991d Compare June 4, 2026 23:43
@ReenigneArcher
ReenigneArcher force-pushed the feat/decoder-choices branch 4 times, most recently from e8326cd to dff1ed2 Compare June 24, 2026 02:52
@SunshineStream SunshineStream deleted a comment from sonarqubecloud Bot Nov 13, 2026
@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 82.85714% with 18 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.00%. Comparing base (dbecb06) to head (c2a39fd).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/app/settings_storage.cpp 73.07% 4 Missing and 10 partials ⚠️
src/app/client_state.cpp 87.87% 1 Missing and 3 partials ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #194      +/-   ##
==========================================
+ Coverage   73.84%   74.00%   +0.15%     
==========================================
  Files          68       69       +1     
  Lines        7922     8020      +98     
  Branches     3464     3497      +33     
==========================================
+ Hits         5850     5935      +85     
- Misses       1091     1092       +1     
- Partials      981      993      +12     
Flag Coverage Δ
Linux 73.27% <83.83%> (+0.18%) ⬆️
macOS 62.47% <68.13%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/app/client_state.h 98.64% <100.00%> (+0.01%) ⬆️
src/app/settings_storage.h 100.00% <100.00%> (ø)
src/startup/video_mode.cpp 61.62% <100.00%> (+0.91%) ⬆️
src/streaming/video_codec_selection.cpp 100.00% <100.00%> (ø)
src/app/client_state.cpp 75.24% <87.87%> (+0.18%) ⬆️
src/app/settings_storage.cpp 76.59% <73.07%> (-0.75%) ⬇️

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dbecb06...c2a39fd. Read the comment docs.

Comment thread src/streaming/video_overlay.cpp Fixed
@ReenigneArcher
ReenigneArcher force-pushed the feat/decoder-choices branch 4 times, most recently from 934387a to 9ae114e Compare November 18, 2026 00:25
Prefer advertised MPEG-2 by default and retain standard automatic negotiation as a fallback.
@sonarqubecloud

Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 New issue

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

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