moonlight-stream / moonlight-qt

GameStream client for PCs (Windows, Mac, Linux, and Steam Link)
GNU General Public License v3.0
10.64k stars 621 forks source link

Small frame rate drops under Windows, stable frame rate under Linux #1011

Open LogicDiscovery opened 1 year ago

LogicDiscovery commented 1 year ago

Describe the bug I'm experiencing some very small fps drops while streaming and I use the Windows client. When I watch the stats the fps frequently goes between 59.40(ish) and 60.07(ish), while producing a very slight but noticeable stutter. Curiously the same isn't true when I run the client under Linux on the same machine - there the fps counter stays just about rock solid at 60, but frequently rather go up to 60.07 - 60.11 (but mostly stay at 60.07), and the stream doesn't produce the same slight stutter.

The exact same issue is present no matter which resolution I set the client stream to, and I've tried pushing the 4k stream up to 100-120 mbit without any issues with frames dropping.

As far as I can tell the only real difference is that the Windows client puts my TV into 120 fps mode, while the Linux client let's my TV stay at 60 fps.

Affected games GTA 4, Marvel's Spider-Man Remastered, Max Payne 3, and anything else I've been trying out.

Moonlight settings (please complete the following information)

Client PC details (please complete the following information)

Server PC details (please complete the following information)

Moonlight Logs (please attach) moonlight_4k60_popOS.log moonlight_4k60_win11.log

Bobbar commented 1 year ago

Win11: Frame pacing active: target 120 Hz with 60 FPS stream Linux: Frame pacing disabled: target 60 Hz with 60 FPS stream

That might lead to some differences.

LogicDiscovery commented 1 year ago

That is really odd since the option for frame pacing is definitely disabled in the windows client..

I did some more testing using the portable release, and it seems like frame pacing will activate by itself even if the option is not set. It seems to be connected to me activating HDR-support, but my TV still goes into 120hz without HDR even when HDR is enabled on the host.

However this behavior is of course not present if I launch borderless fullscreen, with the added benefit that my TV won’t go into 120hz and now frame pacing is disabled, with a 60hz target and 60 FPS stream. The problem instead becomes that the TV won’t switch to SDR when the stream does (when launching a game that’s not HDR-compatible).

LogicDiscovery commented 1 year ago

Some further testing: I managed to stop my TV from going into 120hz by using Custom Resolution Utility, but the client still activates frame pacing when HDR is activated. But since my frame rate issue is present without HDR being activated I think this might be a separate bug?

I captured some video that I think might show a bit more of the problem I'm having. The clip from Windows 11 shows a constant stuttering while rotating the camera, and the clip from Linux shows a slight stuttering for about the first 10 seconds and then it evens out to produce a much smoother video. Still the only real difference in the statistics is that the stream under Windows never shows a frame queue delay over 1ms, while the stream under Linux can go upwards of 6-8ms (and sometimes a bit more). Could this be the reason why the stream appears more stuttering under Windows?

Windows 11 (4k60): https://github.com/moonlight-stream/moonlight-qt/assets/2357739/cdd85f70-e5d7-4e4d-9e4e-b9504991ec2c

Linux (4k60): https://github.com/moonlight-stream/moonlight-qt/assets/2357739/ea4885de-cebc-4e63-b803-c86a08c7f944