Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces'. #2892

Closed
3 of 5 tasks
short-dsb opened this issue May 20, 2024 · 9 comments
Labels
馃悰 bug Something isn't working

Comments

@short-dsb
Copy link

What's happening?

This iOS crash appears to be a new instance of #198 on v4.0.4.

Reproduceable Code

const camera = useRef<CameraRef>(null);
// ...
const device = useCameraDevice("back", {
  physicalDevices: [
    "ultra-wide-angle-camera",
    "wide-angle-camera",
    "telephoto-camera",
  ],
});
// ...
const format = useCameraFormat(device, [
  {
    photoAspectRatio: 1,
  },
  {
    videoAspectRatio: 1,
  },
  {
    photoResolution: {
      height: MAX_IMAGE_DIMENSION,
      width: MAX_IMAGE_DIMENSION,
    },
  },
  {
    videoResolution: {
      height: MAX_IMAGE_DIMENSION,
      width: MAX_IMAGE_DIMENSION,
    },
  },
]);
// ...
<Camera
  ref={camera}
  device={device}
  enableZoomGesture={true}
  isActive={isActive}
  photo={true}
  resizeMode="contain"
  style={styles.camera}
/>

Relevant log output

SIGABRT (#0): Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '*** -[AVCaptureDevice setActiveColorSpace:] Not supported - use activeFormat.supportedColorSpaces'.
0   CoreFoundation                      0x000000019cb9eb28 0x19cab2000 + 969512
1   libobjc.A.dylib                     0x00000001949eaf78 0x1949c0000 + 175992
2   AVFCapture                          0x00000001b9a3daac 0x1b99a3000 + 633516
3   libdispatch.dylib                   0x00000001a49aedd4 0x1a49ab000 + 15828
4   libdispatch.dylib                   0x00000001a49be2c4 0x1a49ab000 + 78532
5   AVFCapture                          0x00000001b9a3d948 0x1b99a3000 + 633160
6   Foundation                          0x000000019b9d4b0c 0x19b949000 + 572172
7   Foundation                          0x000000019b9d4884 0x19b949000 + 571524
8   Foundation                          0x000000019ba6e264 0x19b949000 + 1200740
9   AVFCapture                          0x00000001b99a971c 0x1b99a3000 + 26396
10  AVFCapture                          0x00000001b99a7e10 0x1b99a3000 + 19984
11  AVFCapture                          0x00000001b99a7b94 0x1b99a3000 + 19348
12  AVFCapture                          0x00000001b99aaf3c 0x1b99a3000 + 32572
13  shortboxed                          0x0000000104c16300 0x104030000 + 12477184
14  shortboxed                          0x0000000104c12830 0x104030000 + 12462128
15  shortboxed                          0x00000001040b4d1c 0x104030000 + 544028
16  libdispatch.dylib                   0x00000001a49ad13c 0x1a49ab000 + 8508
17  libdispatch.dylib                   0x00000001a49aedd4 0x1a49ab000 + 15828
18  libdispatch.dylib                   0x00000001a49b6400 0x1a49ab000 + 46080
19  libdispatch.dylib                   0x00000001a49b6f30 0x1a49ab000 + 48944
20  libdispatch.dylib                   0x00000001a49c1cb4 0x1a49ab000 + 93364
21  libdispatch.dylib                   0x00000001a49c1528 0x1a49ab000 + 91432
22  libsystem_pthread.dylib             0x00000001f8a94f20 0x1f8a93000 + 7968
23  libsystem_pthread.dylib             0x00000001f8a94fc0 0x1f8a93000 + 8128

Camera Device

// This is a production issue discovered via analytics; we do not have a local repro.

Device

iOS 17.4.1

VisionCamera Version

4.0.4

Can you reproduce this issue in the VisionCamera Example app?

No, I cannot reproduce the issue in the Example app

Additional information

@short-dsb short-dsb added the 馃悰 bug Something isn't working label May 20, 2024
@mrousavy
Copy link
Owner

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?

@short-dsb
Copy link
Author

Hm. Maybe this user was on an older version. I don鈥檛 see any repeats of this particular issue today. Thanks for taking a look. 馃檪

@mars-lan
Copy link

mars-lan commented Jun 20, 2024

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.

@mrousavy
Copy link
Owner

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

@mars-lan
Copy link

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

@mrousavy
Copy link
Owner

@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.

@mars-lan
Copy link

@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).

@mrousavy
Copy link
Owner

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 馃槄

@mars-lan
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
馃悰 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants