DietPi icon indicating copy to clipboard operation
DietPi copied to clipboard

DietPi-Software | Sunshine: Self-hosted game stream host for Moonlight

Open mtekman opened this issue 2 years ago • 3 comments

Add Sunshine game stream hosting server for Moonlight.

There are official Debian Bullseye releases for arm64 and amd64 devices, which this pulls from.

mtekman avatar Apr 25 '23 09:04 mtekman

Made some tests

  • Installs fine
  • It seems to only be able to connect to proper X or Wayland sessions, but cannot stream standalone DRM applications. There is an adapter_name setting which sounds like it would be able to stream DRM apps, but I couldn't get this to work. But also the output_name setting to stream an X display from external console didn't work. I could only do that via DISPLAY=:0 environment variable while output_name = 0 in sunshine.conf didn't have any effect (same as with adapter_name setting to any existing DRM device). Other settings, like log file and resolutions, do work, so the config file is parsed (and all settings are also shown in logs on startup).
  • I was only able to stream an X session of the very same user. E.g. a service user sunshine was not able to stream a desktop session from dietpi, regardless which permissions I grant it. This breaks my initial idea to create a system service. There is a user service (systemctl --user start sunshine) instead. It can be enabled and makes use of the xdg-desktop-autostart.target, which reads like it should work, but it doesn't, at least not with LXDE, with or without LightDM login. But probably I am missing something. Needs to be tested with other desktop environments. Starting it manually however works, but without benefit over just running sunshine from console.
  • For remote control (I tested this with Moonlight on Windows and Sunshine in a VirtualBox DietPi VM) the Sunshine host user needs to be in input group. Adding it to video and render group and adding CAP_SYS_ADMIN to the binary btw does not make the adapter_name setting work.
  • I wasn't able to stream audio. Adding the user to audio group does not help, I'm also not sure how exactly the value for audio_sink needs to look like for plain ALSA devices. (As fallback?) it always looks for PulseAudio devices in the end. Tested several variations with the alsa_output example from the docs.

We may search for and/or ask the dev(s):

  • https://app.lizardbyte.dev/discord?lng=en (ah, no support channel anymore)
  • https://github.com/LizardByte/Sunshine/discussions/categories/support

@mtekman Is it possible to install other "apps" to stream, which do not require an X or Wayland (desktop) session? Otherwise I suggest to add a desktop as dependency, like we do for other desktop GUI applications. A prompt will ask the user to choose a desktop, if none is installed yet. The only other pre-installed app is Stream, which requires a desktop as well. For the low-res desktop "app", xrandr is required. I'm not 100% sure about the use case, since both, Sunshine and Moonlight can be configured to use a specific (range of) resolution(s), but we could of course add xrandr to deps to generally support it, if we install a desktop anyway. Let me know if you know/have tested more.

MichaIng avatar May 01 '23 12:05 MichaIng

Ah I installed it initially as the dietpi user and when I ran it, it seemed to startup fine but I didn't test whether it could actually be received.

I was only able to stream an X session of the very same user. E.g. a service user sunshine was not able to stream a desktop session from dietpi, regardless which permissions I grant it. This breaks my initial idea to create a system service. There is a user service (systemctl --user start sunshine) instead. It can be enabled and makes use of the xdg-desktop-autostart.target, which reads like it should work, but it doesn't, at least not with LXDE, with or without LightDM login. But probably I am missing something. Needs to be tested with other desktop environments. Starting it manually however works, but without benefit over just running sunshine from console.

Ah damn, yes I can how running it as another user might not work. I will try running it in other desktops if I get time this week... maybe xvfb-run could be a wild hack?

For remote control (I tested this with Moonlight on Windows and Sunshine in a VirtualBox DietPi VM) the Sunshine host user needs to be in input group. Adding it to video and render group and adding CAP_SYS_ADMIN to the binary btw does not make the adapter_name setting work. I wasn't able to stream audio. Adding the user to audio group does not help, I'm also not sure how exactly the value for audio_sink needs to look like for plain ALSA devices. (As fallback?) it always looks for PulseAudio devices in the end. Tested several variations with the alsa_output example from the docs.

Given everything you've tried, it might really be worth talking to the upstream devs.

In the meantime, let me try building this natively on the RPi4 and seeing if there is any difference.

Thanks again for all your hard work and testing :100:

mtekman avatar May 02 '23 21:05 mtekman

Will defer this to DietPi v8.18 as it requires some more polishing regarding the points mentioned above.

MichaIng avatar May 05 '23 15:05 MichaIng