androidx / androidx/media

FFmpeg decoder fallback on failed Initialization

Open
#803 5 comments 0 reactions 1 assignee View on GitHub

@rohitjoins is already working on this.

Since Nov 13, 2023.

enhancement
Dominant language
Java
Stars
3k
Forks
955
Avg merge
12d 14h
Merged PRs (30d)
2

Description

Version

Media3 pre-release (alpha, beta or RC not in this list)

More version details

Any but tested with 1.2.0 RC

Devices that reproduce the issue

All

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Not tested

Reproduction steps

Opening this as a bug report but it's maybe a feature requests.

FFmpeg when compiled with mp4 support by default does not support "xHE-AAC" unfortunately this can't really be detected beforehand currently so the FfmpegAudioRenderer will say it support the AAC file then it will fail at render time with:

playerFailed [eventTime=22.09, mediaPos=0.00, window=0, period=0, errorCode=ERROR_CODE_DECODER_INIT_FAILED
androidx.media3.exoplayer.ExoPlaybackException: FfmpegAudioRenderer error, index=0, format=Format(1, null, null, audio/mp4a-latm, mp4a.40.42, 137730, und, [-1, -1, -1.0, null], [1, 48000]), format_supported=YES
   at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:608)
   at android.os.Handler.dispatchMessage(Handler.java:102)
   at android.os.Looper.loopOnce(Looper.java:205)
   at android.os.Looper.loop(Looper.java:294)
   at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: androidx.media3.decoder.ffmpeg.FfmpegDecoderException: Initialization failed.
   at androidx.media3.decoder.ffmpeg.FfmpegAudioDecoder.<init>(FfmpegAudioDecoder.java:74)
   at androidx.media3.decoder.ffmpeg.FfmpegAudioRenderer.createDecoder(FfmpegAudioRenderer.java:132)
   at androidx.media3.decoder.ffmpeg.FfmpegAudioRenderer.createDecoder(FfmpegAudioRenderer.java:40)
   at androidx.media3.exoplayer.audio.DecoderAudioRenderer.maybeInitDecoder(DecoderAudioRenderer.java:729)
   at androidx.media3.exoplayer.audio.DecoderAudioRenderer.onInputFormatChanged(DecoderAudioRenderer.java:782)
   at androidx.media3.exoplayer.audio.DecoderAudioRenderer.render(DecoderAudioRenderer.java:298)
   at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1079)
   at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:529)
   at android.os.Handler.dispatchMessage(Handler.java:102) 
   at android.os.Looper.loopOnce(Looper.java:205) 
   at android.os.Looper.loop(Looper.java:294) 
   at android.os.HandlerThread.run(HandlerThread.java:67) 

And it will not try the second decoder from the factory that would support that format.

If no attempt to try the second decoder is normal in this case as too late, what would be the way to workaround this?
Seems we can't really attempt to create a decoder from the supportedFormat as we do not have the crypto param.

Expected result

Away for the client to handle this and try the second decoder.

Actual result

Playback fails.

Media

If needed any mp4 from https://www2.iis.fraunhofer.de/AAC/xhe-aac.html

Bug Report
  • You will email the zip file produced by adb bugreport to android-media-github@google.com after filing this issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.