desktop: open camera check

This commit is contained in:
ardocrat 2024-09-15 15:54:07 +03:00
parent d6ec4213ab
commit c3fae38d5c

View file

@ -226,8 +226,7 @@ impl Desktop {
let ctx = PlatformContext::default();
let devices = ctx.devices().unwrap();
let dev = ctx.open_device(&devices[0].uri).unwrap();
if let Ok(dev) = ctx.open_device(&devices[0].uri) {
let streams = dev.streams().unwrap();
let stream_desc = streams[0].clone();
let w = stream_desc.width;
@ -239,7 +238,6 @@ impl Desktop {
// Stop if camera was stopped.
if stop_camera.load(Ordering::Relaxed) {
stop_camera.store(false, Ordering::Relaxed);
// Clear image.
let mut w_image = LAST_CAMERA_IMAGE.write();
*w_image = None;
break;
@ -259,6 +257,7 @@ impl Desktop {
}
}
}
}
lazy_static! {
/// Last captured image from started camera.