Code Monkey home page Code Monkey logo

Comments (13)

short-dsb avatar short-dsb commented on September 26, 2024 1

Hm. Maybe this user was on an older version. I don’t see any repeats of this particular issue today. Thanks for taking a look. πŸ™‚

from react-native-vision-camera.

mars-lan avatar mars-lan commented on September 26, 2024 1

Can confirm that this is still happening with 4.3.2. Here's the symbolicated stack traces:

          Fatal Exception: NSInvalidArgumentException
0  CoreFoundation                 0x83f20 __exceptionPreprocess
1  libobjc.A.dylib                0x16018 objc_exception_throw
2  AVFCapture                     0x59d90 __61-[AVCaptureDeferredPhotoProcessor _establishServerConnection]_block_invoke
3  libdispatch.dylib              0x3dd4 _dispatch_client_callout
4  libdispatch.dylib              0x132c4 _dispatch_lane_barrier_sync_invoke_and_complete
5  AVFCapture                     0x5d7ec -[AVCaptureFigVideoDevice setActiveColorSpace:]
6  Foundation                     0x147c0c -[NSObject(NSKeyValueObservingPrivate) _changeValueForKeys:count:maybeOldValuesDict:maybeNewValuesDict:usingBlock:]
7  Foundation                     0x1478ac -[NSObject(NSKeyValueObservingPrivate) _changeValueForKey:key:key:usingBlock:]
8  Foundation                     0x1467e8 _NSSetLongLongValueAndNotify
9  AVFCapture                     0xb698 -[AVCaptureSession _updateDeviceActiveFormatsAndActiveConnections]
10 AVFCapture                     0x28498 -[AVCaptureSession _buildAndRunGraph:]
11 AVFCapture                     0x2821c -[AVCaptureSession _commitConfiguration]
12 AVFCapture                     0x20cf4 -[AVCaptureSession addOutput:]
13 <app_name>                     0x6bdac8 CameraSession.configureOutputs(configuration:) + 16 (AVCapturePhotoOutput.QualityPrioritization+descriptor.swift:16)
14 <app_name>                     0x6b9fe4 closure #1 in CameraSession.configure(_:) + 135 (CameraSession.swift:135)
15 <app_name>                     0x8abcc thunk for @escaping @callee_guaranteed @Sendable () -> () (<compiler-generated>)

@mrousavy please consider reopening this issue.

from react-native-vision-camera.

mars-lan avatar mars-lan commented on September 26, 2024 1

Well then it might be an iOS bug? I don't see anything in the stacktrace that I'm doing wrong.. Also I can't reproduce this πŸ˜…

It's possible. We also can't reproduce this ourselves either. Seen this on 7 different devices so far in Crashlytics so it's not exactly rare.

from react-native-vision-camera.

mrousavy avatar mrousavy commented on September 26, 2024 1

Interesting - yea can you just set that on your end and let me know if it fixed anything? You can put that inside the configure block.

from react-native-vision-camera.

mrousavy avatar mrousavy commented on September 26, 2024

I don't even have activeColorSpace in the codebase. This was in V2, but not in V3 or V4. Are you sure you are on 4.0.4?

from react-native-vision-camera.

mrousavy avatar mrousavy commented on September 26, 2024

This is a completely different issue @mars-lan. Also, what is the NSInvalidArgumentException's message? There's only a stacktrace, but no error.

from react-native-vision-camera.

mars-lan avatar mars-lan commented on September 26, 2024

This is a completely different issue @mars-lan. Also, what is the NSInvalidArgumentException's message? There's only a stacktrace, but no error.

My bad. Here's the missing error message for NSInvalidArgumentException, which is why I believe it's the same issue.

Fatal Exception: NSInvalidArgumentException
*** -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces

from react-native-vision-camera.

mrousavy avatar mrousavy commented on September 26, 2024

@mars-lan you're either on VisionCamera V2 (which is by far no longer supported), or this is an Apple bug. As I said above, activeColorSpace is not used by VisionCamera anymore.

from react-native-vision-camera.

mars-lan avatar mars-lan commented on September 26, 2024

@mars-lan you're either on VisionCamera V2 (which is by far no longer supported), or this is an Apple bug. As I said above, activeColorSpace is not used by VisionCamera anymore.

The app is using VisionCamera 4.3.2. You're correct that it doesn't set activeColorSpace directly, but based on the stack traces, the function is eventually invoked by AVFCapture:

5  AVFCapture                     0x5d7ec -[AVCaptureFigVideoDevice setActiveColorSpace:]

FWIW, we've seen this issue on iOS 16.5.1, 17.3.1 & 17.5.1 for various iPhone models (12, 13, 15).

from react-native-vision-camera.

mrousavy avatar mrousavy commented on September 26, 2024

Well then it might be an iOS bug? I don't see anything in the stacktrace that I'm doing wrong..
Also I can't reproduce this πŸ˜…

from react-native-vision-camera.

short-dsb avatar short-dsb commented on September 26, 2024

I don’t see any repeats of this particular issue today.

Just an update that we’re still seeing this issue periodically. As @mars-lan said, it seems to affect a variety of models and iOS versions.

Per this Stack Overflow comment, a workaround may be to set automaticallyConfiguresCaptureDeviceForWideColor to false on the AVCaptureSession instance. Worth a shot?

from react-native-vision-camera.

foratbahrani avatar foratbahrani commented on September 26, 2024

Same here, found this on firebase crashlytics + users reporting it, but can't reproduce it myself.

from react-native-vision-camera.

short-dsb avatar short-dsb commented on September 26, 2024

@mrousavy We haven’t seen this issue since we applied the workaround, although it’s only been a couple weeks. At the very least, there seem to be no undesirable side effects.

If anyone wants to try this as well and maybe get more signal, you can apply the following diff via patch-package.

diff --git a/node_modules/react-native-vision-camera/ios/Core/CameraSession.swift b/node_modules/react-native-vision-camera/ios/Core/CameraSession.swift
index 10b0f33..587b92e 100644
--- a/node_modules/react-native-vision-camera/ios/Core/CameraSession.swift
+++ b/node_modules/react-native-vision-camera/ios/Core/CameraSession.swift
@@ -132,6 +132,9 @@ final class CameraSession: NSObject, AVCaptureVideoDataOutputSampleBufferDelegat
       VisionLogger.log(level: .info, message: "configure { ... }: Updating CameraSession Configuration... \(difference)")
 
       do {
+        // https://github.com/mrousavy/react-native-vision-camera/issues/2892
+        self.captureSession.automaticallyConfiguresCaptureDeviceForWideColor = false;
+
         // If needed, configure the AVCaptureSession (inputs, outputs)
         if difference.isSessionConfigurationDirty {
           self.captureSession.beginConfiguration()

from react-native-vision-camera.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.