Skip to content

Commit

Permalink
update with master
Browse files Browse the repository at this point in the history
  • Loading branch information
wkazmierczak committed Jan 14, 2025
1 parent bee8ff3 commit 01da58b
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 22 deletions.
36 changes: 20 additions & 16 deletions compositor_pipeline/src/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub struct Options {
pub wgpu_features: WgpuFeatures,
pub load_system_fonts: Option<bool>,
pub wgpu_ctx: Option<GraphicsContext>,
pub whip_whep_server_port: u16,
pub whip_whep_server_port: Option<u16>,
pub start_whip_whep: bool,
pub tokio_rt: Option<Arc<Runtime>>,
}
Expand Down Expand Up @@ -204,23 +204,27 @@ impl Pipeline {
let whip_whep_state = WhipWhepState::new(stun_servers.clone());
let start_whip_whep = opts.start_whip_whep;
let shutdown_whip_whep_sender = if start_whip_whep {
let port = opts.whip_whep_server_port;
let whip_whep_state = whip_whep_state.clone();
let (sender, receiver) = oneshot::channel();
let (init_result_sender, init_result_receiver) = oneshot::channel();
tokio_rt.spawn(async move {
run_whip_whep_server(port, whip_whep_state, receiver, init_result_sender).await
});
match init_result_receiver.blocking_recv() {
Ok(init_result) => init_result?,
Err(err) => {
error!(
"Error while receiving WHIP WHEP server initialization result {:?}",
err
)
if let Some(port) = opts.whip_whep_server_port {
let whip_whep_state = whip_whep_state.clone();
let (sender, receiver) = oneshot::channel();
let (init_result_sender, init_result_receiver) = oneshot::channel();
tokio_rt.spawn(async move {
run_whip_whep_server(port, whip_whep_state, receiver, init_result_sender).await
});
match init_result_receiver.blocking_recv() {
Ok(init_result) => init_result?,
Err(err) => {
error!(
"Error while receiving WHIP WHEP server initialization result {:?}",
err
)
}
}
Some(sender)
} else {
error!("WHIP WHEP server port not specified.");
None
}
Some(sender)
} else {
None
};
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/examples/raw_channel_input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fn main() {
wgpu_features: config.required_wgpu_features,
load_system_fonts: Some(true),
wgpu_ctx: Some(ctx),
whip_whep_server_port: config.whip_whep_server_port,
whip_whep_server_port: Some(config.whip_whep_server_port),
start_whip_whep: config.start_whip_whep,
tokio_rt: Some(Arc::new(Runtime::new().unwrap())),
})
Expand Down
2 changes: 1 addition & 1 deletion integration_tests/examples/raw_channel_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn main() {
wgpu_features: config.required_wgpu_features,
load_system_fonts: Some(true),
wgpu_ctx: Some(ctx),
whip_whep_server_port: config.whip_whep_server_port,
whip_whep_server_port: Some(config.whip_whep_server_port),
start_whip_whep: config.start_whip_whep,
tokio_rt: Some(Arc::new(Runtime::new().unwrap())),
})
Expand Down
2 changes: 2 additions & 0 deletions integration_tests/src/bin/benchmark/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,8 @@ fn run_single_test(ctx: GraphicsContext, bench_config: SingleBenchConfig) -> boo
stream_fallback_timeout: Duration::from_millis(500),
tokio_rt: None,
stun_servers: Vec::new().into(),
whip_whep_server_port: None,
start_whip_whep: false,
});

let Ok((pipeline, _event_loop)) = pipeline_result else {
Expand Down
4 changes: 1 addition & 3 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,7 @@ fn try_read_config() -> Result<Config, String> {
};

let start_whip_whep = match env::var("LIVE_COMPOSITOR_START_WHIP_WHEP_SERVER") {
Ok(start_whip_whep) => start_whip_whep
.parse::<bool>()
.map_err(|_| "LIVE_COMPOSITOR_START_WHIP_WHEP_SERVER has to be boolean value")?,
Ok(enable) => bool_env_from_str(&enable).unwrap_or(true),
Err(_) => true,
};

Expand Down
2 changes: 1 addition & 1 deletion src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ impl ApiState {
wgpu_ctx: None,
load_system_fonts: Some(true),
start_whip_whep,
whip_whep_server_port,
whip_whep_server_port: Some(whip_whep_server_port),
tokio_rt: Some(runtime),
})?;
Ok((
Expand Down

0 comments on commit 01da58b

Please sign in to comment.