Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 7 commits into
base: dev
Choose a base branch
from

Conversation

mtekman
Copy link
Contributor

@mtekman mtekman commented Apr 25, 2023

Add Sunshine game stream hosting server for Moonlight.

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

@MichaIng MichaIng added this to the v8.17 milestone Apr 25, 2023
@MichaIng MichaIng self-requested a review April 25, 2023 12:34
- DietPi-Software | Sunshine: Add changelog entry, dietpi-survey report support and credits to README
- DietPi-Software | Restore execute bit
- DietPi-Software | Sunshine: Cleanup data and possibly enable systemd user services on uninstall
@MichaIng
Copy link
Owner

MichaIng commented May 1, 2023

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):

@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.

@mtekman
Copy link
Contributor Author

mtekman commented May 2, 2023

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 💯

@MichaIng MichaIng modified the milestones: v8.17, v8.18 May 5, 2023
@MichaIng
Copy link
Owner

MichaIng commented May 5, 2023

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

@MichaIng MichaIng modified the milestones: v8.18, v8.19 Jun 3, 2023
@StephanStS StephanStS modified the milestones: v8.19, v8.20 Jul 9, 2023
@MichaIng MichaIng modified the milestones: v8.20, v8.21 Jul 29, 2023
@MichaIng MichaIng modified the milestones: v8.21, v8.22 Aug 27, 2023
@StephanStS StephanStS modified the milestones: v8.22, v8.23 Sep 25, 2023
@MichaIng MichaIng modified the milestones: v8.23, v8.24 Oct 21, 2023
@MichaIng MichaIng removed this from the v8.24 milestone Nov 18, 2023
@MichaIng MichaIng added this to the v8.25 milestone Nov 18, 2023
@MichaIng MichaIng modified the milestones: v8.25, v9.0 Dec 20, 2023
@MichaIng MichaIng modified the milestones: v9.0, v9.1 Jan 20, 2024
@StephanStS StephanStS modified the milestones: v9.1, v9.2 Feb 23, 2024
@StephanStS StephanStS modified the milestones: v9.2, v9.3 Mar 18, 2024
@MichaIng MichaIng removed this from the v9.3 milestone Apr 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants