TheWidlarzGroup / react-native-video

A <Video /> component for react-native
http://thewidlarzgroup.github.io/react-native-video/
MIT License
7.14k stars 2.88k forks source link

[BUG]: Error 24003 on Android 12 #4164

Closed m-cartmell closed 1 day ago

m-cartmell commented 6 days ago

Version

6.5.0

What platforms are you having the problem on?

Android

System Version

Android 12

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

LOG  video error: {
  "error": {
    "errorCode": "24003", 
    "errorException": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.4D4029, -1, null, [1920, 1080, 24.999998, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES",
    "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.4D4029, -1, null, [1920, 1080, 24.999998, 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:623)
    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.rk.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)
    ... 4 more
    Caused by: java.lang.IllegalStateException
    at android.media.MediaCodec.native_queueInputBuffer(Native Method)
    at android.media.MediaCodec.queueInputBuffer(MediaCodec.java:2769)
    at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doQueueInputBuffer(AsynchronousMediaCodecBufferEnqueuer.java:220)
    at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.doHandleMessage(AsynchronousMediaCodecBufferEnqueuer.java:189)
    at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer.access$000(AsynchronousMediaCodecBufferEnqueuer.java:45)
    at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecBufferEnqueuer$1.handleMessage(AsynchronousMediaCodecBufferEnqueuer.java:91)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    ... 3 more
    ",
    "errorString": "ExoPlaybackException: ERROR_CODE_DECODING_FAILED"
  }
}

Expected behaviour

Consistently play MP4s after rendering a new screen without issue.

Reproduction Link

https://github.com/m-cartmell/react-native-video-test

Reproduction

With the minimal repo, reload the application or tap next until an error is reported. The erroring is inconsistent.

github-actions[bot] commented 6 days ago

Thank you for your bug report. We will review it and get back to you if we need more information.

github-actions[bot] commented 6 days ago

Thank you for your issue report. Please note that the following information is missing or incomplete:

Please update your issue with this information to help us address it more effectively.

Note: issues without complete information have a lower priority

github-actions[bot] commented 6 days ago

Thank you for your bug report. We will review it and get back to you if we need more information.

vmsilva commented 5 days ago

same problem here!

{"error": {"errorCode": "24003", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.64001E, 608000, null, [640, 360, -1.0, ColorInfo(BT709, Limited range, SDR SMPTE 170M, false, 8bit Luma, 8bit Chroma)], [-1, -1]), format_supported=YES", "errorStackTrace": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.64001E, 608000, null, [640, 360, -1.0, 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:623) 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.h264.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) ... 4 more Caused by: android.media.MediaCodec$CodecException: Error 0xfffffff3 at android.media.MediaCodec.releaseOutputBuffer(Native Method) at android.media.MediaCodec.releaseOutputBufferInternal(MediaCodec.java:3651) at android.media.MediaCodec.releaseOutputBuffer(MediaCodec.java:3572) at androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.releaseOutputBuffer(AsynchronousMediaCodecAdapter.java:202) at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.skipOutputBuffer(MediaCodecVideoRenderer.java:1528) at androidx.media3.exoplayer.video.MediaCodecVideoRenderer.processOutputBuffer(MediaCodecVideoRenderer.java:1330) at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:2010) at androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:827) ... 7 more ", "errorString": "ExoPlaybackException: ERROR_CODE_DECODING_FAILED"}}

freeboub commented 3 days ago

Looks like a DECODER issue, It means that playing the 2 videos in the same time causes issues on your device. I try to reproduce with the emulator, I have no issue. You should try to stop (set source to undefined) or pause the video when the screen is not visible with useIsFocused

m-cartmell commented 3 days ago

Looks like a DECODER issue, It means that playing the 2 videos in the same time causes issues on your device. I try to reproduce with the emulator, I have no issue. You should try to stop (set source to undefined) or pause the video when the screen is not visible with useIsFocused

If you look at the minimal repo I supplied, I am using the useIsFocused hook to mount/unmount videos. I am experiencing the issue on a real device, not an emulator. The error can also occur when the project is initially rendered or reloaded.

freeboub commented 3 days ago

unfortunatelly, I don't reproduce on my device ... Did you try to add a delay before starting the video ? I am afraid this is a device specific issue while there are 2 videos in the same time (unmount <Video is not an instant action) A delay can improve that.

You can also try to change the viewType

freeboub commented 3 days ago

maybe it's also be related to this ticket ? https://github.com/TheWidlarzGroup/react-native-video/issues/3491

m-cartmell commented 1 day ago

unfortunatelly, I don't reproduce on my device ... Did you try to add a delay before starting the video ? I am afraid this is a device specific issue while there are 2 videos in the same time (unmount <Video is not an instant action) A delay can improve that.

You can also try to change the viewType

Thank you for your advice. Setting the video source to null when navigating away from a screen and using useIsFocused and a timeout to select the source when on a screen seems to have resolved the issue. I am closing the report.