Decoder failed: c2.goldfish.hevc.decoder Video codec error on Android13 virtual Device
Version
Media3 1.7.1 (same as 1.6.1)
More version details
No response
Devices that reproduce the issue
Android Virtual Device in Android Studio Meerkat Feature Drop | 2024.3.2
- API level 13 (both arm64 and x86_64)
- API level 15 /16 (x86_64 only)
Devices that do not reproduce the issue
Physical device
Reproducible in the demo app?
Yes
Reproduction steps
Repeat playing the attached video file more than 3 times.
By modify demos/main/src/main/java/androidx/media3/demo/main/PlayerActivity.java, Add player.setRepeatMode(Player.REPEAT_MODE_ONE);
Or add the video file URL to media.exolist.json, repeat the URL in a playlist.
Expected result
The video can keep playing over and over.
Actual result
After played 2 times, the video would stop playing.
- On AVD with API level 13, "Playback failed" message on screen, logcat
- On AVD with API level 15 /16, video freeze, but audio still playing.
Media
Bug Report
- [ ] You will email the zip file produced by
adb bugreportto [email protected] after filing this issue.
The distinctive feature of the attached file is that the first IDR slice header has no_output_of_prior_pics_flag set to 1. When no_output_of_prior_pics_flag is 0, the video can loop playback normally.
But the question is: Why does this flag's value cause decoding failure after successfully looping twice?
And if player.setRepeatMode(Player.REPEAT_MODE_NONE), then this video is always playable. Is it possible that flush is missing when we set player.setRepeatMode(Player.REPEAT_MODE_ONE) ?
@tianyif @microkatz Do you need more input for this issue?
same here.
Logcat:
2025-06-25 19:19:32.843 4379-4416 MediaCodecVideoRenderer com.example.exoplayerportraitbug E Video codec error
android.media.MediaCodec$CodecException: Error 0x80000000
2025-06-25 19:19:32.843 4379-4427 hw-BpHwBinder com.example.exoplayerportraitbug I onLastStrongRef automatically unlinking death recipients
2025-06-25 19:19:32.845 4379-4416 ExoPlayerImplInternal com.example.exoplayerportraitbug E Playback error
androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(0, null, video/mp4, video/hevc, hvc1.1.6.L150.B0, 12586448, und, [3840, 2160, 29.97, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:745)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: androidx.media3.exoplayer.video.MediaCodecVideoDecoderException: Decoder failed: c2.goldfish.hevc.decoder
at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:2350)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:902)
at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1281)
at androidx.media3.exoplayer.RendererHolder.render(RendererHolder.java:381)
at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1328)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:646)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
Caused by: android.media.MediaCodec$CodecException: Error 0x80000000
2025-06-25 19:19:32.849 4379-4416 ExoPlayerImplInternal com.example.exoplayerportraitbug E Disable failed.
java.lang.IllegalStateException
at android.media.MediaCodec.native_flush(Native Method)
at android.media.MediaCodec.flush(MediaCodec.java:2387)
at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.flush(AsynchronousMediaCodecAdapter.java:272)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:968)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:961)
at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:784)
at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:1060)
at androidx.media3.exoplayer.BaseRenderer.disable(BaseRenderer.java:244)
at androidx.media3.exoplayer.RendererHolder.disableRenderer(RendererHolder.java:645)
at androidx.media3.exoplayer.RendererHolder.disable(RendererHolder.java:539)
at androidx.media3.exoplayer.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:2064)
at androidx.media3.exoplayer.ExoPlayerImplInternal.disableRenderers(ExoPlayerImplInternal.java:2057)
at androidx.media3.exoplayer.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1790)
at androidx.media3.exoplayer.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1747)
at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:813)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.os.HandlerThread.run(HandlerThread.java:67)
tested projects:
tested simulators:
- API 33 - fail
- API 35 - success
bugreport for ExoPlayerPortraitBug.zip:
bugreport-sdk_gphone64_arm64-TE1A.240213.009-2025-06-25-19-22-29.zip
results on simulators for both projects are same.
@pengbins
Thank you for your patience.
I'm not sure the issue with the decoder on the emulator but I would definitely file a bug via Android Studio for the Android Virtual Device issue.
As far as your ExoPlayer specific questions.
And if player.setRepeatMode(Player.REPEAT_MODE_NONE), then this video is always playable. Is it possible that flush is missing when we set player.setRepeatMode(Player.REPEAT_MODE_ONE) ?
When you set the REPEAT_MODE_ONE then ExoPlayer will repeat the selected content. When loading the media item(again) in this way and as there are not any position discontinuities, ExoPlayer will attempt to reuse the decoder. Looks like the ExoPlayer's logic based on your content assumes the decoder can be reused without reconfiguration or flushing.
The distinctive feature of the attached file is that the first IDR slice header has no_output_of_prior_pics_flag set to 1. When no_output_of_prior_pics_flag is 0, the video can loop playback normally.
The difference of this flag denotes whether the IDR frame is a full-reset or not. If the value is 0, then prior decoded frames can still be output. Your content does contain b-frames. Maybe the decoder is finding issue that it cannot output the earlier frames once the next IDR is provided in REPEAT_MODE. I would still file your issue with the emulator as they would be able to provide more insight
Hope that helps.
@microkatz
Thank you very much for the clear explanation — it really helps us better understand what's going on with the decoder behavior under REPEAT_MODE_ONE.
Also, thank you for helping file this issue to the Android Virtual Device team. Is the forwarded issue publicly accessible? And is there a way for us to follow the progress or any updates from their side?
Appreciate your support again!