feat(stream): add adaptive NVENC bitrate control - #5460
Conversation
3c61e0f to
97937f2
Compare
c474bd1 to
eb4be98
Compare
Signed-off-by: leandredesmaretz <leandre@eshot.io>
Signed-off-by: leandredesmaretz <leandre@eshot.io>
Signed-off-by: leandredesmaretz <leandre@eshot.io>
Signed-off-by: leandredesmaretz <leandre@eshot.io>
Signed-off-by: leandredesmaretz <leandre@eshot.io>
Signed-off-by: burnrazor <128198300+Dragon-kanji@users.noreply.github.com>
Signed-off-by: burnrazor <128198300+Dragon-kanji@users.noreply.github.com>
Signed-off-by: burnrazor <128198300+Dragon-kanji@users.noreply.github.com>
eb4be98 to
87cbef6
Compare
|
Hi, just a quick follow-up since this has been sitting for a few weeks. I rebased the branch onto the current master today. The post-rebase macOS build passes with BUILD_WERROR=ON, all 52 targeted adaptive bitrate, FEC, stream, video, and config tests pass, and the broader deterministic suite passes 458 tests with 2 expected skips. The GitHub Actions workflows have not started yet and appear to still need maintainer approval for the fork. I am still happy to split the PR or adjust the approach if that makes review easier. Thanks! |
|
|
Can't comment on the details of the implementation (don't have Windows to test) but since this is an NVENC encoder specific option it should IMHO be listed in the respective encoder configuration settings and not under "Audio/Video" (as depicted on your screenshot) to avoid confusion for non-NVENC users. |




Description
This PR adds an opt-in adaptive bitrate path for Sunshine's native NVENC encoder on Windows. It is disabled by default.
The reason I built it is pretty practical. I stream from a Windows desktop to a Steam Deck docked to my TV, and the Wi-Fi there is sometimes unstable. Fixed bitrate works well most of the time, but when the connection suddenly degrades, latency can climb very quickly and the stream can become almost unusable.
The new controller reduces the bitrate when packet loss persists, then recovers gradually once the connection looks healthy again. I tried to reuse the existing protocol and signals as much as possible. It uses Moonlight's existing
SS_FRAME_FEC_STATUSreports, the frame-loss recovery signals Sunshine already handles, and ENet RTT samples. It does not add a new feedback protocol.The implementation adds bounded per-session telemetry aggregation, the adaptive controller, and native NVENC runtime bitrate reconfiguration without restarting the encoder. The controller never exceeds the bitrate requested by Moonlight or Sunshine's configured
max_bitrateceiling. If the encoder is unsupported, or if the telemetry is missing or invalid, Sunshine keeps the normal fixed-bitrate behavior.The PR also adds the Windows Audio/Video setting, documentation, and test coverage. I kept the telemetry, controller, and NVENC reconfiguration together because the individual pieces do not provide much value on their own, but I am fine splitting the work if that would make review easier.
Testing performed:
BUILD_WERROR=ON, and the native NVENC SDK 11, 12, and 13 implementationsThe hardware encoder probe was excluded from the SSH-only test session because it requires an interactive Windows desktop.
Screenshot
The new setting is shown below in its default, disabled state.
Issues Fixed or Closed
Roadmap Issues
Type of Change
Checklist
AI Usage
See our AI usage policy.