From ed5aea0eff32eb860b5e94704e9c7e384d36d82b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Ant=C3=B4nio=20Cardoso?= Date: Wed, 31 Aug 2022 17:02:36 -0300 Subject: [PATCH] src: settings, stream: Fix VideoSourceLocal constructed in tests. --- src/settings/manager.rs | 6 +++++- src/stream/stream_backend.rs | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/settings/manager.rs b/src/settings/manager.rs index 495a5aa1..c4620c48 100644 --- a/src/settings/manager.rs +++ b/src/settings/manager.rs @@ -210,6 +210,7 @@ mod tests { use crate::stream::types::{ CaptureConfiguration, StreamInformation, VideoCaptureConfiguration, }; + use crate::video::video_source_local::LocalSourceDevice; use crate::video::{ types::{FrameInterval, VideoEncodeType, VideoSourceType}, video_source_local::{VideoSourceLocal, VideoSourceLocalType}, @@ -267,7 +268,10 @@ mod tests { }, video_source: VideoSourceType::Local(VideoSourceLocal { name: "Fake Potato Test Video Source Camera".into(), - device_path: "/dev/potatovideo".into(), + devices: vec![LocalSourceDevice { + path: "/dev/potatovideo".into(), + encodings: vec![VideoEncodeType::H264], + }], typ: VideoSourceLocalType::Usb("usb-0420:08:47.42-77".into()), }), }]; diff --git a/src/stream/stream_backend.rs b/src/stream/stream_backend.rs index 651b6613..5703325f 100644 --- a/src/stream/stream_backend.rs +++ b/src/stream/stream_backend.rs @@ -299,6 +299,7 @@ fn create_stream( mod tests { use super::*; use crate::stream::types::CaptureConfiguration; + use crate::video::video_source_local::LocalSourceDevice; use crate::video::{ types::FrameInterval, video_source_local::{VideoSourceLocal, VideoSourceLocalType}, @@ -327,11 +328,16 @@ mod tests { }, video_source: VideoSourceType::Local(VideoSourceLocal { name: "PotatoCam".into(), - device_path: "/dev/video42".into(), + devices: vec![LocalSourceDevice { + path: "/dev/video42".into(), + encodings: vec![video_encode_type.clone()], + }], typ: VideoSourceLocalType::Usb("TestPotatoCam".into()), }), }); + dbg!(&stream); + assert!(stream.is_ok()); stream.unwrap() } @@ -353,6 +359,8 @@ mod tests { StreamType::UDP(video_stream_udp) => video_stream_udp.pipeline(), _any_other_stream_type => panic!("Failed to create UDP stream: {stream:?}."), }; + dbg!(&pipeline); + dbg!(&expected_pipeline); assert_eq!(&pipeline, expected_pipeline); } } @@ -374,6 +382,8 @@ mod tests { StreamType::RTSP(video_stream_rtsp) => video_stream_rtsp.pipeline(), _any_other_stream_type => panic!("Failed to create RTSP stream: {stream:?}."), }; + dbg!(&pipeline); + dbg!(&expected_pipeline); assert_eq!(&pipeline, expected_pipeline); } } @@ -463,6 +473,8 @@ mod tests { StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(), _any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."), }; + dbg!(&pipeline); + dbg!(&expected_pipeline); assert_eq!(&pipeline, expected_pipeline); } } @@ -484,6 +496,8 @@ mod tests { StreamType::WEBRTC(video_stream_webrtc) => video_stream_webrtc.pipeline(), _any_other_stream_type => panic!("Failed to create WebRTC stream: {stream:?}."), }; + dbg!(&pipeline); + dbg!(&expected_pipeline); assert_eq!(&pipeline, expected_pipeline); } }