Search code examples
javaandroidflutterkotlinexoplayer2.x

better_player or exoplayer throwing exception OMX.MTK.VIDEO.DECODER.AVC


I am having an issue on the better_player, where some devices aren't streaming a live link because of this exception:

Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(0, null, null, video/avc, avc1.4D4028, -1, null, [320, 180, -1.0], [-1, -1])
E/ExoPlayerImplInternal(14168):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:867)
E/ExoPlayerImplInternal(14168):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:561)
E/ExoPlayerImplInternal(14168):       ... 9 more
E/ExoPlayerImplInternal(14168):   Caused by: android.media.MediaCodec$CodecException: Failed to initialize OMX.MTK.VIDEO.DECODER.AVC, error 0xfffffff4
E/ExoPlayerImplInternal(14168):       at android.media.MediaCodec.native_setup(Native Method)
E/ExoPlayerImplInternal(14168):       at android.media.MediaCodec.<init>(MediaCodec.java:1811)
E/ExoPlayerImplInternal(14168):       at android.media.MediaCodec.createByCodecName(MediaCodec.java:1792)
E/ExoPlayerImplInternal(14168):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.initCodec(MediaCodecRenderer.java:925)
E/ExoPlayerImplInternal(14168):       at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodecWithFallback(MediaCodecRenderer.java:860)
E/ExoPlayerImplInternal(14168):       ... 10 more

this seems to be coming from ExoPlayer, but how to solve this?


Solution

  • Keep in mind that most devices can have a limited number of decoder instances at the same time. So, maybe you reached that limit. Also check that your app has released successfully any old exoplayer instances before creating new ones.

    Moreover, a device may not support the resolution of your media. For this case, you may try to reencode your media files in one of these supported media formats.