Android Audio bitstream passthrough not working
#1
Hi, Philips Television audio dev here.

The Kodi app on a Philips Android TV does not indicate the correct encoding format towards the platform when passthrough is enabled.
This results in loud noise on all audio outputs, as the digital bitstream is rendered as LPCM.

What we observe is that when we set enable passthru in Kodi app, the app sets the encoding format to ENCODING_PCM_16BIT
instead of ENCODING_E_AC3. (or ENCODING_AC3)
While comparing the behavior of netflix, in the same scenario, while setting multichannel , the format set is ENCODING_E_AC3. I think this change has to be handled within the app from the above observations.

Anyone else with issues on bitstream passthrough issues on Android?

Android 5.1.0 API lvl 22
Kodi 15.1 Git:Aug 22 2015
Reply
#2
Yes you are right with your observations. I am not an android dev and am not sure where those audioformats are really supported. But if you are able to compile Kodi on your own i can tell you where the changes would need to be done.

First of you need to map those ENCODING_AC3 defines from java to C via our JNI wrapper:

https://github.com/xbmc/xbmc/blob/master...at.cpp#L52

Then you would alter the CreateAudioTrack method and add a parameter for int audioFormat to it:

https://github.com/xbmc/xbmc/blob/master...K.cpp#L164

And pass that value through to the CJNIAudioTrack C'tor (instead of hardcoding CJNIAudioFormat::ENCODING_PCM_16BIT there)

Then where CreateAudioTrack is called here:

https://github.com/xbmc/xbmc/blob/master...K.cpp#L243

You need to check if m_passthrough is true - and if it is - pass CJNIAudioFormat::ENCODING_AC3, else CJNIAudioFormat::ENCODING_PCM_16BIT there ...
AppleTV4/iPhone/iPod/iPad: HowTo find debug logs and everything else which the devs like so much: click here
HowTo setup NFS for Kodi: NFS (wiki)
HowTo configure avahi (zeroconf): Avahi_Zeroconf (wiki)
READ THE IOS FAQ!: iOS FAQ (wiki)
Reply
#3
Our only Android developer @Koying started working on it however ran into some issues (and currently lack of time).
I'm not sure if he already has a WIP branch somewhere but i'm sure he could use some assistance in getting this up and running.

Also FYI in Android M there's support for DTS and DTS-HD in the same way.
So in short our current method of doing passthrough on Android needs some remodelling to work correctly using features from API 21 and higher.
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#4
Problem I have is that I cannot find in the doc what ENCODING_AC3 is expecting, exactly. Just sending 1-to-1 bitstream doesn't quite work (on shield tv). I get some bits of audible audio but seems the timing is wrong, somehow.

Very much trial and error...

OTOH, vlc implementation doesn't quite work on shield TV, either, so might not be the proper reference device.
Reply
#5
Thanks a lot for the info. I'll give it a try when I find the time Smile
When this gets patched in main line Kodi, we expect passthrough to work on all 2014-15 android TV models.
Reply
#6
I'll create a wip PR asap so that interested parties can experiment.
Reply
#7
Okay that would help a lot. I'll provide feedback in this topic.
Reply

Logout Mark Read Team Forum Stats Members Help
Audio bitstream passthrough not working0