mrousavy / react-native-vision-camera

📸 A powerful, high-performance React Native Camera library.
https://react-native-vision-camera.com
MIT License
7.3k stars 1.07k forks source link

🐛 Black screen on camera #2223

Closed SK-bool closed 8 months ago

SK-bool commented 9 months ago

What's happening?

While the app is trying to open the camera I am getting the following error:

11-27 13:37:00.659 20287 20369 E ReactNativeJS: _message: '[session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR',

Reproduceable Code

const device = useCameraDevice('back');
const isFocused = useIsFocused();

<Camera
   style={StyleSheet.absoluteFill}
   device={device}
   isActive={isFocused}
     />

Relevant log output

11-27 13:37:00.084  1890  7359 D ConnectivityService: ConnectivityService NetworkRequestInfo binderDied(NetworkRequest [ LISTEN id=103, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ], android.os.BinderProxy@ea4e176)
11-27 13:37:00.085  1890  2282 E ConnectivityService: RemoteException caught trying to send a callback msg for NetworkRequest [ LISTEN id=103, [ Capabilities: INTERNET&NOT_RESTRICTED&TRUSTED&FOREGROUND] ]
11-27 13:37:00.598   889 21353 E mm-camera: <MCT   ><ERROR> 117: mct_bus_sof_thread_run: FATAL Session 3: SOF Freeze! Sending error message
11-27 13:37:00.598   889 21353 I mm-camera: <MCT   >< INFO> 158: mct_bus_sof_thread_run: Sending HW_ERROR from MCT on session =3
11-27 13:37:00.599   889 21285 E mm-camera: <MCT   ><ERROR> 823: mct_controller_send_cb: FATAL: Sending HW_Error
11-27 13:37:00.599   889 21306 E QCamera : <HAL><ERROR> camEvtHandle: 905: Fatal, camera daemon died
11-27 13:37:00.603   889  1878 E QCamera : <HAL><ERROR> processCaptureRequest: 6131: Unblocked on timeout!!!!
11-27 13:37:00.603   889  1878 E CamDevSession@3.2-impl: processOneCaptureRequest: HAL process_capture_request call failed!
11-27 13:37:00.603  1083 21314 E Camera3-Device: Camera 0: sendRequestsBatch: RequestThread: Unable to submit capture request 3 to HAL device: Function not implemented (-38)
11-27 13:37:00.607 20287 20486 E CameraManager: Camera 0: Error! 4
11-27 13:37:00.609 20287 20486 E CameraSession: Camera Device android.hardware.camera2.impl.CameraDeviceImpl@a2fca39 has been disconnected!
11-27 13:37:00.609 20287 20486 E CameraSession: com.mrousavy.camera.core.CameraDisconnectedError: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR
11-27 13:37:00.609 20287 20486 E CameraSession:         at com.mrousavy.camera.extensions.CameraManager_openCameraKt$openCamera$2$callback$1.onError(CameraManager+openCamera.kt:49)
11-27 13:37:00.609 20287 20486 E CameraSession:         at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks$1.run(CameraDeviceImpl.java:1791)
11-27 13:37:00.609 20287 20486 E CameraSession:         at android.os.Handler.handleCallback(Handler.java:789)
11-27 13:37:00.609 20287 20486 E CameraSession:         at android.os.Handler.dispatchMessage(Handler.java:98)
11-27 13:37:00.609 20287 20486 E CameraSession:         at android.os.Looper.loop(Looper.java:164)
11-27 13:37:00.609 20287 20486 E CameraSession:         at android.os.HandlerThread.run(HandlerThread.java:65)
11-27 13:37:00.609 20287 20486 E CameraView: invokeOnError(...):
11-27 13:37:00.609 20287 20486 W System.err: com.mrousavy.camera.core.CameraDisconnectedError: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR
11-27 13:37:00.609 20287 20486 W System.err:    at com.mrousavy.camera.extensions.CameraManager_openCameraKt$openCamera$2$callback$1.onError(CameraManager+openCamera.kt:49)
11-27 13:37:00.610 20287 20486 W System.err:    at android.hardware.camera2.impl.CameraDeviceImpl$CameraDeviceCallbacks$1.run(CameraDeviceImpl.java:1791)
11-27 13:37:00.610 20287 20486 W System.err:    at android.os.Handler.handleCallback(Handler.java:789)
11-27 13:37:00.610 20287 20486 W System.err:    at android.os.Handler.dispatchMessage(Handler.java:98)
11-27 13:37:00.610 20287 20486 W System.err:    at android.os.Looper.loop(Looper.java:164)
11-27 13:37:00.610 20287 20486 W System.err:    at android.os.HandlerThread.run(HandlerThread.java:65)
11-27 13:37:00.659 20287 20369 E ReactNativeJS: 'Camera.onError(session/camera-has-been-disconnected): [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR', { [session/camera-has-been-disconnected: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR]
11-27 13:37:00.659 20287 20369 E ReactNativeJS:   name: 'session/camera-has-been-disconnected',
11-27 13:37:00.659 20287 20369 E ReactNativeJS:   _code: 'session/camera-has-been-disconnected',
11-27 13:37:00.659 20287 20369 E ReactNativeJS:   _message: '[session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR',
11-27 13:37:00.659 20287 20369 E ReactNativeJS:   _cause: undefined }
11-27 13:37:00.721  1083 21314 W CallStack: update: Failed to unwind callstack.
11-27 13:37:00.722  1083 21314 E ProcessCallStack: getThreadName: Failed to open /proc/self/task/21315/comm
11-27 13:37:00.722  1083 21314 D CameraTraces: Process trace saved. Use dumpsys media.camera to view.
11-27 13:37:00.722  1083 21314 W Camera3-OutputStream: A frame is dropped for stream 2
11-27 13:37:00.722  1083  1083 E Camera3-Device: Camera 0: clearStreamingRequest: Device has encountered a serious error
11-27 13:37:00.722  1083  1083 I Camera3-Device: disconnect: E
11-27 13:37:00.722  1083  1083 E Camera3-Device: Camera 0: disconnect: Shutting down in an error state
11-27 13:37:00.722  1083  1083 I CameraLatencyHistogram: ProcessCaptureRequest latency histogram (3) samples:
11-27 13:37:00.722  1083  1083 I CameraLatencyHistogram:        40     80    120    160    200    240    280    320    360    inf (max ms)
11-27 13:37:00.722  1083  1083 I CameraLatencyHistogram:      33.33   33.33   33.33   0.00   0.00   0.00   0.00   0.00   0.00   0.00 (%)
11-27 13:37:00.723  1083 21314 W Camera3-OutputStream: A frame is dropped for stream 1
11-27 13:37:00.723   889  1878 E CamDevSession@3.2-impl: close: trying to close while there are still 6 inflight buffers!
11-27 13:37:00.723   889  1878 E CamDevSession@3.2-impl: close: trying to close while there are still 3 inflight  RAW boost overrides!
11-27 13:37:00.723   889  1878 I CameraKpiTag: [15745974ms] close_camera_device start
11-27 13:37:00.723   889  1878 I QCameraHalWatchdog: Starting Watchdog Thread (timeout 5000 msec)...
11-27 13:37:00.723   889  1878 I QCamera : <HAL><INFO> close_camera_device: 13573: [KPI Perf]: E camera id 0
11-27 13:37:00.724   913   962 E ANDR-PERF-MPCTL: Invalid profile no. 0, total profiles 0 only
11-27 13:37:00.724   913   962 E ANDR-PERF-RESOURCEQS: Failed to apply optimization [4, 0]
11-27 13:37:00.724   913   962 E ANDR-PERF-OPTSHANDLER: Write 4:-1 into /sys/module/msm_performance/parameters/max_cpus
11-27 13:37:00.726   889 21284 I mm-camera: <MCT   >< INFO> 5001: mct_pipeline_process_set:  STREAM-OFF on stream 0x30004 stream type=11
11-27 13:37:00.727   889 21284 I mm-camera: <IFACE >< INFO> 1799: iface_streamoff_to_thread: iface_streamoff_to_thread: E, session id = 3, user stream id = 4
11-27 13:37:00.727   889 21290 I mm-camera: <IFACE >< INFO> 2411: iface_streamoff: E, session_id 3 mct_stream_id = 4
11-27 13:37:00.727   889 21290 I mm-camera: <IFACE >< INFO> 12056: iface_util_get_user_streams_by_bundle: streamoff, first bundled streamoff all bindled streams!
11-27 13:37:00.727   889 21290 I mm-camera: <IFACE >< INFO> 452: iface_ispif_get_cfg_params_from_hw_streams: interace 0 active count = 2, skip stop ispif
11-27 13:37:00.727   889 21290 I mm-camera: <IFACE >< INFO> 452: iface_ispif_get_cfg_params_from_hw_streams: interace 0 active count = 1, skip stop ispif
11-27 13:37:00.729   889 21290 I mm-camera: <IFACE >< INFO> 2638: iface_streamoff: session_id = 3, active_streams = 0
11-27 13:37:00.729   889 21290 I mm-camera: <IFACE >< INFO> 2647: iface_streamoff: X
11-27 13:37:00.729   889 21284 I mm-camera: <IFACE >< INFO> 1825: iface_streamoff_to_thread: iface_streamoff_to_thread: X, session id = 3, user stream id = 4
11-27 13:37:00.731   889 21284 I mm-camera: <MCT   >< INFO> 5016: mct_pipeline_process_set:  STREAM-OFF success for stream 0x30004, stream type=11
11-27 13:37:00.731   889 21284 I mm-camera: <MCT   >< INFO> 5001: mct_pipeline_process_set:  STREAM-OFF on stream 0x30002 stream type=1
11-27 13:37:00.732   889 21284 I mm-camera: <IFACE >< INFO> 1799: iface_streamoff_to_thread: iface_streamoff_to_thread: E, session id = 3, user stream id = 2
11-27 13:37:00.732   889 21290 I mm-camera: <IFACE >< INFO> 2411: iface_streamoff: E, session_id 3 mct_stream_id = 2
11-27 13:37:00.732   889 21290 I mm-camera: <IFACE >< INFO> 12062: iface_util_get_user_streams_by_bundle: skip streamoff! left 1 bundled streamoff, mct stream id 2total bundled stream num = 3
11-27 13:37:00.732   889 21290 I mm-camera: <IFACE >< INFO> 2647: iface_streamoff: X
11-27 13:37:00.732   889 21284 I mm-camera: <IFACE >< INFO> 1825: iface_streamoff_to_thread: iface_streamoff_to_thread: X, session id = 3, user stream id = 2
11-27 13:37:00.732   889 21284 I mm-camera: <CPP   >< INFO> 4769: cpp_module_handle_streamoff_event: info: doing stream-off for identity 0x30002
11-27 13:37:00.732   889 21284 I mm-camera: <CPP   >< INFO> 4965: cpp_module_handle_streamoff_event: info: stream-off done for identity 0x30002 rc:0
11-27 13:37:00.733   889 21284 I mm-camera: <MCT   >< INFO> 5016: mct_pipeline_process_set:  STREAM-OFF success for stream 0x30002, stream type=1
11-27 13:37:00.733   889 21297 I mm-camera: <CPP   >< INFO> 371: cpp_hardware_set_clock: Set clock 256000000 BW avg 93312000 BW inst 93312000
11-27 13:37:00.733   889 21284 I mm-camera: <MCT   >< INFO> 5001: mct_pipeline_process_set:  STREAM-OFF on stream 0x30003 stream type=5
11-27 13:37:00.734   889 21284 I mm-camera: <IFACE >< INFO> 1799: iface_streamoff_to_thread: iface_streamoff_to_thread: E, session id = 3, user stream id = 3
11-27 13:37:00.734   889 21290 I mm-camera: <IFACE >< INFO> 2411: iface_streamoff: E, session_id 3 mct_stream_id = 3
11-27 13:37:00.734   889 21290 I mm-camera: <IFACE >< INFO> 12062: iface_util_get_user_streams_by_bundle: skip streamoff! left 0 bundled streamoff, mct stream id 3total bundled stream num = 3
11-27 13:37:00.734   889 21290 I mm-camera: <IFACE >< INFO> 2642: iface_streamoff: all bundled stream streamoff, clear hal bundled mask
11-27 13:37:00.734   889 21290 I mm-camera: <IFACE >< INFO> 2647: iface_streamoff: X
11-27 13:37:00.734   889 21284 I mm-camera: <IFACE >< INFO> 1825: iface_streamoff_to_thread: iface_streamoff_to_thread: X, session id = 3, user stream id = 3
11-27 13:37:00.735   889 21284 I mm-camera: <CPP   >< INFO> 4769: cpp_module_handle_streamoff_event: info: doing stream-off for identity 0x30003
11-27 13:37:00.736   889 21297 I mm-camera: <CPP   >< INFO> 371: cpp_hardware_set_clock: Set clock 256000000 BW avg 0 BW inst 0
11-27 13:37:00.736   889 21284 I mm-camera: <CPP   >< INFO> 4965: cpp_module_handle_streamoff_event: info: stream-off done for identity 0x30003 rc:0
11-27 13:37:00.744   889 21284 I mm-camera: <IFACE >< INFO> 10813: iface_util_release_resource: camif_cnt= 2, rdi_cnt= 1, used mask 30000
11-27 13:37:00.744   889 21284 I mm-camera: <IFACE >< INFO> 10813: iface_util_release_resource: camif_cnt= 1, rdi_cnt= 1, used mask 20000
11-27 13:37:00.744   889 21284 I mm-camera: <IFACE >< INFO> 10813: iface_util_release_resource: camif_cnt= 0, rdi_cnt= 1, used mask 20000
11-27 13:37:00.744   889 21284 I mm-camera: <IFACE >< INFO> 10813: iface_util_release_resource: camif_cnt= 0, rdi_cnt= 0, used mask 20000
11-27 13:37:00.744   889 21284 I mm-camera: <IFACE >< INFO> 3869: iface_destroy_hw: iface_destroy_hw: Destroy axi hw on VFE :1
11-27 13:37:00.744   889 21284 I mm-camera: <MCT   >< INFO> 231: stop_sof_check_thread: Stopping SOF timeout thread session =3
11-27 13:37:00.745   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 589: PDAF_PhaseDetection_deinit(0xf4620d70, 0xf4620d70)
11-27 13:37:00.745   889 21284 D         : <DEBUG> SLSI_PDAF_API: 543: void pd_detection_slsi_deinit()
11-27 13:37:00.770   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 596: destroy PD_Detection inst..:0x0
11-27 13:37:00.770   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 344: PDAF_CAMIF_deinit(0xf4632d20, 0xf4632d20)
11-27 13:37:00.770   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 194: free 1 pos buf(addr:0xe3280000)...
11-27 13:37:00.770   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 194: free 2 pos buf(addr:0xe2080000)...
11-27 13:37:00.771   889 21284 D         : <DEBUG> SLSI_PDAF_CAMIF: 521: destroy PDCAMIF inst..:0x0
11-27 13:37:00.771   889 21284 I mm-camera: <MCT   >< INFO> 5016: mct_pipeline_process_set:  STREAM-OFF success for stream 0x30003, stream type=5
11-27 13:37:00.771   889 21284 I mm-camera: <MCT   >< INFO> 5001: mct_pipeline_process_set:  STREAM-OFF on stream 0x30001 stream type=7
11-27 13:37:00.771   889 21284 I mm-camera: <MCT   >< INFO> 5016: mct_pipeline_process_set:  STREAM-OFF success for stream 0x30001, stream type=7
11-27 13:37:00.776   889 21284 I mm-camera: <MCT   >< INFO> 5081: mct_pipeline_process_set: Issuing DEL_STREAM on stream 0x30002 and stream type=1
11-27 13:37:00.776   889 21284 I mm-camera: <IFACE >< INFO> 680: iface_unreserve_sink_port: stream_id 2 mode 0
11-27 13:37:00.776   889 21284 I mm-camera: <ISP   >< INFO> 977: isp_port_check_caps_unreserve: ide 30002 port 0xefdf5f40
11-27 13:37:00.777   889 21284 I mm-camera: <MCT   >< INFO> 5104: mct_pipeline_process_set: Stream 0x30002 and stream type=1, successfully deleted
11-27 13:37:00.778   889 21284 I mm-camera: <MCT   >< INFO> 5081: mct_pipeline_process_set: Issuing DEL_STREAM on stream 0x30003 and stream type=5
11-27 13:37:00.778   889 21284 I mm-camera: <IFACE >< INFO> 680: iface_unreserve_sink_port: stream_id 3 mode 0
11-27 13:37:00.778   889 21284 I mm-camera: <ISP   >< INFO> 977: isp_port_check_caps_unreserve: ide 30003 port 0xefdf5f40
11-27 13:37:00.779   889 21284 I mm-camera: <MCT   >< INFO> 5104: mct_pipeline_process_set: Stream 0x30003 and stream type=5, successfully deleted
11-27 13:37:00.781   889 21284 I mm-camera: <MCT   >< INFO> 5081: mct_pipeline_process_set: Issuing DEL_STREAM on stream 0x30004 and stream type=11
11-27 13:37:00.781   889 21284 I mm-camera: <IFACE >< INFO> 680: iface_unreserve_sink_port: stream_id 4 mode 0
11-27 13:37:00.781   889 21284 I mm-camera: <ISP   >< INFO> 977: isp_port_check_caps_unreserve: ide 30004 port 0xefdf5f40
11-27 13:37:00.782   889 21284 I mm-camera: <MCT   >< INFO> 5104: mct_pipeline_process_set: Stream 0x30004 and stream type=11, successfully deleted
11-27 13:37:00.782   889 21284 I mm-camera: <MCT   >< INFO> 5081: mct_pipeline_process_set: Issuing DEL_STREAM on stream 0x30001 and stream type=7
11-27 13:37:00.782   889 21284 I mm-camera: <MCT   >< INFO> 5104: mct_pipeline_process_set: Stream 0x30001 and stream type=7, successfully deleted
11-27 13:37:00.783   889 21284 E mm-camera: <MCT   ><ERROR> 1487: mct_pipeline_send_ctrl_events: Daemon already died, not processing set params
11-27 13:37:00.783   889  1878 E mm-camera: <SHIM  ><ERROR> 423: mct_shimlayer_handle_parm: HAL event processing failed
11-27 13:37:00.783   889  1878 E mm-camera: <SHIM  ><ERROR> 599: mct_shimlayer_process_event: Failed to process HAL parm command
11-27 13:37:00.783   889  1878 E QCamera : <HAL><ERROR> ~QCamera3HardwareInterface: 817: set_parms failed for unconfigure
11-27 13:37:00.784   889  1878 I CameraKpiTag: [15746035ms] closeCamera (id 0) start
11-27 13:37:00.784   889  1878 I QCamera : <HAL><INFO> closeCamera: 1133: [KPI Perf]: E PROFILE_CLOSE_CAMERA camera id 0
11-27 13:37:00.784   889  1878 I mm-camera: <MCT   >< INFO> 310: mct_controller_destroy: Initiating destroy sequence for session = 3
11-27 13:37:00.785   889  1878 I mm-camera: <MCT   >< INFO> 328: mct_controller_destroy: serv_thread closed
11-27 13:37:00.786   889  1878 I mm-camera: <MCT   >< INFO> 343: mct_controller_destroy: bus_handler thread closed
11-27 13:37:00.786   889  1878 I mm-camera: <MCT   >< INFO> 5947: mct_pipeline_stop_session: Initiating stop_session on session 3
11-27 13:37:00.786   889  1878 I mm-camera: <MCT   >< INFO> 5081: mct_pipeline_process_set: Issuing DEL_STREAM on stream 0x3000f and stream type=10
11-27 13:37:00.786   889  1878 I mm-camera: <IFACE >< INFO> 680: iface_unreserve_sink_port: stream_id f mode 0
11-27 13:37:00.786   889  1878 I mm-camera: <ISP   >< INFO> 977: isp_port_check_caps_unreserve: ide 3000f port 0xefdf5f40
11-27 13:37:00.787   889  1878 D MotISP_VSTAB: destroyed
11-27 13:37:00.791   889  1878 I mm-camera: <MCT   >< INFO> 5104: mct_pipeline_process_set: Stream 0x3000f and stream type=10, successfully deleted
11-27 13:37:00.792   889 21367 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: sensor - E
11-27 13:37:00.796   889 21368 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: iface - E
11-27 13:37:00.804   889 21370 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: stats - E
11-27 13:37:00.804   889 21369 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: isp - E
11-27 13:37:00.804   889 21371 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: pproc - E
11-27 13:37:00.804   889 21369 I mm-camera: <ISP   >< INFO> 511: isp_module_stop_session: session id 3
11-27 13:37:00.804   889 21369 I mm-camera: <ISP   >< INFO> 552: isp_module_stop_session: warning: ISP resource is not freed on time!
11-27 13:37:00.805   889 21372 I mm-camera: <MCT   >< INFO> 5681: mct_pipeline_stop_session_thread: Stop module name: imglib - E
11-27 13:37:00.806   889 21372 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: imglib - X
11-27 13:37:00.806   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 5
11-27 13:37:00.807   889 21371 D QCameraQuadraCfa: img_algo_shutdown:151 : E
11-27 13:37:00.807   889 21371 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: pproc - X
11-27 13:37:00.807   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 4
11-27 13:37:00.816   889 21369 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: isp - X
11-27 13:37:00.816   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 3
11-27 13:37:00.816   889 21370 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: stats - X
11-27 13:37:00.816   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 2
11-27 13:37:00.817   889 21368 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: iface - X
11-27 13:37:00.817   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 1
11-27 13:37:00.840   889 21367 I mm-camera: <MCT   >< INFO> 5689: mct_pipeline_stop_session_thread: Stop module name: sensor - X
11-27 13:37:00.841   889  1878 I mm-camera: <MCT   >< INFO> 5969: mct_pipeline_stop_session: Modules left: 0
11-27 13:37:00.841   889  1878 I mm-camera: <MCT   >< INFO> 5979: mct_pipeline_stop_session: Stopped session 3 successfully
11-27 13:37:00.841   889  1878 I mm-camera: <MCT   >< INFO> 6285: mct_pipeline_destroy: E: session:3
11-27 13:37:00.841   889  1878 I mm-camera: <MCT   >< INFO> 6367: mct_pipeline_destroy: X: Pipeline destroyed successfully session =3
11-27 13:37:00.841   889  1878 I mm-camera: <MCT   >< INFO> 422: mct_controller_destroy: X Successfully closed mct_controller session 3
11-27 13:37:00.842   894   916 I SDM     : ResourceImpl::SetMaxBandwidthMode: new bandwidth mode=0
11-27 13:37:00.843  1083  1083 I CameraProviderManager: Camera device device@3.2/legacy/0 torch status is now AVAILABLE_OFF
11-27 13:37:00.843  1083  1083 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=1
11-27 13:37:00.844  1083  1083 I CameraProviderManager: Camera device device@3.2/legacy/1 torch status is now AVAILABLE_OFF
11-27 13:37:00.844  1083  1083 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=1, newStatus=1
11-27 13:37:00.846   889  1878 I QCamera : <HAL><INFO> closeCamera: 1179: [KPI Perf]: X PROFILE_CLOSE_CAMERA camera id 0, rc: 0
11-27 13:37:00.846   889  1878 I CameraKpiTag: [15746097ms] closeCamera (id 0) stop (61ms)
11-27 13:37:00.846   913   962 E ANDR-PERF-OPTSHANDLER: Write -1:-1 into /sys/module/msm_performance/parameters/max_cpus
11-27 13:37:00.859   889  1878 I QCamera : <HAL><INFO> close_camera_device: 13591: [KPI Perf]: X
11-27 13:37:00.859   889  1878 I QCameraHalWatchdog: Stopped Watchdog Thread (135ms)[close_camera_device]
11-27 13:37:00.859   889  1878 I CameraKpiTag: [15746110ms] close_camera_device stop (136ms)
11-27 13:37:00.859  1083  1083 E Camera3-Stream: returnBuffer: Stream 1: Returning an unknown buffer.
11-27 13:37:00.859  1083  1083 E Camera3-Device: Can't return buffer to its stream: Invalid argument (-22)
11-27 13:37:00.859  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 2
11-27 13:37:00.860  1083  1083 E Camera3-Stream: returnBuffer: Stream 2: Returning an unknown buffer.
11-27 13:37:00.860  1083  1083 E Camera3-Device: Can't return buffer to its stream: Invalid argument (-22)
11-27 13:37:00.860  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 1
11-27 13:37:00.860  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 2
11-27 13:37:00.860  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 1
11-27 13:37:00.860  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 1
11-27 13:37:00.861  1083  1083 W Camera3-OutputStream: A frame is dropped for stream 2
11-27 13:37:00.862  1083  1083 I CameraLatencyHistogram: Stream 1 dequeueBuffer latency histogram (4) samples:
11-27 13:37:00.863  1083  1083 I CameraLatencyHistogram:         5     10     15     20     25     30     35     40     45    inf (max ms)
11-27 13:37:00.863  1083  1083 I CameraLatencyHistogram:      100.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00 (%)
11-27 13:37:00.864  1083  1083 I CameraLatencyHistogram: Stream 2 dequeueBuffer latency histogram (4) samples:
11-27 13:37:00.864  1083  1083 I CameraLatencyHistogram:         5     10     15     20     25     30     35     40     45    inf (max ms)
11-27 13:37:00.864  1083  1083 I CameraLatencyHistogram:      100.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00 (%)
11-27 13:37:00.865  1083  1083 I Camera3-Device: disconnect: X
11-27 13:37:00.865  1083  1083 I Camera3-Device: disconnect: E
11-27 13:37:00.867 20287 20370 I CameraDevices: Camera #0: Available!
11-27 13:37:00.868  1083  1083 I CameraService: disconnect: Disconnected client for camera 0 for PID 20287
11-27 13:37:00.966   954   954 D SurfaceFlinger: Backpressure trigger, skipping transaction & refresh!
11-27 13:37:02.031  1890  2249 D BatteryService: uevent={POWER_SUPPLY_DP_DM=0, POWER_SUPPLY_VOLTAGE_QNOVO=-22, POWER_SUPPLY_VOLTAGE_NOW=4399646, POWER_SUPPLY_SW_JEITA_ENABLED=0, POWER_SUPPLY_HEALTH=Good, POWER_SUPPLY_TECHNOLOGY=Li-ion, POWER_SUPPLY_CHARGER_TEMP_MAX=812, SEQNUM=5959, POWER_SUPPLY_INPUT_CURRENT_LIMITED=1, POWER_SUPPLY_STATUS=Charging, POWER_SUPPLY_BATTERY_CHARGING_ENABLED=1, POWER_SUPPLY_CURRENT_MAX=3000000, POWER_SUPPLY_CAPACITY=100, DEVPATH=/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-00/800f000.qcom,spmi:qcom,pm660@0:qcom,qpnp-smb2/power_supply/battery, POWER_SUPPLY_CHARGE_DONE=0, POWER_SUPPLY_CHARGE_TYPE=Taper, POWER_SUPPLY_CHARGER_TEMP=336, POWER_SUPPLY_CHARGE_RATE=Normal, POWER_SUPPLY_CURRENT_QNOVO=-22, POWER_SUPPLY_CURRENT_NOW=-321288, POWER_SUPPLY_SYSTEM_TEMP_LEVEL=0, POWER_SUPPLY_PRESENT=1, POWER_SUPPLY_PARALLEL_DISABLE=0, SUBSYSTEM=power_supply, POWER_SUPPLY_SET_SHIP_MODE=0, POWER_SUPPLY_TEMP=290, ACTION=change, POWER_SUPPLY_RERUN_AICL=0, POWER_SUPPLY_AGE=91, POWER_SUPPLY_NAME=battery, POWER_SUPPLY_VOLTAGE_MAX=-22, POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=3000000, POWER_SUPPLY_CHARGE_COUNTER=2861824, POWER_SUPPLY_STEP_CHARGING_ENABLED=0, POWER_SUPPLY_NUM_SYSTEM_TEMP_LEVELS=7, POWER_SUPPLY_DIE_HEALTH=Cool, POWER_SUPPLY_INPUT_SUSPEND=0}
11-27 13:37:02.043  2778  2939 D HeadsetStateMachine: Disconnected process message: 10, size: 0
11-27 13:37:02.043  2778  2939 D HeadsetStateMachine: Enter processIntentBatteryChanged()
11-27 13:37:02.043  2778  2939 D HeadsetStateMachine: Exit processIntentBatteryChanged()
11-27 13:37:02.043  2778  2939 D HeadsetStateMachine: Exit Disconnected processMessage()
11-27 13:37:02.044  2564  2564 D QtiCarrierConfigHelper: WARNING, no carrier configs on phone Id: 0
11-27 13:37:02.392   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:02.395  2483  2614 I QCNEJ   : |CORE| CNE received action RSSI/Link Changed events: android.net.wifi.RSSI_CHANGED
11-27 13:37:02.395  2483  2614 D QCNEJ   : |CORE| Updating RSSI: -59
11-27 13:37:02.403  7193  7247 I CarrierServices: [334] bur.a: FiST: Wifi connectivity status true
11-27 13:37:02.407  7193  7247 W CarrierServices: [334] bax.a: This RcsEngine is stale. Ignore Connectivity event on this.
11-27 13:37:02.408  7193  7247 W CarrierServices: [334] bax.a: This RcsEngine is stale. Ignore Connectivity event on this.
11-27 13:37:02.410  7193  7247 I CarrierServices: [334] buw.d: Connected state: [1], networkType: [WIFI]
11-27 13:37:02.965   886  1492 D NativeSensors: CapSensor:  mPendingEvent.distance=1.000000
11-27 13:37:05.395   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:08.507  1890  7359 I ActivityManager: Killing 19055:com.android.providers.calendar/u0a16 (adj 906): empty #17
11-27 13:37:11.403   955   968 I chatty  : uid=0(root) /vendor/bin/mmid identical 2 lines
11-27 13:37:14.406   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:16.071 20287 20292 I zygote64: Do full code cache collection, code=1005KB, data=664KB
11-27 13:37:16.080 20287 20292 I zygote64: After code cache collection, code=993KB, data=573KB
11-27 13:37:17.410   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:17.629   904   935 I ADSPD   : Watchdog 2 new value: 00180217 Last Exp Value: ffffffff
11-27 13:37:17.630   904   935 I ADSPD   : Watchdog 3 new value: 00180212 Last Exp Value: ffffffff
11-27 13:37:20.413   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:23.417   955   968 I chatty  : uid=0(root) /vendor/bin/mmid identical 1 line
11-27 13:37:26.421   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:29.291  1083  1083 I Camera2ClientBase: Closed Camera 0. Client was: com.boss.sportivity (PID 20287, UID 10194)
11-27 13:37:29.292  1083  1083 I Camera2ClientBase: Closed Camera 0. Client was: com.boss.sportivity (PID 20287, UID 10194)
11-27 13:37:29.425   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:35.431   955   968 I chatty  : uid=0(root) /vendor/bin/mmid identical 2 lines
11-27 13:37:38.434   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:39.141  2778  2939 D HeadsetStateMachine: Disconnected process message: 10, size: 0
11-27 13:37:39.142  2778  2939 D HeadsetStateMachine: Enter processIntentBatteryChanged()
11-27 13:37:39.142  2778  2939 D HeadsetStateMachine: Exit processIntentBatteryChanged()
11-27 13:37:39.142  2778  2939 D HeadsetStateMachine: Exit Disconnected processMessage()
11-27 13:37:39.143  2564  2564 D QtiCarrierConfigHelper: WARNING, no carrier configs on phone Id: 0
11-27 13:37:39.143  1104  2470 V LocSvc_HIDL_IzatProvider: [onLocationChanged][67] [HS] =>>>> [HC]
11-27 13:37:39.144  1890  2259 V LocSvc_HIDL_IzatProvider_jni: [onLocationChanged][136] [HC] <<= [HS]
11-27 13:37:39.206   954   954 D SurfaceFlinger: Backpressure trigger, skipping transaction & refresh!
11-27 13:37:41.090  1890  2249 D BatteryService: uevent={POWER_SUPPLY_DP_DM=0, POWER_SUPPLY_VOLTAGE_QNOVO=-22, POWER_SUPPLY_VOLTAGE_NOW=4398426, POWER_SUPPLY_SW_JEITA_ENABLED=0, POWER_SUPPLY_HEALTH=Good, POWER_SUPPLY_TECHNOLOGY=Li-ion, POWER_SUPPLY_CHARGER_TEMP_MAX=812, SEQNUM=5963, POWER_SUPPLY_INPUT_CURRENT_LIMITED=1, POWER_SUPPLY_STATUS=Charging, POWER_SUPPLY_BATTERY_CHARGING_ENABLED=1, POWER_SUPPLY_CURRENT_MAX=3000000, POWER_SUPPLY_CAPACITY=100, DEVPATH=/devices/soc/800f000.qcom,spmi/spmi-0/spmi0-00/800f000.qcom,spmi:qcom,pm660@0:qcom,qpnp-smb2/power_supply/battery, POWER_SUPPLY_CHARGE_DONE=0, POWER_SUPPLY_CHARGE_TYPE=Taper, POWER_SUPPLY_CHARGER_TEMP=332, POWER_SUPPLY_CHARGE_RATE=Normal, POWER_SUPPLY_CURRENT_QNOVO=-22, POWER_SUPPLY_CURRENT_NOW=-275390, POWER_SUPPLY_SYSTEM_TEMP_LEVEL=0, POWER_SUPPLY_PRESENT=1, POWER_SUPPLY_PARALLEL_DISABLE=0, SUBSYSTEM=power_supply, POWER_SUPPLY_SET_SHIP_MODE=0, POWER_SUPPLY_TEMP=290, ACTION=change, POWER_SUPPLY_RERUN_AICL=0, POWER_SUPPLY_AGE=91, POWER_SUPPLY_NAME=battery, POWER_SUPPLY_VOLTAGE_MAX=-22, POWER_SUPPLY_CONSTANT_CHARGE_CURRENT_MAX=3000000, POWER_SUPPLY_CHARGE_COUNTER=2864671, POWER_SUPPLY_STEP_CHARGING_ENABLED=0, POWER_SUPPLY_NUM_SYSTEM_TEMP_LEVELS=7, POWER_SUPPLY_DIE_HEALTH=Cool, POWER_SUPPLY_INPUT_SUSPEND=0}
11-27 13:37:41.102  2564  2564 D QtiCarrierConfigHelper: WARNING, no carrier configs on phone Id: 0
11-27 13:37:41.103  2778  2939 D HeadsetStateMachine: Disconnected process message: 10, size: 0
11-27 13:37:41.103  2778  2939 D HeadsetStateMachine: Enter processIntentBatteryChanged()
11-27 13:37:41.103  2778  2939 D HeadsetStateMachine: Exit processIntentBatteryChanged()
11-27 13:37:41.103  2778  2939 D HeadsetStateMachine: Exit Disconnected processMessage()
11-27 13:37:41.438   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:44.442   955   968 I chatty  : uid=0(root) /vendor/bin/mmid identical 1 line
11-27 13:37:47.445   955   968 I mmid    : select timeout: wait for receiving msg
11-27 13:37:47.634   904   935 I ADSPD   : Watchdog 2 new value: 00180dcf Last Exp Value: ffffffff
11-27 13:37:47.640   904   935 I ADSPD   : Watchdog 3 new value: 00180dcb Last Exp Value: ffffffff
11-27 13:37:50.451   955   968 I mmid    : select timeout: wait for receiving msg

Camera Device

11-27 13:36:55.301 20287 20369 I ReactNativeJS:     "formats": [
11-27 13:36:55.301 20287 20369 I ReactNativeJS:       {
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "autoFocusSystem": "contrast-detection",
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "supportsVideoHdr": false,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "fieldOfView": 79.64318196593833,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "pixelFormats": [
11-27 13:36:55.301 20287 20369 I ReactNativeJS:           "yuv",
11-27 13:36:55.301 20287 20369 I ReactNativeJS:           "native"
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         ],
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "videoStabilizationModes": [
11-27 13:36:55.301 20287 20369 I ReactNativeJS:           "off",
11-27 13:36:55.301 20287 20369 I ReactNativeJS:           "standard",
11-27 13:36:55.301 20287 20369 I ReactNativeJS:           "off"
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         ],
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "maxZoom": 8,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "supportsPhotoHdr": false,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "photoWidth": 4032,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "minExposure": -72,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "supportsDepthCapture": false,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "maxISO": 3200,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "minISO": 50,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "minFps": 1,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "videoWidth": 3840,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "maxExposure": 72,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "videoHeight": 2160,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "maxFps": 30,
11-27 13:36:55.301 20287 20369 I ReactNativeJS:         "photoHeight": 3024
11-27 13:36:55.301 20287 20369 I ReactNativeJS:       },

Device

Motorola g5

VisionCamera Version

3.6.10

Can you reproduce this issue in the VisionCamera Example app?

Yes, I can reproduce the same issue in the Example app here

Additional information

SK-bool commented 9 months ago

Removed the following line(446) : captureRequest.setZoom(config.zoom, cameraCharacteristics) in node_modules\react-native-vision-camera\android\src\main\java\com\mrousavy\camera\core\CameraSession.kt

Which fixed my camera problem but when scanning a qr code the app crashes(sometimes). Yes I can reproduce.

MicaelaWaigel commented 9 months ago

Same problem here, in devices like Motorola g6 plus (Android 9) (always black screen), Samsung Galaxy s21 FE (Android 13) but in this only when bring the app from background y open the camera again.

Camera.onError(session/camera-has-been-disconnected): [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID [session/camera-has-been-disconnected: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID]

rodgomesc commented 9 months ago

@MicaelaWaigel i think this is because we are not propertly closing the camera session when it goes to background, need to double check, if someone have more time than me to test this theory please go ahead

MicaelaWaigel commented 9 months ago

@MicaelaWaigel i think this is because we are not propertly closing the camera session when it goes to background, need to double check, if someone have more time than me to test this theory please go ahead

We set the isActive according the isFocused and appState, so when the app is in background after a while the error Camera.onError(session/camera-has-been-disconnected): [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: CAMERA_IS_DISABLED_BY_ANDROID occurs. When the appState changed to active, then the error is Camera.onError(unknown/unknown): [unknown/unknown] CameraDevice was already closed [unknown/unknown: [unknown/unknown] CameraDevice was already closed]

mrousavy commented 8 months ago

Hey! Thanks for reporting this issue.

I've been working the past days on making sure the Camera lifecycle is safely handled and released when needed to make sure this crash doesn't occur anymore.

I just created a PR for this - can you please this to see if that fixes the issue for you? https://github.com/mrousavy/react-native-vision-camera/pull/2339

If this fixes your issue, please consider 💖 sponsoring me on GitHub 💖 to support me / thank me for building VisionCamera and continuously improving it.

If this does not fix your issue, please clone the repo, check out the branch fix/blackscreen (the PR above), run the Example app, reproduce your issue there and share the adb logcat logs with me (upload to pastebin or gist) so I can investigate this further.

Thank you! 🙏