Conversation
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.
ikuo
force-pushed
the
fix/usb-camera-set_all-0.10
branch
from
August 14, 2026 14:07
3a6bd59 to
93f7707
Compare
ikuo
marked this pull request as ready for review
August 14, 2026 14:34
|
Also addressed in my #246, which also fixes other bugs for macOS support on 0.10. There's also my nokhwa = { git = "https://github.com/akx/nokhwa", branch = "looser-core-video-sys" } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
(appended)
I just realized this duplicates #248, which fixes the same root cause (#247) and is already open. Sorry for the overlap.
Mine is intentionally minimal (a one-line break once a compatible format/range pair is found), so feel free to close this PR if #248 is preferable. No hard feelings either way.