fix(ios): guard unsupportedCaptureOutputClasses against SimCam crash on simulator#3826
Closed
therealpurplemana wants to merge 1 commit intomrousavy:mainfrom
Closed
fix(ios): guard unsupportedCaptureOutputClasses against SimCam crash on simulator#3826therealpurplemana wants to merge 1 commit intomrousavy:mainfrom
therealpurplemana wants to merge 1 commit intomrousavy:mainfrom
Conversation
…ent(simulator) SimCam injects a DummyCaptureDeviceFormat into the iOS Simulator to fake camera input. When VisionCamera's ConstraintResolver calls supportsOutput() on startup, it reads unsupportedCaptureOutputClasses, which internally calls isStreamingDisparitySupported. That method crashes with SIGSEGV (null pointer dereference at offset 0x59) because SimCam's dummy format doesn't implement it. On simulator, skip the output class check entirely — the camera is fake anyway and all outputs can be assumed supported. Crash stack: AVCaptureDeviceFormat.isStreamingDisparitySupported <-- SIGSEGV AVCaptureDeviceFormat.unsupportedCaptureOutputClasses AVCaptureDeviceFormat.supportsOutput (this file) ConstraintResolver.filterFormats HybridCameraSession.configureConnection
|
@therealpurplemana is attempting to deploy a commit to the Margelo Team on Vercel. A member of the Team first needs to authorize it. |
Owner
|
It sounds like that might be a bug in SimCam though, if it crashes there? |
Author
|
It’s hard to say. It might be. But removing the check in a simulator
environment should be low enough risk to let us further expose that or
encourage them to fix upstream. It seems to occur because the SimCam
doesn’t expose the camera information in time for RNVC.
…On Wed, Apr 29, 2026 at 11:51 PM Marc Rousavy ***@***.***> wrote:
*mrousavy* left a comment (mrousavy/react-native-vision-camera#3826)
<#3826 (comment)>
It sounds like that might be a bug in SimCam though, if it crashes there?
—
Reply to this email directly, view it on GitHub
<#3826 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATTERSZWKCDF423Y2LEYVXD4YLZYZAVCNFSM6AAAAACYLV4MP2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHM2DGNJQGI4DMNRWGQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Owner
|
Apparently this has been fixed upstream in StreamCam today, so we shouldn't need this workaround anymore :) Thanks anyways! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using SimCam (Software Mansion's simulator camera injection tool) with VisionCamera on the iOS Simulator, the app crashes immediately on launch with
EXC_BAD_ACCESS (SIGSEGV)on thecom.margelo.camera.sessionqueue.Crash stack:
Root cause: SimCam injects a
DummyCaptureDeviceFormatinto the simulator. WhenConstraintResolver.filterFormatscallsformat.supportsOutput()for each camera format at session startup, it readsunsupportedCaptureOutputClasses, which internally callsisStreamingDisparitySupported. SimCam's dummy format has a null ivar at offset0x59for this property, causing the crash.Fix
Guard
unsupportedCaptureOutputClassesbehind#if targetEnvironment(simulator). On the simulator the camera is fake regardless, so assuming all outputs are supported is correct and safe.Testing
Tested on iOS Simulator (iOS 26.3) with SimCam running — app no longer crashes on launch and the simulated camera feed displays correctly. Tested iPhone Air device confirming camera working correctly. Tested on Android Pixel 8 confirming camera working correctly.