diff --git a/Cargo.lock b/Cargo.lock index d85f2fa..fb5e015 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1658,7 +1658,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2" [[package]] name = "lesavka_client" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "async-stream", @@ -1692,7 +1692,7 @@ dependencies = [ [[package]] name = "lesavka_common" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "base64", @@ -1704,7 +1704,7 @@ dependencies = [ [[package]] name = "lesavka_server" -version = "0.24.0" +version = "0.25.0" dependencies = [ "anyhow", "base64", diff --git a/client/Cargo.toml b/client/Cargo.toml index fceb3e2..780d24f 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -4,7 +4,7 @@ path = "src/main.rs" [package] name = "lesavka_client" -version = "0.24.0" +version = "0.25.0" edition = "2024" [dependencies] diff --git a/common/Cargo.toml b/common/Cargo.toml index 6481ac3..e958fe3 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lesavka_common" -version = "0.24.0" +version = "0.25.0" edition = "2024" build = "build.rs" diff --git a/scripts/install/server.sh b/scripts/install/server.sh index a96d34f..cc638ac 100755 --- a/scripts/install/server.sh +++ b/scripts/install/server.sh @@ -356,7 +356,7 @@ LESAVKA_UVC_HEIGHT=$(uvc_env_value LESAVKA_UVC_HEIGHT 720) LESAVKA_UVC_CODEC=${INSTALL_UVC_CODEC} LESAVKA_UVC_BLOCKING=$(uvc_env_value LESAVKA_UVC_BLOCKING 1) LESAVKA_UVC_CONTROL_READ_ONLY=$(uvc_env_value LESAVKA_UVC_CONTROL_READ_ONLY 0) -LESAVKA_UVC_QUEUE_PACING=$(uvc_env_value LESAVKA_UVC_QUEUE_PACING 0) +LESAVKA_UVC_QUEUE_PACING=$(uvc_env_value LESAVKA_UVC_QUEUE_PACING 1) LESAVKA_UVC_MAXBURST=$(uvc_env_value LESAVKA_UVC_MAXBURST 0) LESAVKA_UVC_BULK=$(uvc_env_value LESAVKA_UVC_BULK 1) LESAVKA_UVC_FRAME_SIZE_GUARD=$(uvc_env_value LESAVKA_UVC_FRAME_SIZE_GUARD 1) diff --git a/server/Cargo.toml b/server/Cargo.toml index d68439e..18ca391 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -16,7 +16,7 @@ bench = false [package] name = "lesavka_server" -version = "0.24.0" +version = "0.25.0" edition = "2024" autobins = false diff --git a/server/src/bin/lesavka-uvc.real.inc b/server/src/bin/lesavka-uvc.real.inc index a819003..4e1b0b0 100644 --- a/server/src/bin/lesavka-uvc.real.inc +++ b/server/src/bin/lesavka-uvc.real.inc @@ -51,6 +51,7 @@ const IDLE_MJPEG_FRAME: &[u8] = include_bytes!("lesavka_uvc/idle_1280x720_black. const DEFAULT_UVC_BUFFER_COUNT: u32 = 4; const DEFAULT_UVC_IDLE_PUMP_MS: u64 = 2; const DEFAULT_UVC_FRAME_MAX_AGE_MS: u64 = 1_000; +const DEFAULT_UVC_QUEUE_PACING: bool = true; const DEFAULT_UVC_MJPEG_BUDGET_BYTES_PER_SEC: u32 = 10_000_000; const DEFAULT_UVC_ISOCHRONOUS_LIMIT_PCT: u32 = 85; const HIGH_SPEED_ISOCHRONOUS_MICROFRAMES_PER_SEC: u32 = 8_000; @@ -656,7 +657,7 @@ fn uvc_idle_pump_sleep() -> Duration { } fn uvc_queue_period(fps: u32) -> Option { - if !env_flag_enabled("LESAVKA_UVC_QUEUE_PACING", false) { + if !env_flag_enabled("LESAVKA_UVC_QUEUE_PACING", DEFAULT_UVC_QUEUE_PACING) { return None; } let fps = fps.max(1); diff --git a/server/src/bin/lesavka_uvc/coverage_model.rs b/server/src/bin/lesavka_uvc/coverage_model.rs index bba353d..69b9f90 100644 --- a/server/src/bin/lesavka_uvc/coverage_model.rs +++ b/server/src/bin/lesavka_uvc/coverage_model.rs @@ -56,6 +56,8 @@ const DEFAULT_UVC_IDLE_PUMP_MS: u64 = 2; #[cfg(coverage)] const DEFAULT_UVC_FRAME_MAX_AGE_MS: u64 = 1_000; #[cfg(coverage)] +const DEFAULT_UVC_QUEUE_PACING: bool = true; +#[cfg(coverage)] const DEFAULT_UVC_MJPEG_BUDGET_BYTES_PER_SEC: u32 = 10_000_000; #[cfg(coverage)] const DEFAULT_UVC_ISOCHRONOUS_LIMIT_PCT: u32 = 85; diff --git a/server/src/bin/lesavka_uvc/coverage_startup.rs b/server/src/bin/lesavka_uvc/coverage_startup.rs index a118a38..a52b774 100644 --- a/server/src/bin/lesavka_uvc/coverage_startup.rs +++ b/server/src/bin/lesavka_uvc/coverage_startup.rs @@ -180,7 +180,7 @@ fn uvc_idle_pump_sleep() -> std::time::Duration { /// `None` when pacing is explicitly disabled. Why: the RCT-facing host must /// not be overfed faster than the advertised descriptor cadence. fn uvc_queue_period(fps: u32) -> Option { - if !env_flag_enabled("LESAVKA_UVC_QUEUE_PACING", false) { + if !env_flag_enabled("LESAVKA_UVC_QUEUE_PACING", DEFAULT_UVC_QUEUE_PACING) { return None; } let fps = fps.max(1); diff --git a/server/src/bin/tests/lesavka_uvc.rs b/server/src/bin/tests/lesavka_uvc.rs index e66e619..a770a66 100644 --- a/server/src/bin/tests/lesavka_uvc.rs +++ b/server/src/bin/tests/lesavka_uvc.rs @@ -136,17 +136,17 @@ fn uvc_frame_budget_caps_isochronous_transport() { } #[test] -fn uvc_queue_pacing_defaults_off_but_remains_opt_in() { +fn uvc_queue_pacing_defaults_on_but_can_be_disabled() { with_var("LESAVKA_UVC_QUEUE_PACING", None::<&str>, || { - assert_eq!(uvc_queue_period(30), None); - }); - - with_var("LESAVKA_UVC_QUEUE_PACING", Some("1"), || { assert_eq!( uvc_queue_period(30), Some(std::time::Duration::from_nanos(33_333_333)) ); }); + + with_var("LESAVKA_UVC_QUEUE_PACING", Some("0"), || { + assert_eq!(uvc_queue_period(30), None); + }); } #[test] diff --git a/tests/contract/scripts/install/server_install_script_contract.rs b/tests/contract/scripts/install/server_install_script_contract.rs index d3166bb..9e72dc3 100644 --- a/tests/contract/scripts/install/server_install_script_contract.rs +++ b/tests/contract/scripts/install/server_install_script_contract.rs @@ -207,6 +207,7 @@ fn server_install_pins_hdmi_camera_and_display_defaults() { assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_WIDTH 1280")); assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_HEIGHT 720")); assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_CONTROL_READ_ONLY 0")); + assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_QUEUE_PACING 1")); assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_BULK 1")); assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_FRAME_SIZE_GUARD 1")); assert!(SERVER_INSTALL.contains("uvc_env_value LESAVKA_UVC_FRAME_MAX_BYTES 0")); diff --git a/tests/contract/server/uvc/server_uvc_binary_extra_contract.rs b/tests/contract/server/uvc/server_uvc_binary_extra_contract.rs index 767ef42..20eeb9a 100644 --- a/tests/contract/server/uvc/server_uvc_binary_extra_contract.rs +++ b/tests/contract/server/uvc/server_uvc_binary_extra_contract.rs @@ -361,7 +361,10 @@ mod uvc_binary_extra { with_var("LESAVKA_UVC_FRAME_MAX_AGE_MS", None::<&str>, || { assert_eq!(uvc_buffer_count(), 4); assert_eq!(uvc_idle_pump_sleep(), std::time::Duration::from_millis(2)); - assert_eq!(uvc_queue_period(30), None); + assert_eq!( + uvc_queue_period(30), + Some(std::time::Duration::from_nanos(33_333_333)) + ); assert_eq!( frame_spool_max_age(), Some(std::time::Duration::from_millis(1_000))