mrousavy / react-native-vision-camera

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

🐛 App Crashing when using Frame Processor: `Compiling JS failed: 1:1:invalid empty parentheses '( )'` #2465

Closed Abdulkader-Saoud closed 7 months ago

Abdulkader-Saoud commented 7 months ago

What's happening?

When i use useFrameProcessor the app is crashing while it is working fine when i remove it

console.log(`Frame: ${frame.width}x${frame.height} (${frame.pixelFormat})`)
this line is not printing anything to console

I have been trying with different gradle and java versions all the day and nothing worked now im using gradle 8.0 and jdk 17.0.10 any help will be appreciated Thank you

Reproduceable Code

import React, {useEffect, useState } from 'react';
import {View, StyleSheet} from 'react-native';
import {
  Camera,
  useCameraFormat,
  useFrameProcessor,
} from 'react-native-vision-camera';

const CCamera = (props) => {
  const {isActive, cam, toggleCam} = props;

  const format = useCameraFormat(cam, [
    {videoResolution: 'max',fps: 'max'},
  ]);

  const frameProcessor = useFrameProcessor((frame) => {
    'worklet'
    console.log(`Frame: ${frame.width}x${frame.height} (${frame.pixelFormat})`)
  }, [])

  const handleCameraError = (e) => { console.warn('error', e); };
  return (
    <View style={styles.cameraStyle}>
      {isActive && cam && (
        <Camera
          device={cam}
          video={true}
          audio={true}
          isActive={isActive}
          style={StyleSheet.absoluteFill}
          format={format}
          onError={handleCameraError}
          frameProcessor={frameProcessor }
        />
      )}
    </View>
  );
};

const styles = StyleSheet.create({
  cameraStyle: {
    width: '49%',
    aspectRatio: 3 / 4,
    borderRadius: 10,
  },
});

export default CCamera;

Relevant log output

01-31 14:29:59.000  1061  1061 D TaplEvents: TIS / TouchInteractionService.onInputEvent: MotionEvent { action=ACTION_UP, actionButton=0, id[0]=0, x[0]=616.959, y[0]=1080.9355, toolType[0]=TOOL_TYPE_FINGER, buttonState=0, classification=NONE, metaState=0, flags=0x0, edgeFlags=0x0, pointerCount=1, historySize=0, eventTime=14187592, downTime=14187485, deviceId=4, source=0xd002, displayId=0, eventId=768364459 }
01-31 14:29:59.033   417 13086 D audioserver: FGS Logger Transaction failed
01-31 14:29:59.033   417 13086 D audioserver: -129
01-31 14:29:59.039   417   525 D AudioFlinger: mixer(0x7b81dc888930) throttle end: throttle time(36)
01-31 14:29:59.055 16085 16085 I PreviewView: Creating PreviewView...
01-31 14:29:59.059 16085 16085 I PreviewView: PreviewView is 0x0, rendering 1080x1920 content. Resizing to: 0x0 (COVER)
01-31 14:29:59.059 16085 16085 I CameraView: Updating CameraSession...
01-31 14:29:59.073 16085 16161 I CameraSession: configure { ... }: Waiting for lock...
01-31 14:29:59.079 16085 16161 I CameraSession: configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
01-31 14:29:59.079 16085 16161 I CameraSession: Need to rebuild CameraDevice and CameraCaptureSession...
01-31 14:29:59.079 16085 16161 I CameraSession: CameraDevice and CameraCaptureSession is torn down but Camera is not active, skipping update...
01-31 14:29:59.079 16085 16161 I CameraSession: Successfully updated CameraSession Configuration! isActive: false
01-31 14:29:59.081 16085 16161 I CameraView: invokeOnInitialized()
01-31 14:29:59.088 16085 16085 I CameraView: Updating CameraSession...
01-31 14:29:59.088 16085 16161 I CameraSession: configure { ... }: Waiting for lock...
01-31 14:29:59.089 16085 16161 I CameraSession: configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=true, outputsChanged=true, sidePropsChanged=true, isActiveChanged=true)
01-31 14:29:59.089 16085 16161 I CameraSession: Need to rebuild CameraDevice and CameraCaptureSession...
01-31 14:29:59.089 16085 16161 I CameraSession: Need to rebuild CameraDevice and CameraCaptureSession...
01-31 14:29:59.089 16085 16085 I PreviewView: PreviewView is 443x591, rendering 1080x1920 content. Resizing to: 443x788 (COVER)
01-31 14:29:59.090 16085 16161 I CameraSession: Configuring Camera #0...
01-31 14:29:59.096 16085 16161 I CameraManager: Camera #0: Opening...
01-31 14:29:59.098 16085 16085 I CameraSession: PreviewView Surface created! Surface(name=null)/@0xba46628
01-31 14:29:59.098 16085 16085 I CameraSession: Setting Preview Output...
01-31 14:29:59.099 16085 16085 I CameraSession: PreviewView Surface updated! Surface(name=null)/@0xba46628 443 x 788
01-31 14:29:59.101 16085 16085 D VisionCameraProxy: Finding view 55...
01-31 14:29:59.102 16085 16085 D VisionCameraProxy: Found view 55!
01-31 14:29:59.108   571  2203 W System.err: java.lang.SecurityException: Caller with uid 1047 is not android
01-31 14:29:59.108   571  2203 W System.err:    at com.android.server.devicepolicy.DevicePolicyManagerService.getCallerIdentity(DevicePolicyManagerService.java:2368)
01-31 14:29:59.108   571  2203 W System.err:    at com.android.server.devicepolicy.DevicePolicyManagerService.getCameraDisabled(DevicePolicyManagerService.java:9311)
01-31 14:29:59.108   571  2203 W System.err:    at android.app.admin.DevicePolicyManager.getCameraDisabled(DevicePolicyManager.java:8423)
01-31 14:29:59.108   571  2203 W System.err:    at com.android.server.camera.CameraServiceProxy$2.isCameraDisabled(CameraServiceProxy.java:622)
01-31 14:29:59.108   571  2203 W System.err:    at android.hardware.ICameraServiceProxy$Stub.onTransact(ICameraServiceProxy.java:174)
01-31 14:29:59.109   571  2203 W System.err:    at android.os.Binder.execTransactInternal(Binder.java:1344)
01-31 14:29:59.109   571  2203 W System.err:    at android.os.Binder.execTransact(Binder.java:1275)
01-31 14:29:59.109   485   485 I CameraService: CameraService::connect call (PID 16085 "com.carcm", camera ID 0) and Camera API version 2
01-31 14:29:59.111   485   485 I Camera2ClientBase: Camera 0: Opened. Client: com.carcm (PID 16085, UID 10184)
01-31 14:29:59.111   485   485 I CameraDeviceClient: CameraDeviceClient 0: Opened
01-31 14:29:59.111   485   485 I CameraService: makeClient: Camera2 API, override to portrait 1
01-31 14:29:59.112   386   386 W StreamConfigurationMap: StreamConfigurationMap: ANDROID_SCALER_AVAILABLE_STREAM_CONFIGURATIONS missing, maxResolution ? true!
01-31 14:29:59.112   386   386 W StreamConfigurationMap: StreamConfigurationMap: ANDROID_SCALER_AVAILABLE_MIN_FRAME_DURATIONS missing!, max resolution ? true
01-31 14:29:59.112   386   386 W StreamConfigurationMap: StreamConfigurationMap: ANDROID_SCALER_AVAILABLE_STALL_DURATIONS missing! maxResolution ? true 
01-31 14:29:59.117   386  4525 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.117   386  4525 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.117   386  4525 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.117   386   386 W EmulatedRequestState: InitializeControlDefaults: No available post RAW boost! Setting default!
01-31 14:29:59.118   485   485 I CameraProviderManager: Camera device device@1.1/internal/0 torch status is now NOT_AVAILABLE
01-31 14:29:59.118   485   485 I CameraService: onTorchStatusChangedLocked: Torch status changed for cameraId=0, newStatus=0
01-31 14:29:59.119   386   386 I GCH_CameraDeviceSession: Initialize: measure buffer allocation time: 0
01-31 14:29:59.120   182   182 I hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.mapper@4.0::IMapper/default in either framework or device VINTF manifest.
01-31 14:29:59.121  1548  2341 I AiAiEcho: Settings changed for uri: content://settings/secure/flashlight_available
01-31 14:29:59.127   386   386 I GCH_CameraDeviceSession: Create: Created a device session for camera 0 with 0 physical cameras
01-31 14:29:59.146  1548  1772 I AiAiEcho: Predicting[0]: 
01-31 14:29:59.146  1548  1772 I AiAiEcho: EchoTargets:
01-31 14:29:59.146  1548  1772 I AiAiEcho: Filtered by AiAi flag check:
01-31 14:29:59.146  1548  1772 I AiAiEcho: Ranked targets strategy: SORT, count: 0, ranking metadata:
01-31 14:29:59.146   182   182 I hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.mapper@4.0::IMapper/default in either framework or device VINTF manifest.
01-31 14:29:59.146  1548  1772 I AiAiEcho: Predicting[0]:
01-31 14:29:59.147  1548  1772 I AiAiEcho: EchoTargets:
01-31 14:29:59.147  1548  1772 I AiAiEcho: Filtered by AiAi flag check:
01-31 14:29:59.147  1548  1772 I AiAiEcho: Ranked targets strategy: SORT, count: 0, ranking metadata:
01-31 14:29:59.148  1548  1772 I AiAiEcho: Predicting[0]:
01-31 14:29:59.148  1548  1772 I AiAiEcho: EchoTargets:
01-31 14:29:59.148  1548  1772 I AiAiEcho: Filtered by AiAi flag check:
01-31 14:29:59.149  1548  1772 I AiAiEcho: Ranked targets strategy: SORT, count: 0, ranking metadata:
01-31 14:29:59.150  1548  1772 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface media_data_manager with targets# 0 (types=[])
01-31 14:29:59.151  1548  1772 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface lockscreen with targets# 0 (types=[])
01-31 14:29:59.153  1548  1772 I AiAiEcho: #postPredictionTargets: Sending updates to UISurface home with targets# 0 (types=[])
01-31 14:29:59.154   807   807 D SsMediaDataProvider: Forwarding Smartspace updates []
01-31 14:29:59.154   417   525 D audioserver: FGS Logger Transaction failed
01-31 14:29:59.154   417   525 D audioserver: -129
01-31 14:29:59.154   807   807 W PageIndicator: Total number of pages invalid: 0. Assuming 1 page.
01-31 14:29:59.159   386   386 W ServiceManagerCppClient: Failed to get isDeclared for android.hardware.thermal.IThermal/default: Status(-1, EX_SECURITY): 'SELinux denied.'
01-31 14:29:59.160   386   386 W GCH_AidlCameraDeviceSession: Thermal AIDL service is not declared; trying Thermal HIDL service
01-31 14:29:59.160   182   182 E SELinux : avc:  denied  { find } for interface=android.hardware.thermal::IThermal sid=u:r:hal_camera_default:s0 pid=386 scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:hal_thermal_hwservice:s0 tclass=hwservice_manager permissive=0
01-31 14:29:59.133     0     0 E SELinux : avc:  denied  { find } for pid=386 uid=1000 name=android.hardware.thermal.IThermal/default scontext=u:r:hal_camera_default:s0 tcontext=u:object_r:hal_thermal_service:s0 tclass=service_manager permissive=0
01-31 14:29:59.161   386   386 E GCH_AidlCameraDeviceSession: Initialize: Getting thermal failed.
01-31 14:29:59.161   386   386 E GCH_AidlCameraDeviceSession: RegisterThermalChangedCallback: thermal was not initialized.
01-31 14:29:59.161   386   386 W GCH_CameraDeviceSession: SetSessionCallback: Registering thermal callback failed: No such device(-19)
01-31 14:29:59.165 16085 16142 I CameraDevices: Camera #0 is now unavailable.
01-31 14:29:59.166   571  2201 V CameraService_proxy: Disable Rotate and Crop to avoid conflicts with WM force rotation treatment.
01-31 14:29:59.168   485   485 D cameraserver: FGS Logger Transaction failed
01-31 14:29:59.168   485   485 D cameraserver: -129
01-31 14:29:59.170 16085 16161 I CameraSession: configure { ... }: Waiting for lock...
01-31 14:29:59.172 16085 16161 I CameraManager: Camera #0: Opened!
01-31 14:29:59.178 16085 16161 I CameraSession: Successfully configured Camera #0!
01-31 14:29:59.179 16085 16161 I CameraSession: Destroying previous outputs...
01-31 14:29:59.181 16085 16161 I CameraSession: Creating outputs for Camera #0...
01-31 14:29:59.184 16085 16161 I CameraSession: Adding 1280x720 Video Output in PRIVATE...
01-31 14:29:59.186 16085 16161 I VideoPipeline: Initializing 1280 x 720 Video Pipeline (format: NATIVE)
01-31 14:29:59.187 16085 16161 I VideoPipeline: Using ImageReader round-trip (format: #34)
01-31 14:29:59.187 16085 16161 I VideoPipeline: Using API 29 for GPU ImageReader...
01-31 14:29:59.187 16085 16161 D CompatibilityChangeReporter: Compat change id reported: 236825255; UID 10184; state: ENABLED
01-31 14:29:59.193 16085 16161 I CreateCaptureSession: Camera #0: Creating Capture Session #1... (Hardware Level: 3 | Outputs: [VIDEO (1280x720 in NATIVE)])
01-31 14:29:59.194 16085 16161 I SurfaceOutput: Using optimized stream use case 3 for VIDEO output.
01-31 14:29:59.195 16085 16161 I CreateCaptureSession: Using new API (>=28)
01-31 14:29:59.196   485   485 W cameraserver: createSurfaceFromGbp: Camera 0 with consumer usage flag: 256: Forcing asynchronous mode forstream        
01-31 14:29:59.200   386   386 I GCH_HalUtils: ======== App stream configuration ========
01-31 14:29:59.200   386   386 I GCH_HalUtils: == stream num: 1, operation_mode:0
01-31 14:29:59.200   386   386 I GCH_HalUtils: ==== [0]stream_id 0, type 0, format 34, res 1280x720, usage 256, is_phy 0, phy_cam_id 0, group_id -1     
01-31 14:29:59.200   386   386 I GCH_HalUtils: ======== App stream configuration ========
01-31 14:29:59.200   386   386 E GCH_ZslSnapshotCaptureSession: IsStreamConfigurationSupported: Software denoised not enabled
01-31 14:29:59.200   386   386 W GCH_HalUtils: IsStreamHdrplusCompatible: Getting kHdrplusPayloadFrames failed or number <= 0
01-31 14:29:59.200   386   386 D GCH_RgbirdCaptureSession: IsStreamConfigurationSupported: RgbirdCaptureSession doesn't support 0 physical cameras      
01-31 14:29:59.200   386   386 D GCH_DualIrCaptureSession: IsStreamConfigurationSupported: Only support two IR cameras but there are 0 cameras.
01-31 14:29:59.200   386   386 D GCH_BasicCaptureSession: IsStreamConfigurationSupported: BasicCaptureSession supports the stream config
01-31 14:29:59.200   386   386 D GCH_BasicCaptureSession: IsStreamConfigurationSupported: BasicCaptureSession supports the stream config
01-31 14:29:59.229   485   485 D Camera3-Device: Set real time priority for request queue thread (tid 16301)
01-31 14:29:59.230 16085 16161 I CreateCaptureSession: Camera #0: Successfully created CameraCaptureSession #1!
01-31 14:29:59.230 16085 16161 I CameraSession: Successfully configured Session with 1 outputs for Camera #0!
01-31 14:29:59.231 16085 16161 I CameraSession: Updating Video Outputs...
01-31 14:29:59.231 16085 16161 I VideoPipeline: Setting 1280 x 720 FrameProcessor Output...
01-31 14:29:59.231 16085 16161 I VideoPipeline: Removing RecordingSession Output...
01-31 14:29:59.246 16085 16161 I CameraView: invokeOnStarted()
01-31 14:29:59.248 16085 16161 I CameraSession: Successfully updated CameraSession Configuration! isActive: true
01-31 14:29:59.248 16085 16161 I CameraView: invokeOnInitialized()
01-31 14:29:59.253 16085 16161 I CameraSession: configure { ... }: Updating CameraSession Configuration... Difference(deviceChanged=false, outputsChanged=true, sidePropsChanged=true, isActiveChanged=false)
01-31 14:29:59.253 16085 16161 I CameraSession: Destroying previous outputs...
01-31 14:29:59.253 16085 16161 I SurfaceOutput: Closing 1280x720 Video Pipeline..
01-31 14:29:59.255 16085 16161 I CameraView: invokeOnStopped()
01-31 14:29:59.258 16085 16161 I CameraSession: Creating outputs for Camera #0...
01-31 14:29:59.260 16085 16161 I CameraSession: Adding 1280x720 Video Output in PRIVATE...
01-31 14:29:59.260 16085 16161 I VideoPipeline: Initializing 1280 x 720 Video Pipeline (format: NATIVE)
01-31 14:29:59.261 16085 16161 I VideoPipeline: Using ImageReader round-trip (format: #34)
01-31 14:29:59.261 16085 16161 I VideoPipeline: Using API 29 for GPU ImageReader...
01-31 14:29:59.264 16085 16161 I CameraSession: Adding 1280x720 Preview Output...
01-31 14:29:59.270 16085 16161 I CreateCaptureSession: Camera #0: Creating Capture Session #2... (Hardware Level: 3 | Outputs: [VIDEO (1280x720 in NATIVE), PREVIEW (1280 x 720)])
01-31 14:29:59.270 16085 16161 I SurfaceOutput: Using optimized stream use case 3 for VIDEO output.
01-31 14:29:59.271 16085 16161 I SurfaceOutput: Using optimized stream use case 1 for PREVIEW output.
01-31 14:29:59.271 16085 16161 I CreateCaptureSession: Using new API (>=28)
01-31 14:29:59.361 16085 16101 E BufferQueueProducer: [ImageReader-1280x720f22m3-16085-0](id:3ed500000004,api:4,p:485,c:16085) dequeueBuffer: BufferQueue has been abandoned
01-31 14:29:59.361   485 16301 E Camera3-OutputStream: getBufferLockedCommon: Stream 0: Can't dequeue next output buffer: No such device (-19)
01-31 14:29:59.405   425   425 I RefreshRateSelector: Display 4619827259835644672 policy changed
01-31 14:29:59.405   425   425 I RefreshRateSelector: Previous: {defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, inf Hz]}}
01-31 14:29:59.405   425   425 I RefreshRateSelector: Current:  DisplayManagerPolicy{defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}}
01-31 14:29:59.405   425   425 I RefreshRateSelector: 0 mode changes were performed under the previous policy
01-31 14:29:59.405   807   859 D EGL_emulation: app_time_stats: avg=3151.99ms min=3151.99ms max=3151.99ms count=1
01-31 14:29:59.414   485   485 I CameraLatencyHistogram: Stream 0 dequeueBuffer latency histogram (1) samples:
01-31 14:29:59.414   485   485 I CameraLatencyHistogram:         5     10     15     20     25     30     35     40     45    inf (max ms)
01-31 14:29:59.414   485   485 I CameraLatencyHistogram:      0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   0.00   100.00 (%)
01-31 14:29:59.416   425   425 I RefreshRateSelector: Display 4619827259835644672 policy changed
01-31 14:29:59.416   425   425 I RefreshRateSelector: Previous: {defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}}
01-31 14:29:59.416   425   425 I RefreshRateSelector: Current:  DisplayManagerPolicy{defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, inf Hz]}}
01-31 14:29:59.416   425   425 I RefreshRateSelector: 0 mode changes were performed under the previous policy
01-31 14:29:59.418   485   485 W cameraserver: createSurfaceFromGbp: Camera 0 with consumer usage flag: 256: Forcing asynchronous mode forstream        
01-31 14:29:59.464   485   485 W cameraserver: createSurfaceFromGbp: Camera 0 with consumer usage flag: 2304: Forcing asynchronous mode forstream
01-31 14:29:59.466 16085 16085 I PreviewView: Setting PreviewView Surface Size to 443 x 788...
01-31 14:29:59.466   485   485 W cameraserver: createSurfaceFromGbp: Camera 0: Overriding format 0x4 to IMPLEMENTATION_DEFINED
01-31 14:29:59.469 16085 16085 I CameraSession: PreviewView Surface updated! Surface(name=null)/@0xba46628 1280 x 720
01-31 14:29:59.564   386   386 I GCH_HalUtils: ======== App stream configuration ========
01-31 14:29:59.564   386   386 I GCH_HalUtils: == stream num: 2, operation_mode:0
01-31 14:29:59.564   386   386 I GCH_HalUtils: ==== [0]stream_id 1, type 0, format 34, res 1280x720, usage 256, is_phy 0, phy_cam_id 0, group_id -1     
01-31 14:29:59.564   386   386 I GCH_HalUtils: ==== [1]stream_id 2, type 0, format 34, res 640x480, usage 2304, is_phy 0, phy_cam_id 0, group_id -1     
01-31 14:29:59.565   386   386 I GCH_HalUtils: ======== App stream configuration ========
01-31 14:29:59.565   386   386 E GCH_ZslSnapshotCaptureSession: IsStreamConfigurationSupported: Software denoised not enabled
01-31 14:29:59.565   386   386 W GCH_HalUtils: IsStreamHdrplusCompatible: Getting kHdrplusPayloadFrames failed or number <= 0
01-31 14:29:59.565   386   386 D GCH_RgbirdCaptureSession: IsStreamConfigurationSupported: RgbirdCaptureSession doesn't support 0 physical cameras      
01-31 14:29:59.565   386   386 D GCH_DualIrCaptureSession: IsStreamConfigurationSupported: Only support two IR cameras but there are 0 cameras.
01-31 14:29:59.566   386   386 D GCH_BasicCaptureSession: IsStreamConfigurationSupported: BasicCaptureSession supports the stream config
01-31 14:29:59.566   386   386 D GCH_BasicCaptureSession: IsStreamConfigurationSupported: BasicCaptureSession supports the stream config
01-31 14:29:59.573   386   386 W EmulatedRequestState: InitializeControlDefaults: No available post RAW boost! Setting default!
01-31 14:29:59.573   386  4527 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.573   386  4527 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.574   386  4527 E EmulatedRequestProcessor: onEvent: unexpected event received type: 33
01-31 14:29:59.621   485   485 D Camera3-Device: Set real time priority for request queue thread (tid 16301)
01-31 14:29:59.623 16085 16161 I CreateCaptureSession: Camera #0: Successfully created CameraCaptureSession #2!
01-31 14:29:59.624 16085 16161 I CameraSession: Successfully configured Session with 2 outputs for Camera #0!
01-31 14:29:59.625 16085 16161 I CameraSession: Updating Video Outputs...
01-31 14:29:59.625 16085 16161 I VideoPipeline: Setting 1280 x 720 FrameProcessor Output...
01-31 14:29:59.625 16085 16161 I VideoPipeline: Removing RecordingSession Output...
01-31 14:29:59.629 16085 16099 I BpBinder: onLastStrongRef automatically unlinking death recipients:
01-31 14:29:59.630 16085 16161 I CameraView: invokeOnStarted()
01-31 14:29:59.631 16085 16161 I CameraSession: Successfully updated CameraSession Configuration! isActive: true
01-31 14:29:59.635 16085 16161 I CreateCaptureSession: Camera #0: CameraCaptureSession #1 has been closed.
01-31 14:29:59.700   182   182 I hwservicemanager: getTransport: Cannot find entry android.hardware.graphics.mapper@4.0::IMapper/default in either framework or device VINTF manifest.
01-31 14:29:59.708   425   425 I RefreshRateSelector: Display 4619827259835644672 policy changed
01-31 14:29:59.708   425   425 I RefreshRateSelector: Previous: {defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[0.00 Hz, inf Hz], render=[0.00 Hz, inf Hz]}}
01-31 14:29:59.708   425   425 I RefreshRateSelector: Current:  DisplayManagerPolicy{defaultModeId=0, allowGroupSwitching=false, primaryRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}, appRequestRanges={physical=[60.00 Hz, inf Hz], render=[60.00 Hz, 60.00 Hz]}}
01-31 14:29:59.708   425   425 I RefreshRateSelector: 0 mode changes were performed under the previous policy
01-31 14:29:59.801 16085 16162 I VideoPipeline: ImageReader::onImageAvailable!
01-31 14:29:59.809 16085 16162 I HermesVM: Compiling JS failed: 1:1:invalid empty parentheses '( )',  Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.811 16085 16162 E VideoPipeline: Failed to call Frame Processor!
01-31 14:29:59.811 16085 16162 E VideoPipeline: com.facebook.jni.CppException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at com.mrousavy.camera.frameprocessor.FrameProcessor.call(Native Method)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline._init_$lambda$0(VideoPipeline.kt:117)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline.$r8$lambda$EMriwS_FKhtjTFtppM84Z5V8tiI(Unknown Source:0)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline$$ExternalSyntheticLambda0.onImageAvailable(Unknown Source:2)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.media.ImageReader$1.run(ImageReader.java:947)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.os.Handler.handleCallback(Handler.java:958)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.os.Looper.loopOnce(Looper.java:205)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.os.Looper.loop(Looper.java:294)
01-31 14:29:59.811 16085 16162 E VideoPipeline:         at android.os.HandlerThread.run(HandlerThread.java:67)
01-31 14:29:59.856   386 16309 I GCH_AidlCameraDeviceSession: ProcessCaptureResult: First frame done
01-31 14:29:59.883 16085 16162 I VideoPipeline: ImageReader::onImageAvailable!
01-31 14:29:59.891 16085 16162 I HermesVM: Compiling JS failed: 1:1:invalid empty parentheses '( )',  Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.893 16085 16162 E VideoPipeline: Failed to call Frame Processor!
01-31 14:29:59.893 16085 16162 E VideoPipeline: com.facebook.jni.CppException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at com.mrousavy.camera.frameprocessor.FrameProcessor.call(Native Method)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline._init_$lambda$0(VideoPipeline.kt:117)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline.$r8$lambda$EMriwS_FKhtjTFtppM84Z5V8tiI(Unknown Source:0)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline$$ExternalSyntheticLambda0.onImageAvailable(Unknown Source:2)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.media.ImageReader$1.run(ImageReader.java:947)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.os.Handler.handleCallback(Handler.java:958)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.os.Looper.loopOnce(Looper.java:205)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.os.Looper.loop(Looper.java:294)
01-31 14:29:59.893 16085 16162 E VideoPipeline:         at android.os.HandlerThread.run(HandlerThread.java:67)
01-31 14:29:59.968 16085 16162 I VideoPipeline: ImageReader::onImageAvailable!
01-31 14:29:59.976 16085 16162 I HermesVM: Compiling JS failed: 1:1:invalid empty parentheses '( )',  Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.979 16085 16162 E VideoPipeline: Failed to call Frame Processor!
01-31 14:29:59.979 16085 16162 E VideoPipeline: com.facebook.jni.CppException: Compiling JS failed: 1:1:invalid empty parentheses '( )' Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at com.mrousavy.camera.frameprocessor.FrameProcessor.call(Native Method)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline._init_$lambda$0(VideoPipeline.kt:117)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline.$r8$lambda$EMriwS_FKhtjTFtppM84Z5V8tiI(Unknown Source:0)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at com.mrousavy.camera.core.VideoPipeline$$ExternalSyntheticLambda0.onImageAvailable(Unknown Source:2)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.media.ImageReader$1.run(ImageReader.java:947)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.os.Handler.handleCallback(Handler.java:958)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.os.Looper.loopOnce(Looper.java:205)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.os.Looper.loop(Looper.java:294)
01-31 14:29:59.979 16085 16162 E VideoPipeline:         at android.os.HandlerThread.run(HandlerThread.java:67)
01-31 14:30:00.073 16085 16162 I VideoPipeline: ImageReader::onImageAvailable!
01-31 14:30:00.073 16085 16162 W ImageReader_JNI: Unable to acquire a buffer item, very likely client tried to acquire more than maxImages buffers      
01-31 14:30:00.074 16085 16162 E AndroidRuntime: FATAL EXCEPTION: mrousavy/VisionCamera.video
01-31 14:30:00.074 16085 16162 E AndroidRuntime: Process: com.carcm, PID: 16085
01-31 14:30:00.074 16085 16162 E AndroidRuntime: java.lang.IllegalStateException: maxImages (3) has already been acquired, call #close before acquiring more.
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.media.ImageReader.acquireNextImage(ImageReader.java:661)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at com.mrousavy.camera.core.VideoPipeline._init_$lambda$0(VideoPipeline.kt:111)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at com.mrousavy.camera.core.VideoPipeline.$r8$lambda$EMriwS_FKhtjTFtppM84Z5V8tiI(Unknown Source:0)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at com.mrousavy.camera.core.VideoPipeline$$ExternalSyntheticLambda0.onImageAvailable(Unknown Source:2)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.media.ImageReader$1.run(ImageReader.java:947)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.os.Handler.handleCallback(Handler.java:958)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.os.Handler.dispatchMessage(Handler.java:99)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.os.Looper.loopOnce(Looper.java:205)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.os.Looper.loop(Looper.java:294)
01-31 14:30:00.074 16085 16162 E AndroidRuntime:        at android.os.HandlerThread.run(HandlerThread.java:67)
01-31 14:30:00.078   571  2201 W ActivityTaskManager:   Force finishing activity com.carcm/.MainActivity
01-31 14:30:00.080   807   831 V WindowManagerShell: Transition requested: android.os.BinderProxy@f24ec25 TransitionRequestInfo { type = CLOSE, triggerTask = null, remoteTransition = null, displayChange = null }
01-31 14:30:00.083   571 16315 I DropBoxManagerService: add tag=data_app_crash isTagEnabled=true flags=0x2
01-31 14:30:00.089 16085 16162 I Process : Sending signal. PID: 16085 SIG: 9
01-31 14:30:00.104   425   425 I BpBinder: onLastStrongRef automatically unlinking death recipients: 
01-31 14:30:00.130   378   378 I Zygote  : Process 16085 exited due to signal 9 (Killed)
01-31 14:30:00.130   571   608 I ActivityManager: Process com.carcm (pid 16085) has died: vis TOP
01-31 14:30:00.131   571   797 I WindowManager: WIN DEATH: Window{a42ed25 u0 com.carcm/com.carcm.MainActivity}
01-31 14:30:00.131   571   797 W InputManager-JNI: Input channel object 'a42ed25 com.carcm/com.carcm.MainActivity (client)' was disposed without first being removed with the input manager!
01-31 14:30:00.104     0     0 I binder  : undelivered TRANSACTION_COMPLETE
01-31 14:30:00.105     0     0 I binder  : undelivered transaction 3665810, process died.
01-31 14:30:00.106     0     0 I binder  : send failed reply for transaction 3665819 to 485:4716
01-31 14:30:00.132   485  4716 E Surface : queueBuffer: error queuing buffer, -32
01-31 14:30:00.132   485  4716 E Camera3-OutputStream: returnBufferCheckedLocked: Stream 2: Error queueing buffer to native window: Broken pipe (-32)   
01-31 14:30:00.132   571  2201 I ImeTracker: com.carcm:61fc9a02: onRequestHide at ORIGIN_SERVER_HIDE_INPUT reason HIDE_REMOVE_CLIENT
01-31 14:30:00.108     0     0 I binder  : 16301:485 cannot find target node
01-31 14:30:00.109     0     0 I binder  : 485:16301 transaction call to 0:0 failed 3665840/29189/-22, size 112-0 line 3210
01-31 14:30:00.133   571  2201 I ImeTracker: com.carcm:61fc9a02: onCancelled at PHASE_SERVER_SHOULD_HIDE
01-31 14:30:00.133   571   627 I libprocessgroup: Successfully killed process cgroup uid 10184 pid 16085 in 0ms
01-31 14:30:00.134   485   485 D Camera2ClientBase: Camera 0: start to disconnect
01-31 14:30:00.134   485   485 D Camera2ClientBase: Camera 0: serializationLock acquired
01-31 14:30:00.134   485   485 D Camera2ClientBase: Camera 0: Shutting down
01-31 14:30:00.134   485   485 D Camera2ClientBase: Camera 0: start to cacheDump

Camera Device

{
  "formats": [],
  "sensorOrientation": "landscape-right",
  "hardwareLevel": "full",
  "maxZoom": 10,
  "minZoom": 1,
  "maxExposure": 9,
  "supportsLowLightBoost": false,
  "neutralZoom": 1,
  "physicalDevices": [
    "wide-angle-camera"
  ],
  "supportsFocus": true,
  "supportsRawCapture": true,
  "isMultiCam": false,
  "minFocusDistance": 5,
  "minExposure": -9,
  "name": "BACK (0)",
  "hasFlash": true,
  "hasTorch": true,
  "position": "back",
  "id": "0"
}

Device

sdk_gphone64_x86_64

VisionCamera Version

3.8.2

Can you reproduce this issue in the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

mrousavy commented 7 months ago

01-31 14:29:59.809 16085 16162 I HermesVM: Compiling JS failed: 1:1:invalid empty parentheses '( )', Buffer size 3 starts with: 280a29 and has protection mode(s): rw-p

Are you using reanimated? See this issue: https://github.com/software-mansion/react-native-reanimated/issues/5576 - enabling processNestedWorklets in the babel plugin will probably fix your issue.

Abdulkader-Saoud commented 7 months ago

Sorry again But my babel.config.js is

module.exports = {
  presets: ['module:@react-native/babel-preset'],
  plugins: [
    [
      'react-native-reanimated/plugin',
      {
        processNestedWorklets: true,
      },
    ],
    ['react-native-worklets-core/plugin']
  ]
};

and im using those versions

"dependencies": {
    "react": "18.2.0",
    "react-native": "0.73.3",
    "react-native-reanimated": "^3.6.2",
    "react-native-vision-camera": "^3.8.2",
    "react-native-worklets-core": "^0.3.0"
  }

still having the same issue am i missing something ?

Can You provide me with tested versions ? I mean every thing if possible jdk gradle AGP rn vision camera ..... Thank you for the response

Abdulkader-Saoud commented 7 months ago

Finally !!! This combination worked thank you .

"react-native-reanimated": "^3.6.0",
    "react-native-vision-camera": "^3.9.0-beta.0",
    "react-native-worklets-core": "^0.3.0"
nurikjohn commented 7 months ago

Still happening. I am not using reanimated. Created new project with expo.

"react-native-vision-camera": "^3.9.0-beta.0",
"react-native-worklets-core": "^0.3.0",
Charles-Johnson commented 6 months ago

I'm getting the same error message, I'm using the following versions:

"react-native": "0.73.4",
"react-native-reanimated": "3.6.2",
"react-native-vision-camera": "3.7.1",
"react-native-worklets-core": "0.2.0"

and my babel plugins include

      ["react-native-worklets-core/plugin"],
      ["react-native-reanimated/plugin", { globals: ["__scanOCR"] }],

It was working with react-native v0.72.6 and react-native-reanimated v3.7.1 but I had to downgrade react-native-reanimated to v3.6.2 to get other stuff in the app working with react-native v0.73.4

What I've tried

MobileDevPronisi commented 2 months ago

Did the downgrade work?