Skip to content

Commit 93f7707

Browse files
Ikuo Matsumuraikuo
authored andcommitted
fix(macos): pair compatible format/range in set_all
Previously, when a camera advertises the requested resolution under multiple formats (e.g. a UVC camera exposing 720p at both 30fps and 5fps), the outer loop overwrote for each resolution-matching format while was left pointing at an earlier format's frame rate. The resulting activeFormat + activeVideoMinFrameDuration mismatch made AVFoundation throw NSInvalidArgumentException, which unwinds through nokhwa's non-unwinding objc exception bridge and hard-aborts the process. Break out of the loop as soon as a format provides a frame-rate range compatible with the requested fps, so selected_format and selected_range always come from the same AVCaptureDeviceFormat.
1 parent fa5a192 commit 93f7707

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • nokhwa-bindings-macos/src

‎nokhwa-bindings-macos/src/lib.rs‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1058,6 +1058,10 @@ mod internal {
10581058
break;
10591059
}
10601060
}
1061+
// avoid pairing activeFormat with a range from a different format
1062+
if !selected_range.is_null() {
1063+
break;
1064+
}
10611065
}
10621066
}
10631067
if selected_range.is_null() || selected_format.is_null() {

0 commit comments

Comments
 (0)