emiliodallatorre / flutter_rtmp_broadcaster

Publisher to rtmp using the camera plugin as a basis to do all the basic camera/record management.
MIT License
8 stars 12 forks source link

App Crash When Switching Camera Direction During Streaming or Recording #20

Open swati260 opened 3 months ago

swati260 commented 3 months ago

I want to switch the camera direction while streaming or recording. However, if I select a camera and then try to switch to a different camera direction, the app crashes and I encounter an error. I/Stuff (30717): dispose I/Stuff (30717): initialize D/VRIMainActivity: onFocusEvent false W/System (30717): A resource failed to call Surface.release. I/SurfaceView(30717): 225612042 surfaceDestroyed D/BufferQueueProducer(30717): SurfaceView[]#7(BLAST Consumer)7 disconnect: api -1 D/BufferQueueConsumer(30717): SurfaceView[]#7(BLAST Consumer)7 disconnect D/BufferQueueProducer(30717): SurfaceView[]#7(BLAST Consumer)7 disconnect: api 1 D/BufferQueueProducer(30717): ImageReader-1039x1559f22m5-30717-1 disconnect: api 1 D/BufferQueueProducer(30717): ImageReader-1039x1559f22m5-30717-1 connect: api=1 producerControlledByApp=false W/PlatformViewsController(30717): Unexpected platform view context for view ID 0; some functionality may not work correctly. When constructing a platform view in the factory, ensure that the view returned from PlatformViewFactory#create returns the provided context from getContext(). If you are unable to associate the view with that context, consider using Hybrid Composition instead. D/OplusInputMethodUtil(30717): updateDebugToClass InputMethodManager.DEBUG = false D/OplusInputMethodUtil(30717): updateDebugToClass ImeFocusController.DEBUG = false D/OplusInputMethodUtil(30717): updateDebugToClass BaseInputConnection.DEBUG = false D/OplusInputMethodUtil(30717): updateDebugToClass ImeFocusController.sDebugIme = false D/WindowManager(30717): Add to mViews: DecorView@76627f9[],pkg= null D/ViewRootImplExtImpl(30717): onDisplayChanged -1 for VRI android.view.ViewRootImpl@fd84ab5 D/InputEventReceiver(30717): Input log is disabled D/OplusScrollToTopManager(30717): unregisterGuidePopupDismissReceiverInSystemUI D/OplusScrollToTopManager(30717): Receiver not registered: android.view.OplusScrollToTopManager$1@10d9cbb D/OplusScrollToTopManager(30717): unregisterSystemUIBroadcastReceiver D/OplusScrollToTopManager(30717): java.lang.IllegalArgumentException: Receiver not registered: android.view.OplusScrollToTopManager$2@c2ee5d8 V/ZoomWindowDecorView(30717): removeZoomView D/SurfaceView(30717): 118480177positionLost mSurfaceControl is null return; D/BufferQueueProducer(30717): VRI[]#6(BLAST Consumer)6 disconnect: api 1 D/BufferQueueConsumer(30717): VRI[]#6(BLAST Consumer)6 disconnect D/VRIMainActivity: onFocusEvent true I/TAG (30717): open: width: 720 height: 480 currentOrientation: -1 quarterTurns: 0 D/CameraNativeView(30717): startPreview: medium D/BufferQueueProducer(30717): SurfaceTexture-1-30717-1 disconnect: api 4 I/OplusCameraManagerGlobal(30717): setClientInfo, packageName: com.orryworx.broadcaster, uid: 10274, pid: 30717 D/OplusCamera2StatisticsManager(30717): addPreviewInfo, eventMap: {halLevel=3, preview_time=5905, face_count=0, cameraId=1, pkgName=com.orryworx.broadcaster, apLevel=2} D/OplusCamera2StatisticsManager(30717): addInfo, eventMap: {halLevel=3, cameraId=1, disconnectTime=1722343978469, pkgName=com.orryworx.broadcaster, connentTime=1722343972564, apLevel=2, timeCost=5905} I/OpenGlViewBase(30717): Thread started. E/AndroidRuntime(30717): FATAL EXCEPTION: glThread E/AndroidRuntime(30717): Process: com.orryworx.broadcaster, PID: 30717 E/AndroidRuntime(30717): java.lang.IllegalArgumentException: Make sure the SurfaceView or associated SurfaceHolder has a valid Surface E/AndroidRuntime(30717): at android.opengl.EGL14._eglCreateWindowSurface(Native Method) E/AndroidRuntime(30717): at android.opengl.EGL14.eglCreateWindowSurface(EGL14.java:266) E/AndroidRuntime(30717): at com.pedro.encoder.input.gl.SurfaceManager.eglSetup(SurfaceManager.java:133) E/AndroidRuntime(30717): at com.pedro.encoder.input.gl.SurfaceManager.(SurfaceManager.java:50) E/AndroidRuntime(30717): at com.pedro.rtplibrary.view.LightOpenGlView.run(LightOpenGlView.java:78) E/AndroidRuntime(30717): at java.lang.Thread.run(Thread.java:1012) I/Process (30717): Sending signal. PID: 30717 SIG: 9

OlJohnny commented 2 months ago

Same problem here when destroying the CameraController with the old camera lens setting and creating a new one, the livestream stops.

Does anybody know if pausing the livestream, replacing the camera controller and then resuming the livestream works?

emiliodallatorre commented 2 months ago

Hi @swati260, could you please provide a reproducible example of this behavior?