Route multichannel FLAC to the FFmpeg decoder instead of the AOSP decoder#1720
Route multichannel FLAC to the FFmpeg decoder instead of the AOSP decoder#1720sudolulo wants to merge 2 commits into
Conversation
The AOSP software FLAC decoder (c2.android.flac / OMX.google.flac) advertises multichannel support but fails at runtime with "no streaminfo metadata block", so 5.1 FLAC can't Direct Play and stalls or falls back to transcoding. Report multichannel (>2 channel) FLAC as unsupported in a MediaCodecAudioRenderer subclass so the track selector routes it to the bundled FFmpeg extension decoder, but only when the AOSP software FLAC decoder is the one that would be used, so devices with a vendor FLAC decoder, stereo FLAC, and every other format keep using the platform decoder, unchanged.
|
Could use further testing to be sure its an AOSP decoder issue and not nvidia shield specific but I don't have the hardware. In that case this could be narrowed in scope. |
|
This sounds like a device limitation. My TV plays 7.1 FLAC just fine. |
do you use an nvidia shield or other android player Does works fine mean it doesnt transcode? |
|
This definitely needs more investigation and shouldn't be applied globally for all devices. For the nvidia shield, looks like a couple people online suggest disabling Dolby Processing in the OS advanced sound settings. |
I just tried a couple of the timestamps I've been using and disabling Dolby processing in advanced settings did not change anything. The same timestamps plays fine on my debug build with this fix. I am narrowing the scope of this PR back to being just the nvidia shield 2019 non pro. |
|
The problem with multichannel FLAC is not exoplayer. It’s usually the TV’s HDMI LPCM channel limit. Exoplayer decodes FLAC 7.1 to LPCM 7.1 and if your TV does not support multichannel LPCM over HDMI, it’ll either need to be re-encoded to stereo PCM or re-encoded to AC3 to passthrough as multichannel. Few TVs support multichannel LPCM over HDMI. |
Would the fact that this is a decoder error mean it is upstream of the HDMI? Forgive me if I am incorrect. I am not swapping anything with exoplayer, I am swapping the renderer used from MediaCodecAudioRenderer to FfmpegAudioRenderer. Both then feed multichannel LPCM over HDMI is my understanding. Personally I am feeding a Denon AVR-X1800H receiver that can handle LPCM 7.1 over HDMI, and am consuming multichannel audio with this fix. |
Gate the reroute on KnownDefects.multichannelFlacBug, keyed on Build.DEVICE "sif" (the 2019 non-Pro SHIELD), instead of applying it to every device whose FLAC decoder is the AOSP software codec. Other devices decode multichannel FLAC natively and keep the platform decoder, unchanged.
The AOSP software FLAC decoder (c2.android.flac / OMX.google.flac) advertises multichannel support on the 2019 nvidia shield "sif" but 5.1 FLAC can't Direct Play and stalls or falls back to transcoding.
Description
This reports multichannel FLAC as unsupported in a MediaCodecAudioRenderer subclass so the track selector routes it to the bundled FFmpeg extension decoder, but only when the device is a 2019 nvidia shield non pro (sif).
Related issues
Fixes #1719
play a file with FLAC 5.1 audio on an nvidia shield and wait
Testing
Tested on my NVIDIA SHIELD Android TV 2019. I have been running this fix and it allows previously broken files to play across multiple series compared to the unmodified client. It does not alter the clients ability to play any other audio types or cause them to fall back to transcoding.
Files with multichannel FLAC audio fall back to the ffmpeg decoder while FLAC 2.0 files continue to use the default decoder. Nothing else changes.
Screenshots
no ui changes
AI or LLM usage
Diagnosis and the initial patch were assisted with AI.