Renderer error with HLS
Issue description
When playing a specific HLS stream, ExoPlayer consistently throws a renderer error. A full bugreport is included below, but since it might be useful, logcat shows the following errors:
06-05 16:55:41.731 1577-13735/com.google.android.exoplayer2.demo E/ACodec: configureCodec multi window instance fail appPid : 1577
06-05 16:55:41.736 1577-13735/com.google.android.exoplayer2.demo E/ACodec: [OMX.Exynos.avc.dec] configureCodec returning error -1021
06-05 16:55:41.736 1577-13735/com.google.android.exoplayer2.demo E/ACodec: signalError(omxError 0x80001001, internalError -1021)
06-05 16:55:41.736 1577-13734/com.google.android.exoplayer2.demo E/MediaCodec: Codec reported err 0xfffffc03, actionCode 0, while in state 3
06-05 16:55:41.736 1577-13698/com.google.android.exoplayer2.demo E/MediaCodec: configure failed with err 0xfffffc03, resetting...
06-05 16:55:41.746 1577-13698/com.google.android.exoplayer2.demo E/ExoPlayerImplInternal: Renderer error.
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.throwDecoderInitError(MediaCodecRenderer.java:380)
android.os.HandlerThread.run(HandlerThread.java:61)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.Exynos.avc.dec, Format(1/27, null, video/avc, -1, null, [2560, 1440, -1.0], [-1, -1])
06-05 16:55:41.781 1577-1577/com.google.android.exoplayer2.demo E/EventLogger: playerFailed [0.79]
com.google.android.exoplayer2.ExoPlaybackException
at com.google.android.exoplayer2.mediacodec.MediaCodecRenderer.throwDecoderInitError(MediaCodecRenderer.java:380)
Caused by: com.google.android.exoplayer2.mediacodec.MediaCodecRenderer$DecoderInitializationException: Decoder init failed: OMX.Exynos.avc.dec, Format(1/27, null, video/avc, -1, null, [2560, 1440, -1.0], [-1, -1])
Reproduction steps
The issue can be reproduced in the demo app by playing the below HLS stream, putting the app in the background, and resuming. Sometimes it happens on first try, sometimes it takes a few backgrounding or going back to the main list for the issue to occur.
Link to test content
http://europe.minglvision.com/hls/3602k.m3u8 The stream is a 360 video, but no special rendering is necessary to trigger the error.
Version of ExoPlayer being used
2.4.0 for demo app, 2.4.1 in production.
Device(s) and version(s) of Android being used
The issue reproduces consistently on Samsung SM-J200M, API 22. I wasn't able to reproduce on my OnePlus One, API 23.
A full bug report captured from the device
Update: when viewed in the Chrome app, the above stream works fine, it's just Exo that bugs out.
Update (@ojw28): same issue recurs on Motorola MotoG3 API 23 and Huawei ALE-L23 API 21.
06-28 09:09:46.935 com.mingvision.libdem E/ACodec: [OMX.qcom.video.decoder.avc] configureCodec returning error -12
06-28 09:09:46.936 com.mingvision.libdem E/ACodec: signalError(omxError 0x80001001, internalError -12)
06-28 09:09:46.936 com.mingvision.libdem E/MediaCodec: Codec reported err 0xfffffff4, actionCode 0, while in state 3
06-28 09:09:46.936 com.mingvision.libdem E/MediaCodec: configure failed with err 0xfffffff4, resetting...
06-28 09:09:46.999 com.mingvision.libdem E/ExoPlayerImplInternal: Renderer error.
com.google.android.exoplayer2.ExoPlaybackException
I have a hunch that this happens because the resolution exceeds the device's capabilities, but ideally I'd want this to be explicitly reported/queried, as opposed to receiving a generic renderer error.
LGE LG-K350 API 23 has the same issue. Here's that device's logcat output:
06-28 09:49:50.308 com.mingvision.libdem E/ACodec: Wrong cropped rect (0, 0) - (854, 480) vs. frame (320, 192)
06-28 09:49:50.308 com.mingvision.libdem E/ACodec: [OMX.MTK.VIDEO.DECODER.AVC] Failed to get port format to send format change
06-28 09:49:50.315 com.mingvision.libdem E/ACodec: Wrong cropped rect (0, 0) - (854, 480) vs. frame (320, 192)
06-28 09:49:50.315 com.mingvision.libdem E/ACodec: [OMX.MTK.VIDEO.DECODER.AVC] Failed to get port format to send format change
06-28 09:49:54.554 com.mingvision.libdem E/ACodec: [OMX.MTK.VIDEO.DECODER.AVC] configureCodec returning error 80000000
06-28 09:49:54.554 com.mingvision.libdem E/ACodec: signalError(omxError 0x80001001, internalError -2147483648)
06-28 09:49:54.554 com.mingvision.libdem E/MediaCodec: Codec reported err 0x80001001, actionCode 0, while in state 3
06-28 09:49:54.555 com.mingvision.libdem E/MediaCodec: configure failed with err 0x80001001, resetting...
06-28 09:49:54.588 com.mingvision.libdem E/ExoPlayerImplInternal: Renderer error.
com.google.android.exoplayer2.ExoPlaybackException
And I've included another bugreport, taken on the above mentioned device just after the error was thrown.
I have a hunch that this happens because the resolution exceeds the device's capabilities, but ideally I'd want this to be explicitly reported/queried, as opposed to receiving a generic renderer error.
I think you're right. This can be easily avoided by including RESOLUTION attributes in the HLS master playlist, which were not included in this sample (the sample is no longer available, but you can tell from the logs).
When RESOLUTION attributes are included in the master playlist, ExoPlayer will use them to avoid selecting variants that exceed the capabilities of the device. Inclusion of RESOLUTION attributes is recommended, particularly in cases where they're sufficiently high resolution that devices may well not support them.