veldenb / plugin.program.moonlight-qt

A launcher and updater for running Moonlight-qt on LibreELEC.
GNU General Public License v3.0
88 stars 12 forks source link

Audio doesn't work unless I start with `PULSE_SERVER=none` #22

Closed Atemu closed 1 year ago

Atemu commented 2 years ago

On my RPI4 running LE 10, audio only works when I run moonlight via ALSA. Pulseaudio seems to be running but Kodi is not configured to use it. It seems Moonlight tries to use pulse despite that.

There should be an option to choose between PA/ALSA.

veldenb commented 2 years ago

The plugin should automatically detect pulse or ALSA based on the audio backend Kodi uses. Can you see what audio device is configured in Kodi?

Atemu commented 2 years ago

It's an ALSA sink. Pulseaudio is also available but there is only a Bluetooth dummy device and it isn't selected.

Either way, I think there should be an option to let the user choose. No auto-detection is perfect. It's good and appreciated for a default but not the ultimate setting.

veldenb commented 2 years ago

The Bluetooth pulseaudio config is default and for Bluetooth speakers. Are you able start the plugin from the Kodi interface and ssh into your Kodi-box en post the following log file? cat /storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-qt.log

Starting the plugin from the CLI will result in moonligh-qt defaulting to pulseaudio.

veldenb commented 1 year ago

Closing stale issue for now

vanMacG commented 1 year ago

Hello @veldenb I would like to reactivate this issue as it seems I have the same problem. I have a Soundcard (hifiberry) installed on my Raspberry Pi 3. In Kodi I select it with "ALSA (hifiberry)" and it works. However in moonlight, the audio is played over HDMI (to the TV). Maybe this is related to this?

What do you need from the log file, it's quite long? Here are the lines with "audio" in it...

00:00:04 - SDL Info (0): Desired audio buffer: 480 samples (1920 bytes)
00:00:04 - SDL Info (0): Obtained audio buffer: 480 samples (1920 bytes)
00:00:04 - SDL Info (0): Audio channel count: 2
00:00:04 - SDL Info (0): Audio channel mask: 3
00:00:10 - SDL Info (0): Initializing audio stream...
00:00:10 - SDL Info (0): done
00:00:10 - SDL Info (0): Starting RTSP handshake...
00:00:10 - SDL Info (0): Audio port: 48000
00:00:11 - SDL Info (0): Starting audio stream...
00:00:11 - SDL Info (0): Received first video packet after 0 ms
00:00:11 - SDL Info (0): Desired audio buffer: 480 samples (1920 bytes)
00:00:11 - SDL Info (0): Obtained audio buffer: 480 samples (1920 bytes)
00:00:11 - SDL Info (0): Audio stream has 2 channels
00:00:11 - SDL Info (0): done
00:00:11 - SDL Info (0): Starting input stream...
00:00:11 - SDL Info (0): Received first audio packet after 0 ms
00:00:11 - SDL Info (0): Initial audio resync period: 500 milliseconds
00:00:11 - SDL Info (0): done
veldenb commented 1 year ago

@vanMacG can you start moonlight from Kodi and attach the full log file from /storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-qt.log here?

vanMacG commented 1 year ago

moonlight-qt.log (I only replaced computer names and uuid)

veldenb commented 1 year ago

@vanMacG looks ok. Can you start the plugin again and post your /storage/.kodi/temp/kodi.log ?

vanMacG commented 1 year ago

@veldenb sure: kodi.log

(In /storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-home/ there is no folder "alsa", only a folder called "Moonlight Game Streaming Project".)

veldenb commented 1 year ago

@vanMacG does creating the directory fix the issue? you can run this command on your pi: mkdir /storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-home/.config/alsa/

vanMacG commented 1 year ago

@veldenb Perfect, now it works like a charm :)

The line in kodi.log changed from WARNING <general>: Failed to resolve audio output device, audio within Moonlight might not work: [Errno 2] No such file or directory: '/storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-home/.config/alsa/asoundrc' to INFO <general>: New ALSA config file written to /storage/.kodi/userdata/addon_data/plugin.program.moonlight-qt/moonlight-home/.config/alsa/asoundrc In this asoundrc-file, the code was automatically added for my hifiberry: pcm.!default "sysdefault:CARD=sndrpihifiberry"

Thank you very much! 🚀

veldenb commented 1 year ago

@vanMacG great, I'll add a fix for this in the next release :+1: