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]: Multiple videos playing at once causes several androidx.media3.exoplayer.ExoPlaybackException #4100

Open mfapproach opened 3 weeks ago

mfapproach commented 3 weeks ago

Version

6.4.5

What platforms are you having the problem on?

Android TV

System Version

12

On what device are you experiencing the issue?

Real device

Architecture

Old architecture

What happened?

A bug happened!

This is for a digital signage platform. A slideshow containing various image & videos. When a slide contains more than 1 video, androidx.media3.exoplayer.ExoPlaybackException eventually show up. Most of the time the errors begin showing within several minutes of the slides rotations.

'Video error occured', { errorStackTrace: 'androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:720)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loopOnce(Looper.java:201)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: java.lang.IllegalStateException\n\tat androidx.media3.common.util.Assertions.checkStateNotNull(Assertions.java:117)\n\tat androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecCallback.dequeueOutputBufferIndex(AsynchronousMediaCodecCallback.java:166)\n\tat androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.dequeueOutputBufferIndex(AsynchronousMediaCodecAdapter.java:218)\n\tat androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1994)\n\tat androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:873)\n\tat androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1018)\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1136)\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:561)\n\t... 4 more\n', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorCode: '21004', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorException: 'androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorString: 'ExoPlaybackException: ERROR_CODE_FAILED_RUNTIME_CHECK' }

'Video error occured', { errorStackTrace: 'androidx.media3.exoplayer.ExoPlaybackException: Source error\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleIoException(ExoPlayerImplInternal.java:736)\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:706)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loopOnce(Looper.java:201)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: androidx.media3.common.ParserException: Invalid NAL length{contentIsMalformed=true, dataType=1}\n\tat androidx.media3.extractor.mp4.FragmentedMp4Extractor.readSample(FragmentedMp4Extractor.java:1560)\n\tat androidx.media3.extractor.mp4.FragmentedMp4Extractor.read(FragmentedMp4Extractor.java:473)\n\tat androidx.media3.exoplayer.source.BundledExtractorsAdapter.read(BundledExtractorsAdapter.java:147)\n\tat androidx.media3.exoplayer.source.ProgressiveMediaPeriod$ExtractingLoadable.load(ProgressiveMediaPeriod.java:1082)\n\tat androidx.media3.exoplayer.upstream.Loader$LoadTask.run(Loader.java:421)\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)\n\tat java.lang.Thread.run(Thread.java:920)\n', 08-19 09:36:54.946 2767 2830 I ReactNativeJS: errorCode: '23001', 08-19 09:36:54.946 2767 2830 I ReactNativeJS: errorException: 'androidx.media3.exoplayer.ExoPlaybackException: Source error', 08-19 09:36:54.946 2767 2830 I ReactNativeJS: errorString: 'ExoPlaybackException: ERROR_CODE_PARSING_CONTAINER_MALFORMED' }

Video error occured {"errorCode": "24003", "errorException": "androidx.media3.exoplayer.ExoPlaybackException: MediaCodecVideoRenderer error, index=0, format=Format(1, null, null, video/avc, avc1.64001F, -1, null, [720, 1280, 29.997833, 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.64001F, -1, null, [720, 1280, 29.997833, 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: OMX.amlogic.avc.decoder.awesome2 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 0x80001000 ", "errorString": "ExoPlaybackException: ERROR_CODE_DECODING_FAILED"}

Reproduction Link

https://drive.google.com/drive/folders/1uew90qtgdCrQPoiOE9gb9Q_TsctfqffZ?usp=sharing

Reproduction

Step to reproduce this bug are:

Play more than once video at once. I've never had any issues or errors when one video is playing at a time.

moskalakamil commented 3 weeks ago

Hi, thanks for reporting an issue!

freeboub commented 3 weeks ago

@mfapproach it would be interesting to know how many decoder are available on the device ? Is this something you also reproduce with the emulator ? how many <Video do you have mounted simultanenously (with a source defined) ?

mfapproach commented 3 weeks ago

@freeboub I'm looking into the number of video decoders today, I'm assuming thats what the issue is. I haven't tested to reproduce with the emulator, but I can do that today. The device I'm using is the Onn 4k streaming box, as that is the only device we currently use for digital signage.

I don't remember this being an issue until the switch to v. 6 was made and exoplayer was the default.

I've seen the issue with as few as two simultaneous <Video components playing, but have tested with maybe 6 simultaneous? It is strange, sometimes it will play for a little, sometimes a while, but the error always eventually shows up with multiple <Video playing.

freeboub commented 3 weeks ago

You are right, there was also a flag which was added recently: .setEnableDecoderFallback(true) It should allow fallback on sofware decoder in case HW decoder are not available... Another complementary test you can do is to create a new app with 6 video playback in parallel. It can help you to identify the limitation...

mfapproach commented 3 weeks ago

Below is the hardware decoder for the codec I am using. I am a little confused how is says 9 concurrent-instances, shouldn't that mean it can handle 9 videos played at once?

`

`

With the new 6.4.5, I'm seeing the below error a lot more. But once again, it doesn't happen all the time and it is very hard to diagnose. For example, yesterday, in an attempt to reproduce the error, i played multiple videos to the point that the error occurred. Once the error occurred, even certain videos played by themselves would result in the error below. And from logging, before the error occurs it always gets stuck buffering. I tried clearing the cache and reinstalled the application and the same issue persisted. The only way the occasional errors went away was from a factory reset of the device.

'Video error occured', { errorStackTrace: 'androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:720)\n\tat android.os.Handler.dispatchMessage(Handler.java:102)\n\tat android.os.Looper.loopOnce(Looper.java:201)\n\tat android.os.Looper.loop(Looper.java:288)\n\tat android.os.HandlerThread.run(HandlerThread.java:67)\nCaused by: java.lang.IllegalStateException\n\tat androidx.media3.common.util.Assertions.checkStateNotNull(Assertions.java:117)\n\tat androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecCallback.dequeueOutputBufferIndex(AsynchronousMediaCodecCallback.java:166)\n\tat androidx.media3.exoplayer.mediacodec.AsynchronousMediaCodecAdapter.dequeueOutputBufferIndex(AsynchronousMediaCodecAdapter.java:218)\n\tat androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.drainOutputBuffer(MediaCodecRenderer.java:1994)\n\tat androidx.media3.exoplayer.mediacodec.MediaCodecRenderer.render(MediaCodecRenderer.java:873)\n\tat androidx.media3.exoplayer.video.MediaCodecVideoRenderer.render(MediaCodecVideoRenderer.java:1018)\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.doSomeWork(ExoPlayerImplInternal.java:1136)\n\tat androidx.media3.exoplayer.ExoPlayerImplInternal.handleMessage(ExoPlayerImplInternal.java:561)\n\t... 4 more\n', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorCode: '21004', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorException: 'androidx.media3.exoplayer.ExoPlaybackException: Unexpected runtime error', 08-19 10:05:14.149 4795 4829 I ReactNativeJS: errorString: 'ExoPlaybackException: ERROR_CODE_FAILED_RUNTIME_CHECK' }

github-actions[bot] commented 3 weeks 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

There is a newer version of the library available.You are using version 6.4.5 (exoplayer), while the latest stable version is 6.4.5.Please update to the latest version and check if the issue still exists.

Note: If the issue still exists, please update the issue report with the latest information.

github-actions[bot] commented 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks 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 3 weeks ago

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