ExoPlayer: MediaCodec initialisation fails.
Issue description
On certain devices that use OMX.MTK.VIDEO.DECODER.AVC decoder, on DRM content ONLY we receive the below error.
Reproduction steps
- Initialise SimpleExoPlayer
- Prepare MediaSource with drm.
- Note, that in prepare step, we are NOT attaching SimpleExoplayerView to view hierarchy, and only doing so, after player state READY received.
- Get the crash, immediately after prepare() called.
Link to test content
“uri”: “https://storage.googleapis.com/wvmedia/cenc/h264/tears/tears.mpd” “drm_license_url”: “https://proxy.uat.widevine.com/proxy?provider=widevine_test”
Version of ExoPlayer being used
We can see this issue reproduced on Exoplayer 2.5.0 and above (including 2.6.1) Previous Exoplayer versions work as expected.
Device(s) and version(s) of Android being used
Device - Meizu M5C, Lenovo K4 and Moto C+ (all of them with OMX.MTK.VIDEO.DECODER.AVC) Android version - 6.0
### A full bug report captured from the device
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.throwDecoderInitError(MediaCodecRenderer.java:418)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:405)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:839)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:536)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:560)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:306)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.MTK.VIDEO.DECODER.AVC, Format(1, null, video/avc, 720
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:405)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:839)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:536)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:560)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:306)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: android.media.MediaCodec$CodecException: start failed
at android.media.MediaCodec.native_start(Native Method)
at android.media.MediaCodec.start(MediaCodec.java:1898)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.maybeInitCodec(MediaCodecRenderer.java:397)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.onInputFormatChanged(MediaCodecRenderer.java:839)
at com.google.android.exoplayer2.video.MediaCodecVideoRenderer.onInputFormatChanged(MediaCodecVideoRenderer.java:455)
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:536)
at com.google.android.exoplayer2.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:560)
at com.google.android.exoplayer2.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:306)
at android.os.Handler.dispatchMessage(Handler.java:107)
at android.os.Looper.loop(Looper.java:207)
at android.os.HandlerThread.run(HandlerThread.java:61)
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 58 (21 by maintainers)
Commits related to this issue
- Add Moto C+ to surface switching workaround. Issue:#3835 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185501181 — committed to google/ExoPlayer by tonihei 6 years ago
- Add Meizu M5C, Lenovo K4 Note, and Sony Xperia E5 to surface workaround. Also added comments for all existing devices for easier reference. Issue:#3835 Issue:#3236 ------------- Created by MOE: htt... — committed to google/ExoPlayer by tonihei 6 years ago
- Add Moto C+ to surface switching workaround. Issue:#3835 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=185501181 — committed to google/ExoPlayer by tonihei 6 years ago
- Add Meizu M5C, Lenovo K4 Note, and Sony Xperia E5 to surface workaround. Also added comments for all existing devices for easier reference. Issue:#3835 Issue:#3236 ------------- Created by MOE: htt... — committed to google/ExoPlayer by tonihei 6 years ago
Yes, there is also panell_d, panell_dl and panell_dp. Guess I better change it to include all devices starting with “panell” then.
We also discussed the same question - whether we should enable the workaround for certain API levels and decoders for all devices or something similar. Because we also don’t know for sure how many devices out there have this problem. Using the chipset may be a good idea, need to think about this a little bit further.
For our release plans, there is probably a new release in the next couple of days.
Yes, that’s officially available here: https://support.google.com/googleplay/answer/1727131?hl=en-GB That’s where my suggestion above came from.
Yes, that seems fine. I think I got quite confused that your example code set
workaroundRequired = falsewhen READY was reached which clearly wouldn’t work.And yes I agree, that to some extent the failures were due to the video size. Please note that there will be other DecoderInitialization failures for various reasons and you’ll still need to check that the test fails for all devices of the same model.
I requested an
android.os.Build.CHIPSETconstant, but I’m not sure whether the platform team will be keen on adding one [Internal ref: b/73874594].We’ll have a think about how we can do this better (not hugely keen on a private API, but it can be considered).