jernejsk/OpenELEC-OPi2

I can test your passthrough builds

Opened this issue · 34 comments

I saw your post about passthrough on orange pi forum, but the pages are way too slow for me and I don't want to create an account there. Nevertheless I have a Yamaha RX-473 so if you give me a testbuild for my Nanopi M1 I can make all the tests you want.

Unfortunately I cannot build openelec right now, my only Linux computers are Raspberry Pi, Banana Pi and Nano Pi (laptop died some weeks ago).

Thanks, I will prepare test build soon.

The strangest happened. My Nanopi is currently using this version of your Openelec : OpenELEC-H3.arm-7.0-devel-20160428195335-r22761-g48e046c-opione.img

And Passthrough is mostly working ... Tested for now with DTS 5.1 / AC3 5.1 / AC3 2.0 See below

  • DTS 5.1
  • AC3 5.1
  • AC3 2.0
  • EAC3 / DD+ 5.1
  • DTS MA 7.1 - Fail
  • TrueHD 7.1 - Fail

I'm going to test more formats soon. Done !

If I disable passthrough in Kodi's settings then DTS 5.1 and AC3 5.1 are detected by my Yamaha as PCM without any channel number and no sound is played.

Interesting. Please test following image:
https://mega.nz/#F!NAADQZBJ!v6TM1XMnHqJdh8Oh6b_48g

With your image passthrough is not working at all (for all the formats above)

Each time there a flicker on my Yamaha display : it show DTS (or Dolby, ...) on and off but no sound at all

I've not found anything interesting in dmesg or in kodi.log. What can I do to help ?

Just another information even with my Raspberry Pi I cannot use passthrough with DTS MA and True HD. Dom said there's a hardware limitation (I can find again the post if needed).

Thanks for testing. I will have another image soon.

Could you please find that post for Raspberry Pi?

The end of this post

This thread is even better

Well, driver states that it supports following formats:
PCM = 1,
AC3 = 2,
MPEG1 = 3,
MP3 = 4,
MPEG2 = 5,
AAC = 6,
DTS = 7,
ATRAC = 8,
ONE_BIT_AUDIO = 9,
DOLBY_DIGITAL_PLUS = 10,
DTS_HD = 11,
MAT = 12,
DST = 13,
WMAPRO = 14.

TrueHD is not listed and I guess that DTS HD is not same as DTS MA?

If I believe Wikipedia, no they're not the same. If you want I'll find a sample of DTS HD and add it to my test list for your next beta release.

The most important thing is that multichannel PCM work. I didn't check that with your April's version.

It seems that those numbers are CEA 861 Types. MAT is actually TrueHD. It seems that hdmi sound driver makes conversion between IEC61937 to IEC60958, whatever that really is, if raw format is enabled.

Sorry, I would have to put this on hold, as it seems (confirmed by you) that most passthrough formats works. It is very hard to develop anything if you don't own the HW.

No need to be sorry, I know how frustating it can be :(

Like I said April's version works ok for me. I just have to check that multichannel PCM work ok.

I discovered something new about passthrough. Your receiver supports DTS-HD right?

Please use latest image and execute following command:

amixer -c sndhdmi sset "hdmi audio format Function" DTS_HD

then setup Kodi for DTS HD passthrough as usual and test some video. Please report :)

Note, you can also test TrueHD, but then you must reboot OPi and execute above command with MAT instead of DTS_HD, but maybe DTS_HD setting will work for TrueHD too.

I'll update my SD with latest version and make a test this weekend. I'll keep you posted.

Just to be sure, first set all passthrough formats your receiver supports and reboot. Then execute above command and try few videos. If you want to test another format, e.g. MAT (TrueHD), please reboot first and then execute above command.

both with latest version (2160602) and your tar, I have no sound output and my Yamaha says that PCM is detected without any number of channel (usually meaning it doesn't understand what it's being fed with).

I took extra care to reboot between each test

It seems that andrejb had the same result on orangepi forums :(.

I took the time to make the test of a multichannel wave (like http://www-mmsp.ece.mcgill.ca/documents/audioformats/wave/Samples/Microsoft/8_Channel_ID.wav) and I can confirm it does not work,

If I select 2.0 in the audio settings then a 2 channel PCM is sent and it works.
If I select 5.1 in the audio settings then no sound and the Yamaha does not detect the number of channel (meaning it does not detect correctly what's being send).

ok, thanks for now, I will let you know if I will have something

new image for test: https://transfer.sh/ata2E/openelec-h3.arm-7.0-devel-20160622001058-r22866-gc728002.tar

If it doesn't work, please copy & paste output of "dmesg | grep hdmi"

And yet another image: https://transfer.sh/tL1ne/openelec-h3.arm-7.0-devel-20160622224026-r22866-gc728002.tar

Please test both with as much formats as possible. If none of this will work, I have another idea. That amixer command is not required anymore with both images (actually, it doesn't work anymore).

I've tested both and there's no sound for everything that should use passthrough (with both images).

Here the debug output you asked in case that's important I tried a DTS stream first and an AC3 next

OpenELECh3:/flash # dmesg | grep hdmi
[    2.331629] asoc: sndhdmi <-> sunxi-hdmiaudio.0 mapping ok
[    2.443392] [HDMI] power vcc-hdmi-18
[    2.528942]   #1: sndhdmi
[   15.495949] [hdmi audio][sunxi_sndhdmi_hw_params]
[   15.496261] [hdmi audio][sndhdmi_hw_params]
[   15.496269] [hdmi audio][tdm2_hw_params]
[   15.496276] [hdmi audio][sunxi_pcm_hw_params]
[   15.496390] [hdmi audio][sndhdmi_prepare]
[   15.510024] [hdmi audio][sndhdmi] Prepare format: 1
[   15.510246] [hdmi audio][i2s2] channels: 2
[   15.510592] [hdmi audio][sndhdmi_prepare]
[   15.530024] [hdmi audio][sndhdmi] Prepare format: 1
[   15.530242] [hdmi audio][i2s2] channels: 2
[   75.786778] [hdmi audio][sndhdmi_prepare]
[   75.800097] [hdmi audio][sndhdmi] Prepare format: 1
[   75.800325] [hdmi audio][i2s2] channels: 2
[  295.525450] [hdmi audio][sunxi_sndhdmi_hw_params]
[  295.525822] [hdmi audio][sndhdmi_hw_params]
[  295.525838] [hdmi audio][tdm2_hw_params]
[  295.525848] [hdmi audio][sunxi_pcm_hw_params]
[  295.526016] > sunxi_hdmiaudio_ctl_iec958_get()
[  295.526083] > sunxi_hdmiaudio_ctl_iec958_put()
[  295.526098] > sunxi_hdmiaudio_ctl_iec958_put()[0]: 0x6
[  295.526108] > sunxi_hdmiaudio_ctl_iec958_put()[1]: 0x82
[  295.526126] > sunxi_hdmiaudio_ctl_iec958_put()[2]: 0x0
[  295.526149] > sunxi_hdmiaudio_ctl_iec958_put()[3]: 0x2
[  295.526171] [hdmi audio][sunxi-sndhdmi] Format: 2, CRC: 21
[  295.526218] [hdmi audio][sndhdmi_prepare]
[  295.540241] [hdmi audio][sndhdmi] Prepare format: 2
[  295.540490] [hdmi audio][i2s2] channels: 2
[  295.540857] [hdmi audio][sndhdmi_prepare]
[  295.560115] [hdmi audio][sndhdmi] Prepare format: 2
[  295.560357] [hdmi audio][i2s2] channels: 2
[  318.960492] [hdmi audio][sndhdmi_prepare]
[  318.980120] [hdmi audio][sndhdmi] Prepare format: 2
[  318.980357] [hdmi audio][i2s2] channels: 2
[  318.980711] > sunxi_hdmiaudio_ctl_iec958_put()
[  318.980725] > sunxi_hdmiaudio_ctl_iec958_put()[0]: 0x0
[  318.980735] > sunxi_hdmiaudio_ctl_iec958_put()[1]: 0x0
[  318.980745] > sunxi_hdmiaudio_ctl_iec958_put()[2]: 0x0
[  318.980754] > sunxi_hdmiaudio_ctl_iec958_put()[3]: 0x0
[  318.980764] [hdmi audio][sunxi-sndhdmi] Format: 1, CRC: 65
[  318.992124] [hdmi audio][sunxi_sndhdmi_hw_params]
[  318.992435] [hdmi audio][sndhdmi_hw_params]
[  318.992445] [hdmi audio][tdm2_hw_params]
[  318.992455] [hdmi audio][sunxi_pcm_hw_params]
[  318.992518] [hdmi audio][sndhdmi_prepare]
[  319.010141] [hdmi audio][sndhdmi] Prepare format: 1
[  319.010376] [hdmi audio][i2s2] channels: 2
[  319.010580] [hdmi audio][sndhdmi_prepare]
[  319.030149] [hdmi audio][sndhdmi] Prepare format: 1
[  319.030383] [hdmi audio][i2s2] channels: 2
[  325.736294] [hdmi audio][sndhdmi_prepare]
[  325.750126] [hdmi audio][sndhdmi] Prepare format: 1
[  325.750357] [hdmi audio][i2s2] channels: 2
[  325.759811] [hdmi audio][sunxi_sndhdmi_hw_params]
[  325.760256] [hdmi audio][sndhdmi_hw_params]
[  325.760268] [hdmi audio][tdm2_hw_params]
[  325.760277] [hdmi audio][sunxi_pcm_hw_params]
[  325.760341] > sunxi_hdmiaudio_ctl_iec958_get()
[  325.760362] > sunxi_hdmiaudio_ctl_iec958_put()
[  325.760371] > sunxi_hdmiaudio_ctl_iec958_put()[0]: 0x6
[  325.760378] > sunxi_hdmiaudio_ctl_iec958_put()[1]: 0x82
[  325.760386] > sunxi_hdmiaudio_ctl_iec958_put()[2]: 0x0
[  325.760394] > sunxi_hdmiaudio_ctl_iec958_put()[3]: 0x2
[  325.760403] [hdmi audio][sunxi-sndhdmi] Format: 2, CRC: 21
[  325.760427] [hdmi audio][sndhdmi_prepare]
[  325.780061] [hdmi audio][sndhdmi] Prepare format: 2
[  325.780294] [hdmi audio][i2s2] channels: 2
[  325.780563] [hdmi audio][sndhdmi_prepare]
[  325.800110] [hdmi audio][sndhdmi] Prepare format: 2
[  325.800341] [hdmi audio][i2s2] channels: 2
[  334.200585] [hdmi audio][sndhdmi_prepare]
[  334.220141] [hdmi audio][sndhdmi] Prepare format: 2
[  334.220379] [hdmi audio][i2s2] channels: 2
[  334.220653] > sunxi_hdmiaudio_ctl_iec958_put()
[  334.220666] > sunxi_hdmiaudio_ctl_iec958_put()[0]: 0x0
[  334.220676] > sunxi_hdmiaudio_ctl_iec958_put()[1]: 0x0
[  334.220685] > sunxi_hdmiaudio_ctl_iec958_put()[2]: 0x0
[  334.220698] > sunxi_hdmiaudio_ctl_iec958_put()[3]: 0x0
[  334.220709] [hdmi audio][sunxi-sndhdmi] Format: 1, CRC: 65
[  334.234310] [hdmi audio][sunxi_sndhdmi_hw_params]
[  334.234622] [hdmi audio][sndhdmi_hw_params]
[  334.234637] [hdmi audio][tdm2_hw_params]
[  334.234647] [hdmi audio][sunxi_pcm_hw_params]
[  334.234699] [hdmi audio][sndhdmi_prepare]
[  334.250096] [hdmi audio][sndhdmi] Prepare format: 1
[  334.250338] [hdmi audio][i2s2] channels: 2
[  334.250525] [hdmi audio][sndhdmi_prepare]
[  334.270175] [hdmi audio][sndhdmi] Prepare format: 1
[  334.270408] [hdmi audio][i2s2] channels: 2

Another comment on your test image, my IR remote don't work anymore (was working with 20160602 version). I'll try to debug a little.

Thanks. It seems that passthrough support needs big rework. It will take some time, but at least I understand what is wrong and what needs to be done in theory.

Happy I could help ;)

Tell me when you have something to test and I'll be ready !

Do we have any news on this? If you give me a general direction where to look, I can fork and see if I get anywhere with this.

Only news here is that it crashes a bit less often and that only Kodi crashes, not kernel, which means that you have to wait just a few seconds for Kodi to automatically restarts.

I would really appreciate if you could find the bug. Issue is that sometimes, when you switch the channel, some image buffer is not freed or at least marked as such. If you want to debug, it would be best to add tracing code on cedar buffers allocation & deallocations to see where the problem lies. Work is tedious, but it should indicate the problem. Do you want to do that? I will certainly help you with it.

I am a bit confused, when does Kodi crash? And what do you mean by switching channels? From 2.0 to 5.1 or something? If it's a memory issue it's ugly but not unsolvable I guess..

I already forked and see if I can compile etc.

My motivation: I'd like to have my RX-V500D be able to get more than 2.0 :)

Ah sorry. I mixed this issue with "channel changing" issue, which is caused by DVB TV plugin.

Issue here is that passthrough setting is done in non standard way. You can try to play first with amixer and if you succed, you could modify Kodi code to do the same through API.

I played around a little bit and it is working now, not sure though what caused the fix in the end. Thanks!

@aktentasche,
so which formats work for you?

I think I put amixer to DTS HD. Is that what you mean?