Fix for older Apple cameras (#153)

This commit is contained in:
Nikolay Igotti
2024-03-07 04:58:08 +03:00
committed by GitHub
parent c0940321d7
commit c5a56bd2c8
+2 -3
View File
@@ -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(),