RetroELEC Kodi+Wayland+Emulationstation+RetroArch (x86/XU4/RPi)

  • mtk1

    I will be offline a couple of days can't look closely now but it's very unexpected behaviour. Kodi in my image runs with ALSA through the

    KODI_AE_SINK=ALSA variable which is set in the systemd unit file (confirm it by excecuting systemctl cat kodi). The binary kodi.bin is started through pasuspender which suspends Pulseaudio until the process exits. You shouldn't be getting any sound from setting Pulseaudio in system settings, and there should be no need to stop Pulseaudio as it's already suspended. I'll have a look at your logs later though, thanks for the feedback.

    yep:

    cinemax:~ # systemctl cat kodi

    # /usr/lib/systemd/system/kodi.service

    [Unit]

    Description=Kodi Media Center

    Wants=kodi.target

    Conflicts=weston.service sway.service xorg.service emulationstation.service

    After=weston.service sway.service xorg.service emulationstation.service

    [Service]

    Environment=KODI_AE_SINK=ALSA

    Environment=__GL_YIELD=USLEEP

    Environment=HOME=/storage

    Environment=KODI_TEMP=/storage/.kodi/temp

    Environment=KODI_HOME=/usr/share/kodi/

    EnvironmentFile=-/run/libreelec/kodi.conf

    EnvironmentFile=-/run/libreelec/debug/kodi.conf

    ExecStartPre=-/usr/lib/kodi/kodi-config

    ExecStart=/usr/lib/kodi/kodi.sh --standalone -fs $KODI_ARGS $KODI_DEBUG

    ExecStopPost=-/usr/lib/kodi/kodi-safe-mode

    TimeoutStopSec=10

    Restart=always

    RestartSec=2

    StartLimitInterval=0

    LimitNOFILE=16384

    TTYPath=/dev/tty1


    note the lower case here (in /usr/lib/kodi/kodi.sh):

    if [ "$KODI_AE_SINK" = "alsa" ]; then

  • Aha! Nicely spotted, I’ll upload Fixed images asap. Until then you could copy kodi.sh to /storage modify it and add custom kodi.service to /storage/.config/system.d.

    EDIT: fixed generic image uploaded.

  • These cores are currently included for Generic:

    Sega CD is supported by the genesis core I believe.

  • Hello, i coud not install retroelec on my old intel nuc 5i5ryh, because of problem with igp card.

    So i did buy nuc 8i7hvk, because i want to use it as an emulator for ps2 and ps3.

    So now i can install it on nuc, but i have another problem.

    In kodi sound works well as default - hda ati hdmi 4 or hda ati onk ht-r693 on hdmi 4.

    but in retroarch and emulationstation i have no sound, not even on headphones.

    i dont know what to do. i upgraded also bios but that did not work.

    please help me

    thank you

    robert

  • New generic image uploaded with 5.6.0-rc1 kernel and glibc 2.31.

    Updated to this image. kodi works incl. passthrough. Firefox and RetroArch seem to have issues with audio.

    FF behaves like its still waiting for the audio/video stream to arrive, but I believe its rather waiting or the audio device to become available.

    RA starts up. black screen, says 'controller dectected...' and freezes. strace shows it looping around a nano_sleep - most likely also waiting for the audio device ? pulse ?

    if I kill pulse before starting FF, then FF behaves normally, but there's no audio coming out....

    I assume this was discussed before. If so, please excuse my ignorance. why is pulse actually required for a kioks-like setup such as RetroArch.

    There's only one active Application, and, I'm sure they all can natively speak ALSA, no ?

  • It's not required per se, but on some platforms I had to use Pulseaudio in order to get sound working in Emulationstation's video previews, also there used to be an issue back when youtube used flash plugin to output sound as the browser itself had locked the device and the plugin tried to acquire it. There will always be corner cases where you need to mix two streams together, and there's just no reason not to use Pulseaudio. ALSA has dmix as well available as /storage/.config/asound.conf.dmix , but according to my testing Pulseaudio's resampler is superior both quality and performance wise.

    Here's my other reasons for using it:

    - Automatic detection of the active output (mine is hw:0,3)

    - A2DP audio streaming

    - All apps including containers can simply point to it and have sound on the correct output

    Technically, it supports passthrough of HD audio as of 13.0 but Kodi being 5 years behind on technology as usual (no HDR yet lol) it's not supported yet at least not in Leia AFAIK.

    My launcher scripts lets you force ALSA if you wish, just prefix the commands with ALSA=1 in es_systems.cfg and you should be good to go (that'll use pasuspender to launch RA too though, so Pulseaudio will still be running after exit due to the current issue). The reason for you not having sound when you stop Pulseaudio is probably because the correct output is not set in asound.conf. ALSA needs to be configured for the right output, I try to detect this (by using Pulseaudio) with alsa-config.sh and output it to /storage/.config/asound.conf.hw which is symlinked to asound.conf. Have a look at it, it's not fail proof.

    I used to have ALSA as a default, but then I was flooded with "no sound" reports due to improperly set up asound.conf (before I created alsa-config.sh). Either way you look at it, it's hard to have sound working automagically on all platforms and across all applications. I choose Pulseaudio because I feel it's the right way forward and when it does work it works beautifully.

    Back to the issue at hand, it seems like pasuspender doesn't unsuspend the sink. This was working, I suspect an issue with glibc 2.31. I see that pactl list ends in a segmentation fault as well. A quick fix is to add a custom kodi.service with this line added:

    ExecStopPost=/usr/bin/pactl suspend-sink @DEFAULT_SINK@ 0

    I can reproduce, so I will get this fixed. I know my quality control is poor at times due to lack of time. I don't keep an archive of images either as my gdrive gets filled up. I'll try to get it solved after work + build time for all platforms ;)

  • Tried the last version for RPi4 seems to work quite well! Thanks!

    Just in time to get everything ready to give out the Pi as a birthday gift to a friend with two kids that wanted something like this. \o/

    Just out of curiosity, do you have any plans to toss in steamlink/moonlight, IAGL or other software in?

  • IAGL is available as a Kodi addon and is compatible with this image AFAIK. As for steamlink/moonlight I don't find those interesting, so no. You should be able to run them through Docker though.

  • Thanks for sharing your thoughts here. I had imagined that dmix would be sufficient to handle concurrent PCM audio sources, while passthrough only works with one active source, anyways. But, I see your point about configuring ALSA properly. I know ALSA from the beginning and it never seemed straight forward to me - unless you invented it :)


    I'm OK with Pulse, it just seemed to cause quite some trouble. But, yeah, as you say, without it's maybe even worse...

    I'll play around with ALSA1=1 when I get some time.

    I know this all consumes a lot of spare time. Thanks for working on this. I'll try to help testing and bug hunting, where possible.

  • Fixed generic image uploaded, give it a whirl :)

    Pulseaudio was never the issue, it's just that Kodi has changed the way it deals and I have been doing a lot of under the hood polish on PA itself that had been poorly tested.

    In any case, it should now be dealt with. KODI_AE_SINK is set to ALSA by default and kodi.sh will take care of suspending/unsuspending the default sink when starting and stopping Kodi. I've also had the time to dig deeper into the PA documentation and have some further improvements in store.

    Some of the changes in the latest image:

    • updated alsa-lib and alsa-utils to latest git
    • compiled in bluez5 headset support in PA
    • load some more PA modules by default (allow-passthrough, zeroconf-publish, switch-on-port-available)
    • updates sway/wlroots to latest git
    • updated RA and some cores
    • f2fs is now created with encryption/compression extensions and kernel options has been added for both
  • Thx again for all the time you spend on this.


    Installed. Kodi works incl. passthrough. No audio in ES. RA (n64) works. Audio is there but crackling.

    Audio crackling is commonly due to having a system not powerful enough to handle the emulation. are you getting full FPS on n64 games?