From c5a56bd2c89c6f7e8ac68f1772fbe01e138640f8 Mon Sep 17 00:00:00 2001 From: Nikolay Igotti Date: Thu, 7 Mar 2024 04:58:08 +0300 Subject: [PATCH] Fix for older Apple cameras (#153) --- nokhwa-bindings-macos/src/lib.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/nokhwa-bindings-macos/src/lib.rs b/nokhwa-bindings-macos/src/lib.rs index 9e78d07..4cb8cc9 100644 --- a/nokhwa-bindings-macos/src/lib.rs +++ b/nokhwa-bindings-macos/src/lib.rs @@ -995,15 +995,14 @@ mod internal { msg_send![format.internal, videoSupportedFrameRateRanges] }) { let max_fps: f64 = unsafe { msg_send![range.inner, maxFrameRate] }; - - if (f64::from(descriptor.frame_rate()) - max_fps).abs() < 0.01 { + // Older Apple cameras (i.e. iMac 2013) return 29.97000002997 as FPS. + if (f64::from(descriptor.frame_rate()) - max_fps).abs() < 0.999 { selected_range = range.inner; break; } } } } - if selected_range.is_null() || selected_format.is_null() { return Err(NokhwaError::SetPropertyError { property: "CameraFormat".to_string(),