fix: keep UVC helper buffer depth conservative

This commit is contained in:
Brad Stein 2026-05-19 05:55:21 -03:00
parent cf1c1fa47d
commit e03cae2a08
7 changed files with 12 additions and 9 deletions

6
Cargo.lock generated
View File

@ -1658,7 +1658,7 @@ checksum = "09edd9e8b54e49e587e4f6295a7d29c3ea94d469cb40ab8ca70b288248a81db2"
[[package]]
name = "lesavka_client"
version = "0.25.2"
version = "0.25.3"
dependencies = [
"anyhow",
"async-stream",
@ -1692,7 +1692,7 @@ dependencies = [
[[package]]
name = "lesavka_common"
version = "0.25.2"
version = "0.25.3"
dependencies = [
"anyhow",
"base64",
@ -1704,7 +1704,7 @@ dependencies = [
[[package]]
name = "lesavka_server"
version = "0.25.2"
version = "0.25.3"
dependencies = [
"anyhow",
"base64",

View File

@ -4,7 +4,7 @@ path = "src/main.rs"
[package]
name = "lesavka_client"
version = "0.25.2"
version = "0.25.3"
edition = "2024"
[dependencies]

View File

@ -1,6 +1,6 @@
[package]
name = "lesavka_common"
version = "0.25.2"
version = "0.25.3"
edition = "2024"
build = "build.rs"

View File

@ -16,7 +16,7 @@ bench = false
[package]
name = "lesavka_server"
version = "0.25.2"
version = "0.25.3"
edition = "2024"
autobins = false

View File

@ -48,7 +48,9 @@ const V4L2_PIX_FMT_MJPEG: u32 = u32::from_le_bytes(*b"MJPG");
const MAX_MJPEG_FRAME_BYTES: usize = 8 * 1024 * 1024;
const MINIMAL_MJPEG_FRAME: &[u8] = &[0xff, 0xd8, 0xff, 0xd9];
const IDLE_MJPEG_FRAME: &[u8] = include_bytes!("lesavka_uvc/idle_1280x720_black.jpg");
const DEFAULT_UVC_BUFFER_COUNT: u32 = 4;
// Keep the kernel from holding several future frames at once; if USB falls
// behind, a short stutter is safer than mixing payload from different frames.
const DEFAULT_UVC_BUFFER_COUNT: u32 = 1;
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;

View File

@ -50,7 +50,8 @@ const UVC_VS_COMMIT_CONTROL: u8 = 0x02;
const UVC_VC_REQUEST_ERROR_CODE_CONTROL: u8 = 0x02;
#[cfg(coverage)]
const DEFAULT_UVC_BUFFER_COUNT: u32 = 4;
// Keep coverage-mode defaults aligned with the real UVC helper.
const DEFAULT_UVC_BUFFER_COUNT: u32 = 1;
#[cfg(coverage)]
const DEFAULT_UVC_IDLE_PUMP_MS: u64 = 2;
#[cfg(coverage)]

View File

@ -359,7 +359,7 @@ mod uvc_binary_extra {
with_var("LESAVKA_UVC_BUFFER_COUNT", None::<&str>, || {
with_var("LESAVKA_UVC_IDLE_PUMP_MS", None::<&str>, || {
with_var("LESAVKA_UVC_FRAME_MAX_AGE_MS", None::<&str>, || {
assert_eq!(uvc_buffer_count(), 4);
assert_eq!(uvc_buffer_count(), 1);
assert_eq!(uvc_idle_pump_sleep(), std::time::Duration::from_millis(2));
assert_eq!(
uvc_queue_period(30),