Skip to content

Commit

Permalink
custom: Add WebRTCTest
Browse files Browse the repository at this point in the history
Signed-off-by: Patrick José Pereira <[email protected]>
  • Loading branch information
patrickelectric committed Dec 1, 2023
1 parent d280b4f commit ce814c5
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/custom/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,21 @@ use crate::cli;
use crate::video_stream::types::VideoAndStreamInformation;

mod bluerov;
mod test;

#[derive(ValueEnum, PartialEq, Debug, Clone)]
#[clap(rename_all = "verbatim")]
pub enum CustomEnvironment {
BlueROVUDP,
BlueROVRTSP,
WebRTCTest,
}

pub fn create_default_streams() -> Vec<VideoAndStreamInformation> {
match cli::manager::default_settings() {
Some(CustomEnvironment::BlueROVUDP) => bluerov::udp(),
Some(CustomEnvironment::BlueROVRTSP) => bluerov::rtsp(),
Some(CustomEnvironment::WebRTCTest) => test::take_webrtc_stream(),
_ => vec![],
}
}
29 changes: 29 additions & 0 deletions src/custom/test.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
use url::Url;

use crate::stream::types::*;
use crate::video::{self, types::*, video_source_gst::VideoSourceGstType};
use crate::video_stream::types::VideoAndStreamInformation;

pub fn take_webrtc_stream() -> Vec<VideoAndStreamInformation> {
let size = STANDARD_SIZES.last().unwrap();
vec![VideoAndStreamInformation {
name: format!("WebRTC fake stream for thread leak"),
stream_information: StreamInformation {
endpoints: vec![Url::parse("udp://0.0.0.0:8554/video_0").unwrap()],
configuration: CaptureConfiguration::Video(VideoCaptureConfiguration {
encode: VideoEncodeType::H264,
height: size.1,
width: size.0,
frame_interval: FrameInterval {
denominator: 10,
numerator: 1,
},
}),
extended_configuration: None,
},
video_source: VideoSourceType::Gst(video::video_source_gst::VideoSourceGst {
name: "Fake".into(),
source: VideoSourceGstType::Fake("ball".into()),
}),
}]
}

0 comments on commit ce814c5

Please sign in to comment.