Skip to content

Commit

Permalink
Fix for older Apple cameras (#153)
Browse files Browse the repository at this point in the history
  • Loading branch information
olonho authored Mar 7, 2024
1 parent c094032 commit c5a56bd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions nokhwa-bindings-macos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit c5a56bd

Please sign in to comment.