Audio passthrough testing

  • can you test with software decoding? One issue found on RPi4 is that HW decoding and audio passthrough don't play well along.

    Interesting about the RPI4's HW decoding and passthrough - puts me off from getting one for a while as ideally I want HW decoding on all streams and passthrough of all formats.

    Anyway, I tried the OPI-PC with hardware decoding off - unfortunately no difference to the audio problem. Played a stream where Codec info shows ff-h264(SW) as the video decoder, and with the audio format showing as RAW, RAW, RAW, RAW, RAW, RAW, RAW, RAW pt-dtshd, 8 bits, 48000KHz, audio still drops in and out. Only difference is higher CPU and slightly jerky video. Tried some other streams (AC3, DTS, TrueHD), same result. Tried the same AC3 and DTS streams from the RPI3, which worked fine.

    Edit: Got it working after a bit of further testing. If Kodi display resolution is set to 1360x768 (my HD TV's native resolution), audio drops in and out whether passthrough is enabled or not. With Kodi resolution set to 1080P, audio passthrough for all formats seems to work fine. I haven't tested this robustly yet, but setting the Kodi resolution to 1080P seems to fix the dropout problem. No idea why and i don't even know why I tried this, but I'm glad I did. Will test further over the next few days.

    Edited once, last by serafis: New information (July 11, 2020 at 8:20 AM).

  • Ok, after further testing on my Orange-Pi PC (H3), this is what I've found.

    • If display resolution is set to 1360x768, HDMI audio continuously drops in and out, whether passthrough is enabled or not. Can't use this setting at all.
    • If display resolution is set to 1080p, passthrough of Dolby Digital, DTS, TrueHD and DTS-MA all work flawlessly (Yay!)


    • If Audio Output Device is set to "ALSA: allwinner-hdmi, ONK TX-SR606 on HDMI" (the intuitive choice for my Onkyo TX-SR606 AVR) then, while passthrough works, multi-channel PCM or FLAC is passed through as STEREO only, regardless of any other settings, e.g. Number of Channels.
    • If Audio Output Device is set to "ALSA: allwinner-hdmi, 1c22800,-i2s-hifi-i2s-hifi-0", and Number of Channels is set to 2.0, then passthrough works but multi-channel PCM or FLAC is passed through as STEREO (not MULTICH)
    • If Audio Output Device is set to "ALSA: allwinner-hdmi, 1c22800,-i2s-hifi-i2s-hifi-0", and Number of Channels is set to anything else (e.g. 5.1 or 7.1) then passthrough works, and multi-channel PCM or FLAC is correctly passed through as MULTICH with that number of channels

    So these are my settings where everything works correctly:

    • Display resolution = 1080P/60Hz (my TV is only HD1360x768; I use Video Calibration to correct overscan)
    • Audio Output Device = "ALSA: allwinner-hdmi, 1c22800,-i2s-hifi-i2s-hifi-0" (which is actually the default device)
    • Number of Channels = e.g. 2.1, 5.1 or 7.1 (depending on AVR and speaker setup - mine's physically 5.0 but I use 5.1 and let the AVR mix the LFE channel to the front speakers)
    • Output Configuration = Best Match
    • Keep Audio Device Alive = 1 minute
    • Send Low Volume Noise = Yes
    • Allow Passthrough = Yes, and all formats also set to Yes
    • All other settings at their defaults

    Great outcome, hope this helps someone else, and thanks jernej for the excellent work.

    Edited once, last by serafis: typos fixed (July 13, 2020 at 10:58 AM).

    • Official Post

    serafis Great job! That's really helpful. So it turns out there is (are) issue(s) with HDMI and/or clock configuration for particular resolution. It makes sense that could be a problem. Audio packets are sent in blanking intervals between two consecutive frames. If this timing is off then there could be also audio issues. Can you please provide output of edid-decode /sys/class/drm/card0-HDMI-A-1/edid? This should tell what timings are communicated by your TV and AVR. I just tested 1360x768p @ 60 Hz on my TV and everything seems to work fine. I suspect that my TV is pretty forgiving for non-optimal configurations.

    Regarding multi-channel configuration - I noticed that same format (iec958) is used also for non-passthrough (linear PCM) audio. This shouldn't be the case, so ALSA config needs some changes.

  • Thanks for your -- as always -- great work! I installed it on Orange Pi PC and it works with AC-3 movies without problems. My configuration: Samsung 1080p TV and Onkyo TX-507 AVR. One issue: It only works with movies. I have AC-3 audio only files (recorded from digital radio) and they are converted to PCM. I am not sure whether this is a general Kodi issue and I should file a request at mainline or depending on the implementations, as it seemed during search that the passthrough settings are implementation dependent. If you are the one who sets it, it would be fantastic if you could do that, I assume it is just a few lines to enable only audio files for passthrough that are passed through as audio tracks of video files. AVR wise it is no problem to receive audio only passthrough via HDMI, currently I play those with standalone omxplayer on a RPi 1 (IMHO too slow for Kodi), which I then could "retire".

    • Official Post

    I only added kernel and alsa-lib changes in order to enable it so probably Kodi doesn't have PT implemented for audio only files. I don't really know Kodi audio subsystem in order to check or implement that. I suggest you ask at Kodi forum.

    Note, after some more testing, it seems to work reliably only when screen resolution is set at 1080p @ 60 Hz for me.

  • Hi what i have to do to install this test file? with the image file of the libreelec, i format an SD with the image file and all work ok, now with this tar, what is the procedure to create the SD?

  • Install normal image first (nightly image) and then put tar file to /storage/.update. You can do than in many ways - over samba, sftp or using Linux PC to name some ways. Then just reboot and LE will be updated. Note that these updates are already a bit old (pre-alpha 1). I need to update them at some point...

  • jernej, thanks again for your hard work on this - passthrough is working great on my OrangePi PC (H3) with resolution fixed at 1080p 60Hz, no problems at all, and even my DTS music files play correctly. I'm guessing that you're probably very busy, but any idea when the version with passthrough might get updated to a later Kodi build, or the passthrough capability be included into the nightly builds? Thanks.

  • Yes, graphics is the same as on S905X3, but as I said, mesa is just now getting proper support for it. However, there are binary driver available but I always prefer mesa over them. In the past already happen that binary drivers weren't totally compatible with another SoC and SoC designer refused to release appropriate variant due to various reasons.

    My recommendation would be H6, at least from Allwinner. There is still a lot of potential to unlock while already mostly on feature parity with older ones. To be honest, I don't think you need more than 3 GiB of RAM. I'm still working with 2 GiB and even 1 GiB boards and I don't see any downside. Regarding hot cpu - most cheap H6 boxes are crap because they lack precise CPU voltage management. This tends to cause higher temperatures due to higher voltage used. Additionally, in the future, H6 will get its own LE kernel settings (currently shared with other 64-bit Allwinner SoCs), which will also allow lower temperatures (at least in theory).

    Hello jernej, I am new member here and this is my first message, I don´t know many about LE...

    I have H6 Allwinner with a Q Plus tv box 4GB RAM and 32 GB ROM

    Please, I would like if it´s possible to put any LE .dtb image or some generic

    Thank you

  • jernej I can only test H3 image as I only have an OrangePi-PC (H3) to test it on. No luck so far - here's what I've tried:

    1. Downloaded the latest nightly build (LibreELEC-H3.arm-9.80-nightly-20200909-16e68ab-orangepi-pc) and flashed it to a formatted 16GB SD card using Etcher.

    2. Booted up the Opi-PC successfully into Kodi Matrix 19.0. Went through the basic Libreelec configuration process, including enabling SSH.

    3. Copied the PT test image (LibreELEC-H3.arm-9.80-devel-20200908220203-9f5d029.tar) to the Update directory and rebooted. Update was found and applied OK.

    But then got the following issues:

    a. Notification window "Libreelec configuration error - check log for more information" (zipped kodi.log attached to this post).

    5. Settings / System / Audio doesn't have the Passthrough option (in Expert mode)

    6. Settings / Libreelec gives a message "Settings addon is not yet ready, please try again later.

    So I gave up at that point and went back to the earlier build.. Hope this is helpful.