fix: use default camera, first element in query result might not be a camera (#12010)
This commit is contained in:
parent
645cfd3b3d
commit
05a812247a
@ -49,7 +49,7 @@ impl Cameras {
|
|||||||
let Some(info) = cameras.first() else {
|
let Some(info) = cameras.first() else {
|
||||||
bail!("No camera found")
|
bail!("No camera found")
|
||||||
};
|
};
|
||||||
let camera = Self::create_camera(info.index())?;
|
let camera = Self::create_camera(&CameraIndex::Index(0))?;
|
||||||
let resolution = camera.resolution();
|
let resolution = camera.resolution();
|
||||||
let (width, height) = (resolution.width() as i32, resolution.height() as i32);
|
let (width, height) = (resolution.width() as i32, resolution.height() as i32);
|
||||||
camera_displays.push(DisplayInfo {
|
camera_displays.push(DisplayInfo {
|
||||||
@ -112,7 +112,7 @@ impl Cameras {
|
|||||||
fn create_camera(index: &CameraIndex) -> ResultType<Camera> {
|
fn create_camera(index: &CameraIndex) -> ResultType<Camera> {
|
||||||
let result = Camera::new(
|
let result = Camera::new(
|
||||||
index.clone(),
|
index.clone(),
|
||||||
RequestedFormat::new::<RgbAFormat>(RequestedFormatType::AbsoluteHighestResolution),
|
RequestedFormat::new::<RgbAFormat>(RequestedFormatType::None),
|
||||||
);
|
);
|
||||||
match result {
|
match result {
|
||||||
Ok(camera) => Ok(camera),
|
Ok(camera) => Ok(camera),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user