From 2eae5a86d28272b0a30f6c7aa6d8c2add44e0926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=8E=E9=80=9A=E6=B4=B2?= Date: Thu, 27 Feb 2025 00:00:05 +0800 Subject: [PATCH] Camera (macOS): try fixing segfault in macOS 10.15 --- src/detection/camera/camera_apple.m | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/detection/camera/camera_apple.m b/src/detection/camera/camera_apple.m index 45da1246f..e80857744 100644 --- a/src/detection/camera/camera_apple.m +++ b/src/detection/camera/camera_apple.m @@ -16,18 +16,16 @@ const char* ffDetectCamera(FFlist* result) #ifdef MAC_OS_X_VERSION_10_15 FF_SUPPRESS_IO(); // #822 - AVCaptureDeviceType deviceType; + AVCaptureDeviceType deviceType = NULL; #ifdef MAC_OS_VERSION_14_0 if (@available(macOS 14.0, *)) { deviceType = AVCaptureDeviceTypeExternal; } - else #endif - { + if (deviceType == NULL) deviceType = AVCaptureDeviceTypeExternalUnknown; - } AVCaptureDeviceDiscoverySession* session = [AVCaptureDeviceDiscoverySession discoverySessionWithDeviceTypes:@[AVCaptureDeviceTypeBuiltInWideAngleCamera, deviceType] mediaType:AVMediaTypeVideo