react-native-vision-camera icon indicating copy to clipboard operation
react-native-vision-camera copied to clipboard

🐛 Using `pixelFormat="yuv"` in Frame Processor crashes on Samsung A53

Open danieloprado opened this issue 1 year ago • 19 comments

What's happening?

I want to use the frameProcessor with pixelFormat='yuv' but the app crashes.

Bundle output:

 BUNDLE  ./index.js 

 LOG  Running "TracersApp" with {"rootTag":11}
 LOG  Loading react-native-worklets-core...
 LOG  Worklets loaded successfully
 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]

Reproduceable Code

import { memo } from 'react';
import { StyleSheet } from 'react-native';
import { Camera, useCameraDevice, useFrameProcessor } from 'react-native-vision-camera';

import { useIsFocused } from '@react-navigation/native';

const CameraVision = () => {
  const backCamera = useCameraDevice('back');
  const isFocused = useIsFocused();

  const frameProcessor = useFrameProcessor(frame => {
    'worklet';
    console.log('Frame format: ' + frame.pixelFormat);
  }, []);

  if (!backCamera) return;

  return (
    <Camera
      style={styles.camera}
      frameProcessor={frameProcessor}
      pixelFormat='yuv'
      onError={err => console.error(err)}
      device={backCamera}
      isActive={isFocused}
    />
  );
};

const styles = StyleSheet.create({
  camera: {
    height: '100%',
    width: '100%',
    position: 'absolute'
  }
});

export default memo(CameraVision);

Relevant log output

2023-10-06 10:35:50.036 31513-31525 ExynosCameraSec         [email protected]_64  E  Build Date is (Sep 15 2023) (05:43:51) Process 64 bit
2023-10-06 10:35:50.047 31513-31912 vendor.sam...service_64 [email protected]_64  E  [CAM(-1)][]-(m_readEfsFile[364]):ERR :failed to open sysfs entry
2023-10-06 10:35:50.050 31513-31912 vendor.sam...service_64 [email protected]_64  E  [CAM(-1)][]-(m_executeIoctlCommand[237]):failed to ioctl: (22) IS_CAMINFO_IOCTL_COMMAND (14 - Bad address)
2023-10-06 10:35:50.050 31513-31912 vendor.sam...service_64 [email protected]_64  E  [CAM(-1)][]-(setCameraEfsData[137]):failed to communicate kernel: (2)
2023-10-06 10:35:50.097  1007-5221  Camera2-Fr...cessorBase cameraserver                         E  FrameProcessorBase: created
2023-10-06 10:35:50.097  1007-5221  Camera2-Fr...cessorBase cameraserver                         E  registerListener: Registering listener for frame id range 0 - 2147483647
2023-10-06 10:35:50.122  2882-2882  SecHAL                  [email protected]  E  nfc_hal_write: [Cmd]Send EVT data_sending_flag = true, return size=4!!
2023-10-06 10:35:50.147  2882-3967  SecHAL                  [email protected]  E  nfc_data_callback: [Cmd]Received a response packet : data_sending_flag = false!!
2023-10-06 10:35:50.148  2734-3932  libnfc_nci              com.android.nfc                      E  [ERROR:nfc_ncif.cc(1462)] nfc_ncif_proc_deactivate - evt_data.deactivate.reason 0, nfc_cb.deact_reason = 2
2023-10-06 10:35:50.156  2882-2882  SecHAL                  [email protected]  E  nfc_hal_write: [Cmd]Send EVT data_sending_flag = true, return size=a!!
2023-10-06 10:35:50.160  2882-3967  SecHAL                  [email protected]  E  nfc_data_callback: [Cmd]Received a response packet : data_sending_flag = false!!
2023-10-06 10:35:50.170 31513-31525 ExynosCameraSec         [email protected]_64  E  [CAM(0)][Back_0]-(m_enumStreamInfo[14294]):supported image format(0x22) usage(0x20933) stream_type(0)
2023-10-06 10:35:50.309  1007-5221  VendorTagDescriptor     cameraserver                         E  lookupTag: Tag name 'requestHint' does not exist.
2023-10-06 10:35:50.310  1007-31918 Camera3-Device          cameraserver                         E  updateSessionParameters: Session parameter tag id 0x8000000e changed
2023-10-06 10:35:50.312  1188-1411  RequestInjectorService  system_server                        E  Non acceptable state 1
2023-10-06 10:35:50.319 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_3AA_DRC]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.319 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_PROCESSED_RAW]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.320 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_3AA_FD]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.320 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_3AA_CAPTURE_MAIN]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.320 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_3AA_CAPTURE_OPT]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_ISP_NOISE]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_ISP_NRDS]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][MCFP_DST_IMG_REPROCESSING]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_MCSC_CAPTURE_THUMBNAIL]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_MCSC_CAPTURE_MAIN]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_MCSC_CAPTURE_YUV_0]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_ISP_DRC_GAIN]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.321 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][MCFP_SRC_PREV_IMG_REPROCESSING]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.322 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_ISP_SVHIST]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.322 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][ISP_LME_REPROCESSING]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.322 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][REPROCESSING_ISP_DRC_GRID]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.323 31513-31525 libcsc                  [email protected]_64  E  csc_deinit:: unsupported csc_hw_type
2023-10-06 10:35:50.323 31513-31525 libcsc                  [email protected]_64  E  csc_deinit:: unsupported csc_hw_type
2023-10-06 10:35:50.323 31513-31525 libcsc                  [email protected]_64  E  csc_deinit:: unsupported csc_hw_type
2023-10-06 10:35:50.324 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][LME_DST_ME_REPROCESSING]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.324 31513-31525 ExynosCameraNode        [email protected]_64  E  [CAM(0)][LME_SW_DST_REPROCESSING]-(close[226]):fd(-1) is invalid skip close
2023-10-06 10:35:50.361 31513-31525 ExynosCameraSec         [email protected]_64  E  [CAM(0)][Back_0]-(m_enumStreamInfo[14294]):supported image format(0x22) usage(0x20933) stream_type(0)
2023-10-06 10:35:50.430 31513-31530 SecCameraUtil           [email protected]_64  E  [CAM(-1)][]-(getDualCalFileName[1217]):Invalid Scenario! fail
2023-10-06 10:35:50.430 31513-31530 ExynosCameraSec         [email protected]_64  E  [CAM(0)][Back_0]-(m_readAllDualCalData[25785]):Fail Read DualCal(0 0)(-1)!!
2023-10-06 10:35:50.610 31513-31972 ExynosCame...agerVendor [email protected]_64  E  [CAM(0)][PREVIEW_CB_STREAM_BUF]-(m_checkBufferInfo[2089]):[B0 P0]fd 255 size 11945216 < 17915904
2023-10-06 10:35:50.610 31513-31972 ExynosCame...agerVendor [email protected]_64  E  [CAM(0)][PREVIEW_CB_STREAM_BUF]-(m_checkBufferInfo[2101]):[B0]format 105 imageSize 3456x3456 usage 131331|131331 ionFlags 0 batchSize 1
2023-10-06 10:35:50.611 31513-31972 ExynosCame...agerVendor [email protected]_64  A  ASSERT(m_checkBufferInfo):[B0]Invalid Service Buffer!
2023-10-06 10:35:50.611 31513-31972 libc                    [email protected]_64  A  Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 31972 (FrameFactorySta), pid 31513 ([email protected])
2023-10-06 10:35:50.673 31977-31977 DEBUG                   pid-31977                            E  failed to read process info: failed to open /proc/31513
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Build fingerprint: 'samsung/a53xnsxx/a53x:13/TP1A.220624.014/A536EXXS7CWI2:user/release-keys'
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Revision: '7'
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  ABI: 'arm64'
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Processor: '6'
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Timestamp: 2023-10-06 10:35:50.672831613-0300
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Process uptime: 0s
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  Cmdline: /vendor/bin/hw/[email protected]_64
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  pid: 31513, tid: 31972, name: FrameFactorySta  >>> /vendor/bin/hw/[email protected]_64 <<<
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  uid: 1047
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  tagged_addr_ctrl: 0000000000000001 (PR_TAGGED_ADDR_ENABLE)
2023-10-06 10:35:50.732 31977-31977 DEBUG                   pid-31977                            A  signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A  Abort message: 'ASSERT(m_checkBufferInfo):[B0]Invalid Service Buffer!'
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x0  0000000000000000  x1  0000000000007ce4  x2  0000000000000006  x3  0000007460a46ba0
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x4  6d485c2f415a3928  x5  6d485c2f415a3928  x6  6d485c2f415a3928  x7  7f7f7f7f7f7f7f7f
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x8  00000000000000f0  x9  000000771ff84ad0  x10 0000000000000001  x11 000000771ffc2ffc
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x12 0000007460a46b60  x13 0000000000000036  x14 0000000000000000  x15 00000020928a1d9a
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x16 0000007720027d60  x17 0000007720004f20  x18 0000007446506000  x19 0000000000007b19
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x20 0000000000007ce4  x21 00000000ffffffff  x22 00000074844649e3  x23 0000000000000001
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x24 0000000000000000  x25 0000000000000000  x26 0000007460a47e90  x27 b40000753dec2210
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      x28 0000000000000002  x29 0000007460a46c20
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A      lr  000000771ffb4b7c  sp  0000007460a46b80  pc  000000771ffb4ba8  pst 0000000000001000
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A  backtrace:
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #00 pc 0000000000051ba8  /apex/com.android.runtime/lib64/bionic/libc.so (abort+164) (BuildId: 8b687b4d600e1faa82af5a5197e82129)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #01 pc 0000000000006330  /system/lib64/liblog.so (__android_log_default_aborter+12) (BuildId: 28ea5154585a4fc544f1324fcd9ea010)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #02 pc 0000000000006e10  /system/lib64/liblog.so (__android_log_assert+308) (BuildId: 28ea5154585a4fc544f1324fcd9ea010)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #03 pc 000000000016c450  /vendor/lib64/libexynoscamera3.so (android::ServiceExynosCameraBufferManager::m_checkBufferInfo(native_handle const*, android::ExynosCameraBuffer const*)+648) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #04 pc 000000000016bf1c  /vendor/lib64/libexynoscamera3.so (android::ServiceExynosCameraBufferManager::getBuffer(int*, android::EXYNOS_CAMERA_BUFFER_POSITION, android::ExynosCameraBuffer*)+1196) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #05 pc 00000000001750bc  /vendor/lib64/libexynoscamera3.so (android::ExynosCameraBufferSupplier::getBuffer(android::buffer_manager_tag, android::ExynosCameraBuffer*)+340) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #06 pc 0000000000279f94  /vendor/lib64/libexynoscamera3.so (android::ExynosCamera::m_setupPreviewFactoryBuffers(android::sp<android::ExynosCameraRequest>, android::sp<android::ExynosCameraFrame>, android::ExynosCameraFrameFactory*)+3076) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #07 pc 00000000002756f4  /vendor/lib64/libexynoscamera3.so (android::ExynosCamera::m_previewFrameHandler(android::sp<android::ExynosCameraRequest>, android::ExynosCameraFrameFactory*, android::FRAME_TYPE, int, android::DynamicShotInfo const*, int)+13540) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #08 pc 0000000000271370  /vendor/lib64/libexynoscamera3.so (android::ExynosCamera::m_createPreviewFrameFunc(android::Request_Sync_Type, bool)+2144) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #09 pc 00000000001ed854  /vendor/lib64/libexynoscamera3.so (android::ExynosCamera::m_frameFactoryStartThreadFunc()+3548) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #10 pc 000000000012a098  /vendor/lib64/libexynoscamera3.so (ExynosCameraThread<android::ExynosCameraStreamThread>::threadLoop()+40) (BuildId: 971a3c773c22796833ad8fc36ffca08d)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #11 pc 00000000000120ac  /apex/com.android.vndk.v31/lib64/libutils.so (android::Thread::_threadLoop(void*)+260) (BuildId: 9764a66bf33c6a777e7fbeaa9b94bde1)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #12 pc 0000000000011964  /apex/com.android.vndk.v31/lib64/libutils.so (thread_data_t::trampoline(thread_data_t const*)+404) (BuildId: 9764a66bf33c6a777e7fbeaa9b94bde1)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #13 pc 00000000000b6668  /apex/com.android.runtime/lib64/bionic/libc.so (__pthread_start(void*)+208) (BuildId: 8b687b4d600e1faa82af5a5197e82129)
2023-10-06 10:35:50.733 31977-31977 DEBUG                   pid-31977                            A        #14 pc 00000000000532cc  /apex/com.android.runtime/lib64/bionic/libc.so (__start_thread+64) (BuildId: 8b687b4d600e1faa82af5a5197e82129)
2023-10-06 10:35:50.746   622-622   tombstoned              tombstoned                           E  Tombstone written to: tombstone_07
2023-10-06 10:35:50.757  1188-1377  NativeTombstoneManager  system_server                        E  Tombstone's UID (1047) not an app, ignoring
2023-10-06 10:35:50.840  1007-31918 HidlCamera3-Device      cameraserver                         E  processBatchCaptureRequests: Transaction error: Status(EX_TRANSACTION_FAILED): 'DEAD_OBJECT: '
2023-10-06 10:35:50.840  1007-31918 Camera3-Device          cameraserver                         E  Camera 0: sendRequestsBatch: RequestThread: Unable to submit capture request 3 to HAL device: Broken pipe (-32)
2023-10-06 10:35:50.840  1007-31918 CameraDeviceClient      cameraserver                         E  notifyError: pid=31736, errorCode=1, errorStreamId=-1, frameNumber=0
2023-10-06 10:35:50.840  1007-31918 CameraDeviceClient      cameraserver                         E  notifyError: pid=31736, skipClientNotification=false
2023-10-06 10:35:50.841  1007-1139  CameraDeviceClient      cameraserver                         E  notifyError: pid=31736, errorCode=0, errorStreamId=-1, frameNumber=0
2023-10-06 10:35:50.841  1007-1139  CameraDeviceClient      cameraserver                         E  notifyError: pid=31736, skipClientNotification=false
2023-10-06 10:35:50.841  1007-1139  CameraDeviceClient      cameraserver                         E  Disconnect from CameraDeviceClient
2023-10-06 10:35:50.841  1007-1139  Camera2-Fr...cessorBase cameraserver                         E  removeListener: 
2023-10-06 10:35:50.842 31736-31900 CameraManager           br.app.tracers                       E  Camera 0: Error! 4
2023-10-06 10:35:50.844 31736-31900 CameraView              br.app.tracers                       E  invokeOnError(...):
2023-10-06 10:35:50.850  1007-5221  CameraDeviceClient      cameraserver                         E  Disconnect from CameraDeviceClient
2023-10-06 10:35:50.882 31736-31834 ReactNativeJS           br.app.tracers                       E  { [session/camera-has-been-disconnected: [session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR]
                                                                                                      name: 'session/camera-has-been-disconnected',
                                                                                                      _code: 'session/camera-has-been-disconnected',
                                                                                                      _message: '[session/camera-has-been-disconnected] The given Camera device (id: 0) has been disconnected! Error: UNKNOWN_CAMERA_DEVICE_ERROR',
                                                                                                      _cause: undefined }
2023-10-06 10:35:50.909 31986-31989 UniPlugin               pid-31986                            E  get_plugin_handle, Couldn't load the library(libdualpreview_interface.so): dlopen failed: library "libdualpreview_interface.so" not found
2023-10-06 10:35:50.909 31986-31989 ExynosCameraSec         pid-31986                            E  [FUSION] PREVIEW load failed!!
2023-10-06 10:35:50.910 31986-31989 UniPlugin               pid-31986                            E  get_plugin_handle, Couldn't load the library(libdualcapture_interface.so): dlopen failed: library "libdualcapture_interface.so" not found
2023-10-06 10:35:50.910 31986-31989 ExynosCameraSec         pid-31986                            E  [FUSION] CAPTURE load failed!!
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-4)
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-38)
2023-10-06 10:35:50.913 31986-31989 SecCameraUtil           pid-31986                            E  m_process got failed for camID(0), ret(-38)!!!
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-4)
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-38)
2023-10-06 10:35:50.913 31986-31989 SecCameraUtil           pid-31986                            E  m_process got failed for camID(1), ret(-38)!!!
2023-10-06 10:35:50.913 31986-31989 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(m_executeIoctlCommand[237]):failed to ioctl: (8) IS_CAMINFO_IOCTL_COMMAND (22 - Invalid argument)
2023-10-06 10:35:50.913 31986-31989 vendor.sam...service_64 pid-31986                            E  failed to communicate kernel: (20)
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  secCameraDeviceInfo->getSec2LsiModuleInfo() got failed (-1) 
2023-10-06 10:35:50.913 31986-31989 SecCameraC...Conversion pid-31986                            E  Standard Cal not supported for internalCamID(2)
2023-10-06 10:35:50.913 31986-31989 SecCameraUtil           pid-31986                            E  m_process got failed for camID(52), ret(-38)!!!
2023-10-06 10:35:50.914 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-4)
2023-10-06 10:35:50.914 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-38)
2023-10-06 10:35:50.914 31986-31989 SecCameraUtil           pid-31986                            E  m_process got failed for camID(58), ret(-38)!!!
2023-10-06 10:35:50.914 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-4)
2023-10-06 10:35:50.914 31986-31989 SecCameraC...Conversion pid-31986                            E  Failed to convert AWB (-38)
2023-10-06 10:35:50.914 31986-31989 SecCameraUtil           pid-31986                            E  m_process got failed for camID(60), ret(-38)!!!
2023-10-06 10:35:50.915 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (0)
2023-10-06 10:35:50.916 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (1)
2023-10-06 10:35:50.916 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (4)
2023-10-06 10:35:50.916 31986-31986 ExynosCame...rterVendor pid-31986                            E  [CAM(-1)][]-(m_createVendorSpecialFunctionsAvailableFpsRanges[7336]):specialFunctionsfpsRangesList is NULL
2023-10-06 10:35:50.917 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (1)
2023-10-06 10:35:50.917 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (1)
2023-10-06 10:35:50.917 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 20/-1 camInfoIndex(-1)
2023-10-06 10:35:50.917 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 21/-1 camInfoIndex(-1)
2023-10-06 10:35:50.917 31986-31986 Unihal                  pid-31986                            E  TagManager.cpp: UpdateCameraCharacteristics: 950: Failed(1) to add characteristic entry for index 0x800c0000, 0xb4000077d35eaad0, count 5 allocSize 5!
2023-10-06 10:35:50.917 31986-31986 Unihal                  pid-31986                            E  TagManager.cpp: UpdateCameraCharacteristics: 959: Status: CameraId(21) Current count(2) size(24) capa 5 24 
2023-10-06 10:35:50.917 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 22/-1 camInfoIndex(-1)
2023-10-06 10:35:50.917 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (0)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 40/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 41/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 50/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 51/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[183]):failed to load awb master addr by cameraId (2)
2023-10-06 10:35:50.918 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (2)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 53/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 54/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 55/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 56/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 57/-1 camInfoIndex(-1)
2023-10-06 10:35:50.918 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (4)
2023-10-06 10:35:50.919 31986-31986 ExynosCame...rterVendor pid-31986                            E  [CAM(-1)][]-(m_createVendorSpecialFunctionsAvailableFpsRanges[7336]):specialFunctionsfpsRangesList is NULL
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 59/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 vendor.sam...service_64 pid-31986                            E  [CAM(-1)][]-(getAwbData[190]):failed to load awb module addr by cameraId (6)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 61/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 62/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 63/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 64/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 65/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 66/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 67/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 68/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 69/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 70/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 71/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 72/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 73/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 80/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 81/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 83/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 90/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 91/-1 camInfoIndex(-1)
2023-10-06 10:35:50.919 31986-31986 ExynosCameraInterface   pid-31986                            E  [CAM(-1)][]-(HAL_getCameraInfo[801]):ERR :Invalid camera ID 92/-1 camInfoIndex(-1)

Camera Device

{
  "sensorOrientation": "landscape-right",
  "hardwareLevel": "limited",
  "maxZoom": 8,
  "minZoom": 1,
  "supportsLowLightBoost": true,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": false,
  "isMultiCam": false,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

Samsung A53

VisionCamera Version

3.3.1

Can you reproduce this issue in the VisionCamera Example app?

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

Additional information

danieloprado avatar Oct 06 '23 13:10 danieloprado

Does it work if you don't set pixelFormat='yuv'?

mrousavy avatar Oct 06 '23 14:10 mrousavy

Yes, but MLKit does not work without YUV format.

danieloprado avatar Oct 06 '23 14:10 danieloprado

Does your format support pixelFormats YUV?

mrousavy avatar Oct 06 '23 15:10 mrousavy

If yes, this is an issue I need to investigate and spend time on. I currently have many other things to do

mrousavy avatar Oct 06 '23 15:10 mrousavy

image

Stills the same 😢

danieloprado avatar Oct 06 '23 18:10 danieloprado

It's always Samsung man. I don't know, the stacktrace isn't very precise, I don't have that phone myself so I can't really develop a fix for that.-

mrousavy avatar Oct 09 '23 09:10 mrousavy

Hey - @danieloprado if you want this fixed please try to figure out what the problem here is:

  • Try running a native Java/Kotlin Android app that uses Camera2 to see if that works with YUV MLKit
    • If that works, it's an issue in VisionCamera and needs to be fixed.
  • Try running a native Java/Kotlin Android app that uses CameraX to see if that works with YUV MLKit
    • If that works, it's an issue with Samsung/Android, and CameraX has a special workaround. Browse the CameraX codebase (or contact their team) to figure out what exactly they are doing.
  • Contact Samsung and report this as a bug - maybe they can help you. Say something like "Using an ImageReader with ImageFormat.YUV_420_888 crashes on Samsung A58".

Also, you can try to replace YUV_420_888 with NV21 here: https://github.com/mrousavy/react-native-vision-camera/blob/e8ae11e30b4fb4e25a38fa589b27229c18c03171/package/android/src/main/java/com/mrousavy/camera/core/VideoPipeline.kt#L160

Maybe that format is just broken, idk.

mrousavy avatar Oct 16 '23 14:10 mrousavy

I've tested on another Samsung model (m52) and it worked, I'll close the issue for now. Thanks!

danieloprado avatar Oct 17 '23 14:10 danieloprado

Wait why are you closing the issue? Doesn't it still crash on the Samsung A53?

mrousavy avatar Oct 17 '23 16:10 mrousavy

I dont know, I dont have this phone anymore so will not able to reproduce. I'm closing just to keep in history and If anyone have this problem can open again. But If tou want I can open it again to keep track of It.

danieloprado avatar Oct 17 '23 23:10 danieloprado

I have a parent with this phone, I'll generate a release build of the new lib version and try to see If it Stills happens.

danieloprado avatar Oct 17 '23 23:10 danieloprado

I have issue on the Samsung A14

edritech93 avatar Oct 18 '23 04:10 edritech93

I have the same in Samsun A10,

  • if you remove the frameprocessor propert it works fine ( but no frame processor )
  • if you remove the pixel format - it works, but I get PRIVATE image format in the plugin

With pixelFormat Native it works fine, but the frameprocessor plugin cannot read the image and convert to bitmap for example.

It worth mentioning, that it's not a but in Samsung, I am currently using this package in android https://github.com/natario1/CameraView with frame processing and it works just fine in all android devices

I am using in natario1/CameraView ImageFormat.NV21 without issues.

meabed avatar Oct 23 '23 00:10 meabed

can you guys check if this patch solves this issue?

https://github.com/mrousavy/react-native-vision-camera/pull/2108

rodgomesc avatar Oct 30 '23 22:10 rodgomesc

can you guys check if this patch solves this issue?

#2108

This fixes the crash on my Samsung A53

patlux avatar Nov 14 '23 13:11 patlux

Thanks @mrousavy for such an awesome library!

On my end it works perfectly w/Zebra devices.. but not with Samsung Galaxy A14 5G (It even reboots when this happens)

kjimenezdev avatar Nov 28 '23 18:11 kjimenezdev

I'm encountering this as well on a OnePlus 8T as up-to-date as possible (running on Android 13) using the latest release vision-camera release (3.6.15), the device first shows a black rectangle instead of the camera and then reboots (like @kjimenezdev) after a few seconds.

The crash/reboot seems to be triggered by the combination of pixelFormat="yuv" and const format = useCameraFormat(device, [{videoResolution: {width: 1920, height: 1080}}]);

Here is a couple of logcat before the reboot: https://gist.github.com/mgcrea/677ad9677886c7f67c259dd9b6141238

Looks like this could be the issue:

12-12 17:32:48.700  1190  2395 E CamX    : [ERROR][FORMAT ] camximageformatmapper.cpp:1088 ValidateBufferSize() grallocBufferSize 3112960 is less than TotalSize 3133440
12-12 17:32:48.700  1190  2395 E CamX    : [ERROR][MEMMGR ] camximagebuffer.cpp:491 Import() [RealTimeFeatureZSLPreviewRaw_IPE0_OutputPortId9_Video][0xb40000739345de00] Failed in importing Gralloc Buffer type=0, BufferHandle=0xb4000073bcdfa178, offset=0, size=3133440, flags=0x1, deviceCount=1, WxH 1920x1080, format 3
12-12 17:32:48.700  1190  2395 E CamX    : [ERROR][CORE   ] camxnode.cpp:2850 SetupRequestOutputPorts() Import failed
12-12 17:32:48.748  1190  2393 E CamX    : [ERROR][STATS_AWB] camxcawbioutil.cpp:2450 PopulateColorSensorFrontData() NCS ColorSensor front handle is NULL
12-12 17:32:48.748  1190  2393 E CamX    : [ERROR][STATS_AWB] camxcawbioutil.cpp:1766 RetrieveExtensionTriggerInfo() AI fail, aiSceneID: 0x0, aiSceneConfidence: 0x0 ,reqID: 4

If I remove the format prop it no longer reboots but freezes on the first frame with the following logcat output:

https://gist.github.com/mgcrea/c70ced11674827124c26fb1cd8e39c0d

Extract of possibly relevant lines:

12-12 17:47:18.740  1190  2399 E CamX    : [ERROR][STATS_AEC] caeccore.cpp:2770: ExpTableEntryLookUp ERROR: Look up Failed
12-12 17:47:18.742  1190  2403 E CamX    : [ERROR][STATS_AWB] camxcawbioutil.cpp:2450 PopulateColorSensorFrontData() NCS ColorSensor front handle is NULL
12-12 17:47:18.742  1190  2403 E CamX    : [ERROR][STATS_AWB] camxcawbioutil.cpp:1766 RetrieveExtensionTriggerInfo() AI fail, aiSceneID: 0x0, aiSceneConfidence: 0x0 ,reqID: 3
12-12 17:47:18.742  1190  2404 E CamX    : [ERROR][STATS_AEC] camxcaecstatsprocessor.cpp:6101 PopulateColorSensorRearData() ColorSensor front samples not available
12-12 17:47:18.742  1190  2399 I ISPHVX  : [AFDBG] ReadControlAFTrigger Prevent start and cancel event forgot to reset by app. skip it.
12-12 17:47:18.742  1190  2404 E CamX    : [ERROR][STATS_AEC] caeccore.cpp:2770: ExpTableEntryLookUp ERROR: Look up Failed
12-12 17:47:18.743  1190  1190 

Happy to help if there is anything I can do.

mgcrea avatar Dec 12 '23 16:12 mgcrea

i still have the same problem on my samsung a40

Samuele-Barbiera avatar Dec 14 '23 11:12 Samuele-Barbiera

I have the same in Samsun A10,

  • if you remove the frameprocessor propert it works fine ( but no frame processor )
  • if you remove the pixel format - it works, but I get PRIVATE image format in the plugin

With pixelFormat Native it works fine, but the frameprocessor plugin cannot read the image and convert to bitmap for example.

It worth mentioning, that it's not a but in Samsung, I am currently using this package in android natario1/CameraView with frame processing and it works just fine in all android devices

I am using in natario1/CameraView ImageFormat.NV21 without issues.

how do you implement it on a react native project using this library? @meabed

Samuele-Barbiera avatar Dec 14 '23 11:12 Samuele-Barbiera

Testing again using the lastest release, it's working properly, may you can close this issue.

danieloprado avatar Jan 15 '24 13:01 danieloprado

Great, thanks!

mrousavy avatar Jan 15 '24 13:01 mrousavy