PulseAudio network sending (rock64)

  • I have a 4k HDR TV with ARC but not eARC, a Pioneer SC-1224 AVR capable of 4k60p but not HDR and 7.2 multichannel audio and 2 Rock64's.
    One Rock64 (hostname: soundserver; IP address: 192.168.2.34) is running Debian Bookworm with kernel 5.15 (from experimental) and PulseAudio in system mode. I've downgraded PA from 15.0 to 14.2 to match what's running on LE. It has 2 sound cards, HDMI and SPDIF although I've never gotten the latter to output any sound. I'm using the simple-card alsa card definition from LibreELEC.

    The other Rock64 (hostname: kodi-rock64; IP address: 192.168.2.32) is running "LibreELEC (community): nightly-20211111-b431638 (RK3328.arm)", but I've also tried it with LE 10.0.1.

    What I've used so far is that both are connected via a HDMI cable to the AVR and the AVR is connected via HDMI cable to my TV.
    That works really well, except I can't properly view HDR content. If I connect kodi-rock64 directly to my TV, I do have (4k x265) HDR, but then I won't have multichannel audio.

    To get both HDR and multichannel audio, I want to connect kodi-rock64 directly to my TV, but send the audio over the network to soundserver which then sends it to my AVR.


    I tried following the instructions from https://wiki.libreelec.tv/configuration/…network-sending but I never got the tunnel-sink, only the null-sink.
    My PC can connect and use PA on soundserver to play sound, so I'm quite sure I've set it up correctly. I have now set "default-server = tcp:192.168.2.34:4713" in "~/.config/pulse/client.conf", and now I do see both the HDMI and SPDIF sinks :)

    But in Settings/System/Audio, Audio output device I only see the SPDIF card, which doesn't work [for me|afaik]. If I blacklist "snd_soc_rockchip_spdif", then the SPDIF card is gone, but that still doesn't get me the HDMI sink to select in Settings/System/Audio.

    What do I need to do to get the HDMI soundcard to appear in System Settings, which then (hopefully) allows me to watch 4k HDR content with multichannel audio?

    Various data:

  • It won't show up in the system settings. Kodi uses a patch to only show one pulseaudio device. So you'll have to use that default pulseaudio device and make sure that pulse has your network tunnel as the default device

    You can check the default device with pactl info

  • Thanks for your response. I didn't know it would show only one (besides PULSE bluetooth I assume).

    Quote

    So you'll have to use that default pulseaudio device

    AFAICT the default device is the HDMI card (see 'various data' in OP) and that is exactly what I want. If I blacklist 'snd_soc_rockchip_spdif', it is the only device, which is also fine by me. What I don't understand is why it isn't picking up that device.

    Or am I misunderstanding you?

    Quote

    make sure that pulse has your network tunnel as the default device

    I'm now using the 'Direct connection' as described in https://www.freedesktop.org/wiki/Software/…n/User/Network/. Is that my (main) problem and I should get the 'Using a tunnel' method working? My attempts thus far have failed (but it is working on my PC), but if this is the way it is supposed to work, I'll give it another go.

  • So I gave it another go. I disabled "client.conf" and rebooted my device.

    I created the following "/storage/.config/autostart.sh" which contained the same command as I had done manually:

    After loading "module-native-protocol-tcp" (with above params) and loading "module-zeroconf-discover" I believe I should have seen the "module-tunnel-sink" loaded automatically, but that was not the case. Consequently (?) I did not see the sink from 'soundserver', so I loaded that module manually (and now via this script) and then I did see the sink from 'soundserver':

    Code
    kodi-rock64:~ # pactl list short sinks
    
    1       tunnel.soundserver.local.alsa_output.platform-hdmi-sound.hdmi-surround71        module-tunnel.c s16le 8ch 44100Hz       SUSPENDED

    Then setting that sink as default didn't give an error, so I assumed it worked.

    But checking in Settings > System > Audio > Audio output device and the only PULSE device was for Bluetooth, but not the default sink.

    IIUC, it's better to convert the "autostart.sh" to a systemd unit file and I'll work on that, but I don't see how that could result in a different outcome.

    For completeness I've also enabled debug logging and rebooted and that resulted in this log file: http://ix.io/3Fox


    PulseAudio info:

    If I did something wrong or you have new ideas to try out, I'd love to hear it :)

  • If I did something wrong or you have new ideas to try out, I'd love to hear it

    During my experiments, I came across something I found odd (then...)

    Code
    kodi-rock64:~ # avahi-browse -a
    Failed to create client object: Daemon not running

    So I did something 'crazy' and started "avahi-daemon" ... and then I got several PULSE devices in the 'Audio output device' list :D

    They were a bit 'oddly' named, but I could select them, including my 7.1 device.

    Then I played a 4k HDR file and (after disabling pass-through) I had audio over my 4 speakers. Spoken word only came out of 1 of them, but after changing "Number of channels" to 4.0, that worked too.

    And then I remembered something from the startup wizard where I had disabled the Avahi service. So I enabled it and rebooted my devices and now I have a (several actually) 'normally' named PULSE devices, including "PULSE: Built-in Audio Digital Surround 7.1 (HDMI) on pulse@soundserver"

    \o/ \o/ \o/

  • I've had some mixed results so far. Several times it didn't see the soundcard I wanted it to see, so I've now blacklisted the module 'snd_soc_rockchip_spdif' on soundserver as I don't (plan to) use it anyway. Also when manually unloading and (re-)loading the pulseaudio modules, it sometimes worked and sometimes it didn't. I could not find any pattern in it.
    OTOH, when my PC is on, it always sees the soundcards from that machine and I can select them in Settings > System > Audio.

    I've just created one of my very first systemd unit file and rebooted my kodi device and it seems to work (now) :)

    But if someone who's more knowledgeable in this area could take a look and suggest improvements, I'd appreciate that.

    After creating that file, I put it in ~/.config/system.d/pulse-network-audio.service and then did "systemctl daemon-reload" and "systemctl enable pulse-network-audio.service" (and disabled my ~/.config/autostart.sh which did the things that are now in ExecStart)