Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Video is not playing and giving error in the logcat - Video codec error android.media.MediaCodec$CodecException: Error 0x80000000 #1280

Open
1 task
mallikarjunpatelsh opened this issue Apr 15, 2024 · 4 comments
Assignees

Comments

@mallikarjunpatelsh
Copy link

mallikarjunpatelsh commented Apr 15, 2024

Version

Media3 main branch

More version details

No response

Devices that reproduce the issue

facing this on Realme Narzo and Opposite

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

No

Reproduction steps

On selecting the video to play, Video is opened and starts loading and loader is shown and after sometime the control is coming to onPlayerError()

Expected result

Video should play

Actual result

Video is not playing instead getting error in logical and the error is

Video codec error
                                                                                                      android.media.MediaCodec$CodecException: Error 0x80000000
2024-04-15 17:55:05.161 22910-24355 ExoPlayerImplInternal   com.wise.devikapluspoint             E  Playback error
                                                                                                      androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(0, null, null, video/avc, avc1.640033, -1, null, [2208, 2196, -1.0, ColorInfo(BT601, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:623)
                                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                          at android.os.Looper.loopOnce(Looper.java:240)
                                                                                                          at android.os.Looper.loop(Looper.java:351)
                                                                                                          at android.os.HandlerThread.run(HandlerThread.java:67)
                                                                                                      Caused by: androidx.media3.exoplayer.video.MediaCodecVideoDecoderException: Decoder failed: c2.mtk.avc.decoder
                                                                                                          at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.createDecoderException(MediaCodecVideoRenderer.java:1915)
                                                                                                          at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:848)
                                                                                                          at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:940)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1112)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:544)
                                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102) 
                                                                                                          at android.os.Looper.loopOnce(Looper.java:240) 
                                                                                                          at android.os.Looper.loop(Looper.java:351) 
                                                                                                          at android.os.HandlerThread.run(HandlerThread.java:67) 
                                                                                                      Caused by: android.media.MediaCodec$CodecException: Error 0x80000000
2024-04-15 17:55:05.175 22910-24355 ExoPlayerImplInternal   com.wise.devikapluspoint             E  Disable failed.
                                                                                                      java.lang.IllegalStateException
                                                                                                          at android.media.MediaCodec.native_flush(Native Method)
                                                                                                          at android.media.MediaCodec.flush(MediaCodec.java:2388)
                                                                                                          at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.flush(AsynchronousMediaCodecAdapter.java:248)
                                                                                                          at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushCodec(MediaCodecRenderer.java:912)
                                                                                                          at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.flushOrReleaseCodec(MediaCodecRenderer.java:905)
                                                                                                          at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.onDisabled(MediaCodecRenderer.java:744)
                                                                                                          at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.onDisabled(MediaCodecVideoRenderer.java:711)
                                                                                                          at androidx.media3.exoplayer.BaseRenderer.disable(BaseRenderer.java:220)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.disableRenderer(ExoPlayerImplInternal.java:1803)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.resetInternal(ExoPlayerImplInternal.java:1525)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.stopInternal(ExoPlayerImplInternal.java:1482)
                                                                                                          at androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:667)
                                                                                                          at android.os.Handler.dispatchMessage(Handler.java:102)
                                                                                                          at android.os.Looper.loopOnce(Looper.java:240)
                                                                                                          at android.os.Looper.loop(Looper.java:351)
                                                                                                          at android.os.HandlerThread.run(HandlerThread.java:67)

Media

Not applicable

Bug Report

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.
@microkatz
Copy link
Contributor

Hello @mallikarjunpatelsh,

Thank you for reporting your issue! I see that in your report that you don't hit this issue if you play with the ExoPlayer demo app. I would just like to confirm if that is true?

@mallikarjunpatelsh
Copy link
Author

No @microkatz . These videos are not playing at demo app too.

@microkatz
Copy link
Contributor

@mallikarjunpatelsh

If you could attach or email the full bug report then that would be helpful. If you're unable to share [bug reports (https://developer.android.com/studio/debug/bug-report) publicly, please send them to [email protected] with the subject Issue #1280. Please also update this issue to indicate you've done this.

However, based on the small log snippet, it appears to be a decoder specific issue. I believe that the c2.mtk.avc.decoder is a hardware decoder. What may help is to implement a workaround to use a software decoder instead. Your choice as far as whether to restrict when playing certain content or just not use the c2.mtk.avc.decoder at all.

An app can implement a workaround to remove the c2.mtk.avc.decoder as follows (bottom-up):

The app should override MediaCodecVideoRenderer.getDecoderInfos() roughly as follows:

protected List<MediaCodecInfo> getDecoderInfos(
      MediaCodecSelector mediaCodecSelector, Format format, boolean requiresSecureDecoder)
      throws DecoderQueryException {
    List<MediaCodecInfo> decoderInfos = super.getDecoderInfos(mediaCodecSelector, format, requiresSecureDecoder);
    if (format.sampleMimeType.equals(MimeTypes.VIDEO_H264) 
        && want_to_disable_mtk_hardware_decoder) {
        // check if decoderInfos contains an avc decoder with name equal to c2.mtk.avc.decoder
        // if yes, return a copy of the decoderInfos list excluding that decoder
  }

The app can inject the custom renderer by overriding DefaultRenderersFactory.buildVideoRenderers()
The player should be created with the custom DefaultRenderersFactory. which can be passed either on the ExoPlayer.Builder constructor, or with ExoPlayer.Builder.setRenderersFactory.

@ThomasKNR
Copy link

Hi, @microkatz , this same problem also happened to me. I've send the bugreport in email just in case OP will not send bugreport. I tried your suggestion, removal of the HW decoder fixed it. However SW renderer will increase load on the device.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants