apivideo/api.video-reactnative-live-stream

java.security.InvalidParameterException: Failed to create codec for: {mime=video/avc, width=1080, height=1920}

Closed this issue · 8 comments

Describe the bug
Crashes on the livestream screen abruptly as soon as the screen is mounted.

To Reproduce
Steps to reproduce the behavior:

  1. Create a screen with <LivestreamView />
  2. Navigate to the screen

Expected behavior
Should not crash on the screen

Screenshots
If applicable, add screenshots to help explain your problem.

Smartphone (please complete the following information):

  • Device: Vivo V25
  • OS: Android 12
  • Version 1.2.1

Additional context

# Crashlytics - Stack trace
# Platform: android
# Version: 1.0 (1)
# Issue: 1eda585a3bdb2ccba46496e2e842614b
# Session: 638EC6A402E100015D3DD0EFEB972BB8_DNE_0_v2
# Date: Tue Dec 06 2022 10:08:08 GMT+0530 (India Standard Time)

Fatal Exception: com.facebook.react.bridge.JSApplicationIllegalArgumentException: Error while updating property 'video' of a view managed by: ReactNativeLiveStreamView
       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:1226)
       at android.view.Choreographer.doCallbacks(Choreographer.java:1012)
       at android.view.Choreographer.doFrame(Choreographer.java:917)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1213)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:334)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

Caused by java.lang.reflect.InvocationTargetException:
       at java.lang.reflect.Method.invoke(Method.java)
       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:1226)
       at android.view.Choreographer.doCallbacks(Choreographer.java:1012)
       at android.view.Choreographer.doFrame(Choreographer.java:917)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1213)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:334)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

Caused by java.security.InvalidParameterException: Failed to create codec for: {mime=video/avc, width=1080, height=1920}
       at io.github.thibaultbee.streampack.internal.encoders.MediaCodecEncoder.createCodec(MediaCodecEncoder.kt:185)
       at io.github.thibaultbee.streampack.internal.encoders.VideoMediaCodecEncoder.createVideoCodec(VideoMediaCodecEncoder.kt:81)
       at io.github.thibaultbee.streampack.internal.encoders.VideoMediaCodecEncoder.configure(VideoMediaCodecEncoder.kt:59)
       at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.resetVideo(BaseStreamer.kt:364)
       at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.stopStream(BaseStreamer.kt:321)
       at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.stopPreview(BaseCameraStreamer.kt:126)
       at io.github.thibaultbee.streampack.streamers.bases.BaseCameraStreamer.release(BaseCameraStreamer.kt:134)
       at io.github.thibaultbee.streampack.streamers.bases.BaseStreamer.configure(BaseStreamer.kt:243)
       at video.api.livestream.ApiVideoLiveStream.setVideoConfig(ApiVideoLiveStream.kt:86)
       at video.api.reactnative.livestream.ReactNativeLiveStreamView.setVideoConfig(ReactNativeLiveStreamView.kt:59)
       at video.api.reactnative.livestream.ReactNativeLiveStreamViewManager.setVideoConfig(ReactNativeLiveStreamViewManager.kt:62)
       at java.lang.reflect.Method.invoke(Method.java)
       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:1226)
       at android.view.Choreographer.doCallbacks(Choreographer.java:1012)
       at android.view.Choreographer.doFrame(Choreographer.java:917)
       at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:1213)
       at android.os.Handler.handleCallback(Handler.java:938)
       at android.os.Handler.dispatchMessage(Handler.java:99)
       at android.os.Looper.loopOnce(Looper.java:233)
       at android.os.Looper.loop(Looper.java:334)
       at android.app.ActivityThread.main(ActivityThread.java:8501)
       at java.lang.reflect.Method.invoke(Method.java)
       at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:582)
       at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1068)

Update: The phone I was trying on doesn't have h264 encoder but only h263 encoder. That explains the crash. What should I do to make it run?

Also, is it possible to use vp8/vp9 encoders for android devices?

Hi,

How do you it does not have a h264 encoder? It is unlikely to happen because It is mandatory for Android device to have a h264 encoder.

Anyway, this is a duplicated issue of #39

Hi,

How do you it does not have a h264 encoder? It is unlikely to happen because It is mandatory for Android device to have a h264 encoder.

Anyway, this is a duplicated issue of #39

Yes, i did verify it using this app: https://play.google.com/store/apps/details?id=com.parseus.codecinfo

Could you make screenshot of the video encoders?

Also could you test to start https://github.com/ThibaultBee/StreamPack/suites/9154470311/artifacts/425992879?

Hi,

Could you check that your issue is fixed in the main branch?

Unfortunately I don't have the devices currently which had this issue. Cannot confirm.

For now, I suppose it duplicates #39