Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Camera::new panicking on macOS using C922 webcam #180

Open
Brendonovich opened this issue Oct 7, 2024 · 1 comment
Open

Camera::new panicking on macOS using C922 webcam #180

Brendonovich opened this issue Oct 7, 2024 · 1 comment
Milestone

Comments

@Brendonovich
Copy link

Brendonovich commented Oct 7, 2024

Here we are calling Camera::new
https://github.com/CapSoftware/Cap/blob/8abfc996cd7077058bc610e1dd8f76677d4e44db/apps/desktop/src-tauri/src/camera.rs#L124-L126

When accessing the builtin Macbook Pro camera everything works fine, but with a C922 connected via USB nokhwa panics:

   0: rust_begin_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:112:18
   2: core::panicking::panic_nounwind_fmt
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:122:5
   3: core::panicking::panic_nounwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:221:5
   4: core::panicking::panic_cannot_unwind
             at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:309:5
   5: objc_exception::try_no_ret::try_objc_execute_closure
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:30:5
   6: RustObjCExceptionTryCatch
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/extern/exception.m:10:9
   7: objc_exception::try_no_ret
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:44:19
   8: objc_exception::try
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc_exception-0.1.2/src/lib.rs:67:9
   9: objc::exception::try
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/exception.rs:8:5
  10: objc::message::platform::send_unverified
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/mod.rs:12:9
  11: objc::message::send_message
             at /Users/brendonovich/.cargo/registry/src/index.crates.io-6f17d22bba15001f/objc-0.2.7/src/message/mod.rs:178:5
  12: nokhwa_bindings_macos::internal::AVCaptureDevice::set_all
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/nokhwa-bindings-macos/src/lib.rs:1027:17
  13: nokhwa::backends::capture::avfoundation::AVFoundationCaptureDevice::new
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/src/backends/capture/avfoundation.rs:76:9
  14: nokhwa::camera::init_avfoundation
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/src/camera.rs:461:27
  15: nokhwa::camera::init_camera
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/src/camera.rs:490:47
  16: nokhwa::camera::Camera::with_backend
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/src/camera.rs:55:30
  17: nokhwa::camera::Camera::new
             at /Users/brendonovich/github.com/l1npengtul/nokhwa/src/camera.rs:44:9
  18: desktop_solid_lib::camera::start_capturing::{{closure}}::{{closure}}
             at ./src/camera.rs:126:30

Looks like one of these msg_send are panicking, I'm at a loss as to why.

let _: () = unsafe {
msg_send![self.inner, setValue:min_frame_duration forKey:active_video_min_frame_duration]
};
let _: () = unsafe {
msg_send![self.inner, setValue:min_frame_duration forKey:active_video_max_frame_duration]
};

nokwha version: 0.10.4
macOS version: 14.6.1

@l1npengtul
Copy link
Owner

The MacOS backend was written with pure tears and pain. I don't know either. Someone else wrote a complete from-scratch rewrite of macos backend using newly available crates, this will probably be fixed 0.11

@l1npengtul l1npengtul added this to the 0.11 milestone Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants