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

🐛 Crash when pixelFormat="yuv"

Open R4tch3t opened this issue 3 years ago • 12 comments

What's happening?

Why crash when set prop pixelFormat="yuv" if remove these prop work fine but is needed for frameProcessor for process image in ML Kit

Reproduceable Code

{device != null && isActive && (
        <PinchGestureHandler onGestureEvent={onPinchGesture} enabled={isActive}>
          <Reanimated.View style={StyleSheet.absoluteFill}>
            <TapGestureHandler onEnded={onDoubleTap} numberOfTaps={2}>
              <ReanimatedCamera
                ref={camera}
                style={StyleSheet.absoluteFill}
                device={device}
                format={format}
                fps={fps}
                hdr={enableHdr}
                lowLightBoost={device.supportsLowLightBoost && enableNightMode}
                isActive={isActive}
                onInitialized={onInitialized}
                onError={onError}
                enableZoomGesture={false}
                animatedProps={cameraAnimatedProps}
                enableFpsGraph={true}                                
                photo={true}
                video={true}
                audio={hasMicrophonePermission}
                frameProcessor={frameProcessor}
                //pixelFormat={"rgb"}
                pixelFormat={'yuv'}                
              />
            </TapGestureHandler>
          </Reanimated.View>
        </PinchGestureHandler>
      )}

Relevant log output DEBUG

{ [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 }

Relevant log output RELEASE

Exception java.lang.IllegalArgumentException: getCameraCharacteristics:1043: Unable to retrieve camera characteristics for unknown device 2: No such file or directory (-2)
  at android.hardware.camera2.CameraManager.throwAsPublicException (CameraManager.java:1750)
  at android.hardware.camera2.CameraManager.getCameraCharacteristics (CameraManager.java:793)
  at com.mrousavy.camera.core.CameraDeviceDetails.<init> (CameraDeviceDetails.kt:26)
  at com.mrousavy.camera.CameraDevicesManager.getDevicesJson (CameraDevicesManager.kt:63)
  at com.mrousavy.camera.CameraDevicesManager.sendAvailableDevicesChangedEvent (CameraDevicesManager.kt:71)
  at com.mrousavy.camera.CameraDevicesManager$callback$1.onCameraUnavailable (CameraDevicesManager.kt:44)
  at android.hardware.camera2.CameraManager$CameraManagerGlobal$7.run (CameraManager.java:2529)
  at android.os.Handler.handleCallback (Handler.java:942)
  at android.os.Handler.dispatchMessage (Handler.java:99)
  at android.os.Looper.loopOnce (Looper.java:226)
  at android.os.Looper.loop (Looper.java:313)
  at com.facebook.react.bridge.queue.MessageQueueThreadImpl$4.run (MessageQueueThreadImpl.java:228)
  at java.lang.Thread.run (Thread.java:1012)

Device

Samsung Galaxy S20+

VisionCamera Version

3.6.4

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

R4tch3t avatar Oct 26 '23 19:10 R4tch3t

I'm also running into this on a Galaxy A14.

seanpcoyle avatar Oct 26 '23 20:10 seanpcoyle

I'm also running into this on a Galaxy A14.

mmmm, that works in some phone devices but in others crash....

R4tch3t avatar Oct 26 '23 20:10 R4tch3t

Why pixelFormat="native" is data Inaccessible in frame processor ??? or it's possible??, if yes, how can I access to that data??

R4tch3t avatar Oct 26 '23 21:10 R4tch3t

@mrousavy Please! fallos fallos2

286+ %!!!!!

You tell me if fix that if no I downgrade to V2 because I need a HOTfix urgent.... iOS works well but unfortunately there are not many users, it is growing but a little slower, and I'm sorry but a good service is functional on any device

R4tch3t avatar Oct 26 '23 22:10 R4tch3t

Well, I guess nobody here is responsible for your app crashing like ***.

Stop whining and do something to fix YOUR app.

Edit: I do remember mrousavy offer paid services of fixing stuff like this, I think you can contact him if you really need such services.

zzz08900 avatar Oct 27 '23 14:10 zzz08900

Well, I guess nobody here is responsible for your app crashing like ***.

Stop whining and do something to fix YOUR app.

Edit: I do remember mrousavy offer paid services of fixing stuff like this, I think you can contact him if you really need such services.

It only fails due to the update of this library, I had v3rc2 with worklets in its infancy and it did not have the errors that I have now, 1.- YOU!? Have you done something to fix it!??, because that's what I do at least so that the OPEN source library listens well brother OPEN code!!! 2.- If I can pay 100, 1000 $ but it is version 3.6.4, that is what I will end up doing for an open source library...

R4tch3t avatar Oct 27 '23 18:10 R4tch3t

@zzz08900
You dare to ask stupid questions like Unable to call 'setState' within 'onBarcodeScanned' and comment here without contributing anything but hate...

R4tch3t avatar Oct 27 '23 19:10 R4tch3t

@R4tch3t can you ping me on discord? please join discord community if you are not already in it, and ping me. i also need to solve that problem for one of your customers, but i don't have a samsung device right now, maybe we can jump in a pair programming session and figure that out

rodgomesc avatar Oct 28 '23 08:10 rodgomesc

pixelFormat="native"

unfortunately native format can't be read by a frame processor since the layout is private :(

rodgomesc avatar Oct 28 '23 08:10 rodgomesc

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

can you run the example app from this PR with pixelFormat set to yuv?

rodgomesc avatar Oct 30 '23 20:10 rodgomesc

@R4tch3t

You tell me if fix that if no I downgrade to V2 because I need a HOTfix urgent....

If you need something "urgent" then pay me to fix it instead of posting spanish screenshots without context.

Also, you checked that you browsed the github repo for duplicates, but there is literally another issue with almost exactly the same title, lol.

Closing as duplicate of https://github.com/mrousavy/react-native-vision-camera/issues/1947.

mrousavy avatar Oct 31 '23 12:10 mrousavy

Thanks @rodgomesc & @zzz08900 for helping out here ❤️

mrousavy avatar Oct 31 '23 12:10 mrousavy