desktop: open camera check
This commit is contained in:
parent
d6ec4213ab
commit
c3fae38d5c
1 changed files with 25 additions and 26 deletions
|
@ -226,8 +226,7 @@ impl Desktop {
|
||||||
|
|
||||||
let ctx = PlatformContext::default();
|
let ctx = PlatformContext::default();
|
||||||
let devices = ctx.devices().unwrap();
|
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 streams = dev.streams().unwrap();
|
||||||
let stream_desc = streams[0].clone();
|
let stream_desc = streams[0].clone();
|
||||||
let w = stream_desc.width;
|
let w = stream_desc.width;
|
||||||
|
@ -239,7 +238,6 @@ impl Desktop {
|
||||||
// Stop if camera was stopped.
|
// Stop if camera was stopped.
|
||||||
if stop_camera.load(Ordering::Relaxed) {
|
if stop_camera.load(Ordering::Relaxed) {
|
||||||
stop_camera.store(false, Ordering::Relaxed);
|
stop_camera.store(false, Ordering::Relaxed);
|
||||||
// Clear image.
|
|
||||||
let mut w_image = LAST_CAMERA_IMAGE.write();
|
let mut w_image = LAST_CAMERA_IMAGE.write();
|
||||||
*w_image = None;
|
*w_image = None;
|
||||||
break;
|
break;
|
||||||
|
@ -259,6 +257,7 @@ impl Desktop {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
/// Last captured image from started camera.
|
/// Last captured image from started camera.
|
||||||
|
|
Loading…
Reference in a new issue