loki-47-6F-64 / sunshine

Host for Moonlight Streaming Client
GNU General Public License v3.0
1.78k stars 152 forks source link

Stream freezes when entering fullscreen application #228

Closed hadicharara closed 3 years ago

hadicharara commented 3 years ago

Issue is as the title describes. Weirdly, it seems to affect most but not all Moonlight clients. Works fine on the desktop on all devices. When entering full screen mode on some devices, or when clicking the Steam Big Picture icon, the stream opens, shown the desktop briefly while Steam Big picture hasn't lauched yet, then freezes and I get a bad connection error. Gamepad controls still works. I also tried launching a game manually from the Desktop, but it the stream freezes when it launches,

Tested on:

Running Sunshine on KDE Neon with 5.13.13-051313-generic x86_64 x86_64 GNU/Linux kernel (X11, VAAPI on AMD RX 6700 XT).

Sample verbose log for OnePlus 6 stream here Sample verbose log for Nintendo Switch stream here

Thanks!

loki-47-6F-64 commented 3 years ago

This is fixed in the master branch. :P

You can either wait for the next release. (A week or so).

Or you can compile from source.

hadicharara commented 3 years ago

I pulled and compiled today. I tried running pull again but it seems I'm on the latest commit.

hadicharara commented 3 years ago

I just tried running the Switch client @ 720p and it seems to work fine. I tried the Android TV one @ 480p to no avail. Could this be a client-specific problem then?

loki-47-6F-64 commented 3 years ago

What if you run on Moonlight Android on Google Chromecast with Google TV with 720p?

hadicharara commented 3 years ago

The initial test was @ 720p. I haven't tried it @ 1080p yet. Sorry should have specified the resolutions above. OnePlus 6 @ 720p as well. Just tried the OnePlus @ 1080p and it works fine.

loki-47-6F-64 commented 3 years ago

That's weird. So it's all running fine now?, woops mistook that one for the one that didn't work

hadicharara commented 3 years ago

Would you like me to run other tests? I can use a Windows Moonlight QT client

loki-47-6F-64 commented 3 years ago

Could you repeat the test with the switch on 1080p? Just in case since 720p seems to work.

Would you like me to run other tests? I can use a Windows Moonlight QT client

Yes please :P

loki-47-6F-64 commented 3 years ago

Could you also test changing desktop resolution while it's still streaming?

hadicharara commented 3 years ago

Tested the Switch @ 1080p. I discovered it actually freezes after a big screen refresh. IE, if I open any program, it freezes at the animation. Tested The WIndows client at many resolutions. White screen on client even when host is on desktop. Logs show Waiting for IDR frame. Tried changing the resolution but the results matched the resolution set at the client level. Didn't discover anything.

loki-47-6F-64 commented 3 years ago

Is your ffmpeg version 4.3 or higher?

If not, that could be the issue.

hadicharara commented 3 years ago

ffmpeg version 4.2.4-1ubuntu0.1

hadicharara commented 3 years ago

Hmm you might be right. I'll try to upgrade versions then I'll report back. Is there a bug in versions below 4.3?

loki-47-6F-64 commented 3 years ago

That's the root of the issue.

There's a bug which is fixed in 4.3 that prevents applications from sending key frames manually when using VAAPI.

Which is why it's waiting for IDR frames indefinitely.

hadicharara commented 3 years ago

Man this was exactly it! Installed ffmpeg from here: https://launchpad.net/%7Esavoury1/+archive/ubuntu/ffmpeg4, and it solved all my problems. We should probably add a warning to README.md. I assume this only affects when using KMS? I can add a warning and submit a PR.

loki-47-6F-64 commented 3 years ago

This affects vaapi only. Which is the hardware encoder used for Intel and AMD on Linux.

I can add a warning and submit a PR.

Yeah, under the troubleshooting. Thank you 👍