Skip to content

Commit

Permalink
Merge branch 'master' into WHIP-server
Browse files Browse the repository at this point in the history
  • Loading branch information
wkazmierczak committed Jan 14, 2025
2 parents 01da58b + c030d0f commit eb9784e
Show file tree
Hide file tree
Showing 7 changed files with 98 additions and 37 deletions.
85 changes: 52 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,10 @@ rand = { workspace = true }
reqwest = { workspace = true }
rubato = { workspace = true }
tokio = { workspace = true }
axum = { version = "0.7.4", features = ["ws"] }
axum = { version = "0.7.4", features = ["ws", "multipart"] }
futures-util = { workspace = true }
wgpu = { workspace = true }
glyphon = { workspace = true }
http-body-util = "0.1.2"

[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ fn main() {
wgpu_features: config.required_wgpu_features,
load_system_fonts: Some(true),
tokio_rt: Some(Arc::new(Runtime::new().unwrap())),
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,
})
.unwrap();
Expand Down
7 changes: 7 additions & 0 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ pub struct Config {
pub output_sample_rate: u32,
pub stun_servers: Arc<Vec<String>>,
pub required_wgpu_features: WgpuFeatures,
pub load_system_fonts: bool,
pub whip_whep_server_port: u16,
pub start_whip_whep: bool,
}
Expand Down Expand Up @@ -193,6 +194,11 @@ fn try_read_config() -> Result<Config, String> {
Err(_) => queue::DEFAULT_BUFFER_DURATION,
};

let load_system_fonts = match env::var("LIVE_COMPOSITOR_LOAD_SYSTEM_FONTS") {
Ok(enable) => bool_env_from_str(&enable).unwrap_or(true),
Err(_) => true,
};

let whip_whep_server_port = match env::var("LIVE_COMPOSITOR_WHIP_WHEP_SERVER_PORT") {
Ok(whip_whep_port) => whip_whep_port
.parse::<u16>()
Expand Down Expand Up @@ -250,6 +256,7 @@ fn try_read_config() -> Result<Config, String> {
output_sample_rate,
stun_servers,
required_wgpu_features,
load_system_fonts,
whip_whep_server_port,
start_whip_whep,
};
Expand Down
3 changes: 3 additions & 0 deletions src/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ pub fn routes(state: ApiState) -> Router {
.route("/:id/register", post(register_request::handle_shader))
.route("/:id/unregister", post(unregister_request::handle_shader));

let font = Router::new().route("/register", post(register_request::handle_font));

async fn handle_start(State(state): State<ApiState>) -> Result<Response, ApiError> {
Pipeline::start(&state.pipeline);
Ok(Response::Ok {})
Expand All @@ -67,6 +69,7 @@ pub fn routes(state: ApiState) -> Router {
.nest("/api/image", image)
.nest("/api/web-renderer", web)
.nest("/api/shader", shader)
.nest("/api/font", font)
// Start request
.route("/api/start", post(handle_start))
// WebSocket - events
Expand Down
Loading

0 comments on commit eb9784e

Please sign in to comment.