add adaptive NVENC bitrate control #1043
Unanswered
Dragon-kanji
asked this question in
Sunshine
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Feature Request
Body
Hi ! I’m preparing a draft PR around adaptive bitrate for the native NVENC encoder on Windows. It is opt-in and disabled by default.
The reason is honestly pretty simple : my setup is a Windows desktop streaming to a Steam Deck, docked to my TV, with a controller. It works great most of the time, but the Wi-Fi near the TV is not very stable. I had a few cases where everything was fine and then, suddenly, the latency went through the roof or the stream almost completely stopped even with a fairly reasonable bitrate.
So I started looking at whether Sunshine could react a bit better when the connection gets bad. Not magically fix poor Wi-Fi, obviously, but at least avoid pushing the same bitrate while packets are being lost. The idea is to lower it when the loss continues, keep the stream playable, and slowly go back up once things look normal again.
I tried to reuse what is already there as much as possible. There is no new feedback protocol, it relies on Moonlight’s existing SS_FRAME_FEC_STATUS reports, the frame-loss recovery signals Sunshine already handles, and the RTT information already available through ENet. Most of the new work is about collecting those signals safely, deciding when to move the bitrate up or down, and letting NVENC apply the change while the encoder is still running. if the backend is unsupported, or if the telemetry looks wrong, Sunshine simply keeps the normal fixed-bitrate behavior. I tested it on my Windows machine with an RTX 4090 and controlled packet loss. The bitrate moved down while the same encoder session kept running, without disconnecting the stream. There is also quite a lot of test coverage around the controller, aggregation and fallback cases.
I know the PR is not small. I kept these pieces together because the individual parts do not really provide much on their own, but I’m completely fine splitting it into smaller steps if that would make it easier to review.
Does this direction make sense for Sunshine, and would you prefer to review it as one PR or split into smaller steps?
Beta Was this translation helpful? Give feedback.
All reactions