[Bug]: Crash on android, Error while updating property 'video'
Opened this issue · 21 comments
Version
v2.0.0
Which operating systems have you used?
- Android
- iOS
Environment that reproduces the issue
Tested on
Xiaomi Redmi Note 11S
android 13
Is it reproducible in the example application?
Not tested
RTMP Server
Reproduction steps
I have a component where <ApiVideoLiveStreamView.../>
is placed. Upon mounting and unmounting the component for few time ( more than 3 times) without even connecting to the server, the app gets crashed.
Expected result
the app should not crash
Actual result
the app is crashing on mounting/unmounting the component containing <ApiVideoLiveStreamView.../>
.
Additional context
react native: 0.71.13
Relevant logs output
FATAL EXCEPTION: main
com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'video' of a view managed by: ApiVideoLiveStreamView
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:101)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:136)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:56)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:86)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:188)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1110)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1081)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1503)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1513)
at android.view.Choreographer.doCallbacks(Choreographer.java:1128)
at android.view.Choreographer.doFrame(Choreographer.java:1037)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1481)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8503)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.uimanager.ViewManagersPropertyCache$PropSetter.updateViewProp(ViewManagersPropertyCache.java:93)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater$FallbackViewManagerSetter.setProperty(ViewManagerPropertyUpdater.java:136)
at com.facebook.react.uimanager.ViewManagerPropertyUpdater.updateProps(ViewManagerPropertyUpdater.java:56)
at com.facebook.react.uimanager.ViewManager.updateProperties(ViewManager.java:86)
at com.facebook.react.uimanager.ViewManager.createViewInstance(ViewManager.java:188)
at com.facebook.react.uimanager.ViewManager.createView(ViewManager.java:115)
at com.facebook.react.uimanager.NativeViewHierarchyManager.createView(NativeViewHierarchyManager.java:281)
at com.facebook.react.uimanager.UIViewOperationQueue$CreateViewOperation.execute(UIViewOperationQueue.java:194)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.dispatchPendingNonBatchedOperations(UIViewOperationQueue.java:1110)
at com.facebook.react.uimanager.UIViewOperationQueue$DispatchUIFrameCallback.doFrameGuarded(UIViewOperationQueue.java:1081)
at com.facebook.react.uimanager.GuardedFrameCallback.doFrame(GuardedFrameCallback.java:29)
at com.facebook.react.modules.core.ReactChoreographer$ReactChoreographerDispatcher.doFrame(ReactChoreographer.java:175)
at com.facebook.react.modules.core.ChoreographerCompat$FrameCallback$1.doFrame(ChoreographerCompat.java:85)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1503)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:1513)
at android.view.Choreographer.doCallbacks(Choreographer.java:1128)
at android.view.Choreographer.doFrame(Choreographer.java:1037)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1481)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:211)
at android.os.Looper.loop(Looper.java:300)
at android.app.ActivityThread.main(ActivityThread.java:8503)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:561)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:954)
Caused by: android.media.MediaCodec$CodecException: Error 0xfffffff4
at android.media.MediaCodec.native_configure(Native Method)
at android.media.MediaCodec.configure(MediaCodec.java:2214)
at android.media.MediaCodec.configure(MediaCodec.java:2130)
at io.github.thibaultbee.streampack.internal.encoders.MediaCodecEncoder.createCodec(MediaCodecEncoder.kt:184)
at io.github.thibaultbee.streampack.internal.encoders.MediaCodecEncoder.configure(MediaCodecEncoder.kt:200)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.resetVideo(BaseStreamer.kt:365)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.stopStream$suspendImpl(BaseStreamer.kt:322)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer$stopStream$1.invokeSuspend(Unknown Source:11)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:280)
at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59)
at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source:1)
at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38)
at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source:1)
at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.stopPreview(BaseCameraStreamer.kt:120)
at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.release(BaseCameraStreamer.kt:130)
at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.configure(BaseStreamer.kt:244)
at video.api.livestream.ApiVideoLiveStream.setVideoConfig(ApiVideoLiveStream.kt:127)
at video.api.reactnative.livestream.LiveStreamView.setVideoConfig(LiveStreamView.kt:134)
at video.api.reactnative.livestream.LiveStreamViewManager.setVideo(LiveStreamViewManager.kt:67)
android.media.MediaCodec$CodecException: Error 0xfffffff4
is not really explicit.
As a short term solution, I will mitigate this issue by not calling Codec configure
when stopStream
is call and it is not streaming.
In the current implementation, the codec (Android API called MediaCodec) is released and reopen when calling stopStream
so it is quickly ready for a new shot.
Currently, I am reworking the native Android component. I already changed that behavior so that the MediaCodec won't be open/close anymore when calling stopStreaming
.
android.media.MediaCodec$CodecException: Error 0xfffffff4
is not really explicit. As a short term solution, I will mitigate this issue by not calling Codecconfigure
whenstopStream
is call and it is not streaming.In the current implementation, the codec (Android API called MediaCodec) is released and reopen when calling
stopStream
so it is quickly ready for a new shot. Currently, I am reworking the native Android component. I already changed that behavior so that the MediaCodec won't be open/close anymore when callingstopStreaming
.
How can i fix this crash right now?
FYI i'm not calling stopStreaming while mounting or unmounting the component, it is only called when the stream is connected to RTMP server.
Wait for a new release.
stopStreaming
is used internally when the application is unmounting.
Wait for a new release.
stopStreaming
is used internally when the application is unmounting.
okay, thanks
Hi @ThibaultBee,
I'm experiencing the same issue. As you mentioned, it will be fixed in the upcoming version. Could you please let me know when we can expect the new version to be released?
We don't have source code to get you a PR and its affecting our tests alot making android more or less unreliable. Any rough eta on this?
Great, have you released it, how soon can we test it?
when are you planning to release it ? @ThibaultBee
Hi,
I have made the fixes in the main
branch.
Could you test on the main
branch?
Hi, I have made the fixes in the
main
branch. Could you test on themain
branch?
its fixed
step tried:
- open application
- went into background
application didn’t crash
@ThibaultBee when do you plan to release it?.
When are you planning on releasing it? We are hit hard with this bug and currently trying to find alternatives to replace it.
Hi @ThibaultBee,
Do you have a tentative release date for this fix? We're experiencing a lot of crashes related to this issue.
@talhatsk , @xoraingroup, @MAzeem6778
I am waiting for #81 (comment)
@ThibaultBee our app users are currently impacted by this bug, and I was wondering if it's possible to release an update with that fix, like beta version of the release. I understand you're working on other issues, but this would really help in the meantime.
@ThibaultBee seems issue #81 is stale as the user hasn't responded for 3 weeks. I would request to create a release which can fix up this crash at least. It has ruined overall experience of our app. :)
Hi @ThibaultBee,
Any updates on the release? This crash is significantly affecting our app's user experience.
Could you test on 2.0.1?
getting this error after updating to 2.0.1 version. @ThibaultBee
> Could not resolve all files for configuration ':app:developmentDebugRuntimeClasspath'.
> Failed to transform camera-viewfinder-1.4.0-alpha06.aar (androidx.camera:camera-viewfinder:1.4.0-alpha06) to match attributes {artifactType=android-dex, asm-transformed-variant=NONE, dexing-enable-desugaring=true, dexing-enable-jacoco-instrumentation=false, dexing-is-debuggable=true, dexing-min-sdk=21, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
> Execution failed for DexingWithClasspathTransform: /.gradle/caches/transforms-3/a2f592b30fddcb727f0b2169f047a323/transformed/jetified-camera-viewfinder-1.4.0-alpha06-runtime.jar.
> Error while dexing.
Hi,
It is a new issue on a different release. Please open a new issue for this.