lesavka: retire broken sd source modes

This commit is contained in:
Brad Stein 2026-04-19 22:41:20 -03:00
parent 8273b83017
commit 2356817080
8 changed files with 39 additions and 77 deletions

View File

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

View File

@ -684,7 +684,7 @@ fn recommendations_for(state: &LauncherState, log: &DiagnosticsLog) -> Vec<Strin
.any(|preset| !matches!(preset, FeedSourcePreset::Off)); .any(|preset| !matches!(preset, FeedSourcePreset::Off));
if source_passthrough { if source_passthrough {
items.push( items.push(
"Device H.264 pass-through is active. If we need it cheaper, use the eye device's real 1080p/720p/576p/480p/VGA source modes before considering codec-aware thinning." "Device H.264 pass-through is active. On current GC311 hardware, prefer the real 1080p/720p source modes. The lower SD/VGA modes are intentionally retired because they center-cut widescreen HDMI sources."
.to_string(), .to_string(),
); );
} }

View File

@ -2019,7 +2019,7 @@ mod tests {
#[test] #[test]
#[serial] #[serial]
fn inline_preview_requests_native_480p_source_mode_on_wire() { fn inline_preview_legacy_low_modes_fall_forward_to_720p_on_wire() {
let relay = ProbeRelay::default(); let relay = ProbeRelay::default();
let requests = relay.requests.clone(); let requests = relay.requests.clone();
let rt = tokio::runtime::Runtime::new().expect("runtime"); let rt = tokio::runtime::Runtime::new().expect("runtime");
@ -2055,10 +2055,10 @@ mod tests {
if let Some(request) = requests.lock().unwrap().last().cloned() { if let Some(request) = requests.lock().unwrap().last().cloned() {
assert_eq!(request.id, 1); assert_eq!(request.id, 1);
assert_eq!(request.source_id, Some(1)); assert_eq!(request.source_id, Some(1));
assert_eq!(request.requested_width, 720); assert_eq!(request.requested_width, 1280);
assert_eq!(request.requested_height, 480); assert_eq!(request.requested_height, 720);
assert_eq!(request.requested_fps, 60); assert_eq!(request.requested_fps, 60);
assert_eq!(request.max_bitrate, 2_500); assert_eq!(request.max_bitrate, 12_000);
preview.shutdown_all(); preview.shutdown_all();
return; return;
} }
@ -2066,7 +2066,7 @@ mod tests {
} }
preview.shutdown_all(); preview.shutdown_all();
panic!("preview did not issue a 480p source capture request within timeout"); panic!("preview did not issue a 720p fallback source capture request within timeout");
} }
#[test] #[test]

View File

@ -190,20 +190,15 @@ impl CaptureSizePreset {
} }
pub fn source_mode(self) -> EyeSourceMode { pub fn source_mode(self) -> EyeSourceMode {
match self { match normalize_capture_size_preset(self) {
Self::Vga => native_eye_source_modes()[4],
Self::P480 => native_eye_source_modes()[3],
Self::P576 => native_eye_source_modes()[2],
Self::P720 => native_eye_source_modes()[1], Self::P720 => native_eye_source_modes()[1],
Self::P1080 => native_eye_source_modes()[0], Self::P1080 => native_eye_source_modes()[0],
Self::Vga | Self::P480 | Self::P576 => native_eye_source_modes()[1],
} }
} }
pub fn from_source_mode(mode: EyeSourceMode) -> Self { pub fn from_source_mode(mode: EyeSourceMode) -> Self {
match (mode.width, mode.height, mode.fps) { match (mode.width, mode.height, mode.fps) {
(640, 480, 60) => Self::Vga,
(720, 480, 60) => Self::P480,
(720, 576, 50) => Self::P576,
(1280, 720, 60) => Self::P720, (1280, 720, 60) => Self::P720,
_ => Self::P1080, _ => Self::P1080,
} }
@ -909,7 +904,12 @@ fn default_profile_for_preset(
} }
fn normalize_capture_size_preset(preset: CaptureSizePreset) -> CaptureSizePreset { fn normalize_capture_size_preset(preset: CaptureSizePreset) -> CaptureSizePreset {
preset match preset {
CaptureSizePreset::Vga | CaptureSizePreset::P480 | CaptureSizePreset::P576 => {
CaptureSizePreset::P720
}
other => other,
}
} }
fn fit_standard_dimensions( fn fit_standard_dimensions(
@ -1161,19 +1161,20 @@ mod tests {
state.set_capture_size_preset(0, CaptureSizePreset::P480); state.set_capture_size_preset(0, CaptureSizePreset::P480);
let compact_capture = state.capture_size_choice(0); let compact_capture = state.capture_size_choice(0);
assert_eq!(compact_capture.width, 720); assert_eq!(compact_capture.preset, CaptureSizePreset::P720);
assert_eq!(compact_capture.height, 480); assert_eq!(compact_capture.width, 1280);
assert_eq!(compact_capture.height, 720);
assert_eq!(compact_capture.fps, 60); assert_eq!(compact_capture.fps, 60);
assert_eq!(compact_capture.max_bitrate_kbit, 2_500); assert_eq!(compact_capture.max_bitrate_kbit, 12_000);
let effective_source = state.effective_preview_source_size(0); let effective_source = state.effective_preview_source_size(0);
assert_eq!(effective_source.width, 720); assert_eq!(effective_source.width, 1280);
assert_eq!(effective_source.height, 480); assert_eq!(effective_source.height, 720);
assert_eq!(effective_source.fps, 60); assert_eq!(effective_source.fps, 60);
let display = state.breakout_size_choice(0); let display = state.breakout_size_choice(0);
assert_eq!(display.width, 852); assert_eq!(display.width, 1280);
assert_eq!(display.height, 480); assert_eq!(display.height, 720);
state.set_breakout_size_preset(0, BreakoutSizePreset::P360); state.set_breakout_size_preset(0, BreakoutSizePreset::P360);
let smaller = state.breakout_size_choice(0); let smaller = state.breakout_size_choice(0);
@ -1186,7 +1187,7 @@ mod tests {
assert_eq!(compact.height, 540); assert_eq!(compact.height, 540);
let capture_options = state.capture_size_options(); let capture_options = state.capture_size_options();
assert_eq!(capture_options.len(), 5); assert_eq!(capture_options.len(), 2);
assert_eq!(capture_options[0].preset, CaptureSizePreset::P1080); assert_eq!(capture_options[0].preset, CaptureSizePreset::P1080);
assert_eq!(capture_options[0].width, 1920); assert_eq!(capture_options[0].width, 1920);
assert_eq!(capture_options[0].height, 1080); assert_eq!(capture_options[0].height, 1080);
@ -1197,8 +1198,8 @@ mod tests {
assert!(breakout_options.len() >= 5); assert!(breakout_options.len() >= 5);
assert!(breakout_options.iter().any(|choice| { assert!(breakout_options.iter().any(|choice| {
choice.preset == BreakoutSizePreset::Source choice.preset == BreakoutSizePreset::Source
&& choice.width == 852 && choice.width == 1280
&& choice.height == 480 && choice.height == 720
})); }));
} }
@ -1274,16 +1275,16 @@ mod tests {
state.set_capture_size_preset(0, CaptureSizePreset::P576); state.set_capture_size_preset(0, CaptureSizePreset::P576);
let compact = state.capture_size_choice(0); let compact = state.capture_size_choice(0);
assert_eq!(compact.preset, CaptureSizePreset::P576); assert_eq!(compact.preset, CaptureSizePreset::P720);
assert_eq!(compact.width, 720); assert_eq!(compact.width, 1280);
assert_eq!(compact.height, 576); assert_eq!(compact.height, 720);
assert_eq!(compact.fps, 50); assert_eq!(compact.fps, 60);
state.set_capture_size_preset(0, CaptureSizePreset::Vga); state.set_capture_size_preset(0, CaptureSizePreset::Vga);
let small = state.capture_size_choice(0); let small = state.capture_size_choice(0);
assert_eq!(small.preset, CaptureSizePreset::Vga); assert_eq!(small.preset, CaptureSizePreset::P720);
assert_eq!(small.width, 640); assert_eq!(small.width, 1280);
assert_eq!(small.height, 480); assert_eq!(small.height, 720);
assert_eq!(small.fps, 60); assert_eq!(small.fps, 60);
} }

View File

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

View File

@ -17,6 +17,6 @@ mod tests {
#[test] #[test]
fn banner_includes_version() { fn banner_includes_version() {
assert_eq!(banner("0.11.17"), "lesavka-common CLI (v0.11.17)"); assert_eq!(banner("0.11.18"), "lesavka-common CLI (v0.11.18)");
} }
} }

View File

@ -5,7 +5,7 @@ pub struct EyeSourceMode {
pub fps: u32, pub fps: u32,
} }
const GC311_H264_SOURCE_MODES: [EyeSourceMode; 5] = [ const GC311_H264_SOURCE_MODES: [EyeSourceMode; 2] = [
EyeSourceMode { EyeSourceMode {
width: 1920, width: 1920,
height: 1080, height: 1080,
@ -16,21 +16,6 @@ const GC311_H264_SOURCE_MODES: [EyeSourceMode; 5] = [
height: 720, height: 720,
fps: 60, fps: 60,
}, },
EyeSourceMode {
width: 720,
height: 576,
fps: 50,
},
EyeSourceMode {
width: 720,
height: 480,
fps: 60,
},
EyeSourceMode {
width: 640,
height: 480,
fps: 60,
},
]; ];
pub fn native_eye_source_modes() -> &'static [EyeSourceMode] { pub fn native_eye_source_modes() -> &'static [EyeSourceMode] {
@ -100,8 +85,8 @@ mod tests {
assert_eq!( assert_eq!(
eye_source_mode_for_request(960, 540), eye_source_mode_for_request(960, 540),
EyeSourceMode { EyeSourceMode {
width: 720, width: 1280,
height: 480, height: 720,
fps: 60, fps: 60,
} }
); );
@ -125,29 +110,5 @@ mod tests {
}), }),
(1280, 720) (1280, 720)
); );
assert_eq!(
display_size_for_source_mode(EyeSourceMode {
width: 720,
height: 576,
fps: 50,
}),
(1024, 576)
);
assert_eq!(
display_size_for_source_mode(EyeSourceMode {
width: 720,
height: 480,
fps: 60,
}),
(854, 480)
);
assert_eq!(
display_size_for_source_mode(EyeSourceMode {
width: 640,
height: 480,
fps: 60,
}),
(640, 480)
);
} }
} }

View File

@ -10,7 +10,7 @@ bench = false
[package] [package]
name = "lesavka_server" name = "lesavka_server"
version = "0.11.17" version = "0.11.18"
edition = "2024" edition = "2024"
autobins = false autobins = false