diff --git a/client/Cargo.toml b/client/Cargo.toml index b82595e..d7f1263 100644 --- a/client/Cargo.toml +++ b/client/Cargo.toml @@ -4,7 +4,7 @@ path = "src/main.rs" [package] name = "lesavka_client" -version = "0.11.17" +version = "0.11.18" edition = "2024" [dependencies] diff --git a/client/src/launcher/diagnostics.rs b/client/src/launcher/diagnostics.rs index 1726f9c..507d459 100644 --- a/client/src/launcher/diagnostics.rs +++ b/client/src/launcher/diagnostics.rs @@ -684,7 +684,7 @@ fn recommendations_for(state: &LauncherState, log: &DiagnosticsLog) -> Vec EyeSourceMode { - match self { - Self::Vga => native_eye_source_modes()[4], - Self::P480 => native_eye_source_modes()[3], - Self::P576 => native_eye_source_modes()[2], + match normalize_capture_size_preset(self) { Self::P720 => native_eye_source_modes()[1], 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 { 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, _ => Self::P1080, } @@ -909,7 +904,12 @@ fn default_profile_for_preset( } 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( @@ -1161,19 +1161,20 @@ mod tests { state.set_capture_size_preset(0, CaptureSizePreset::P480); let compact_capture = state.capture_size_choice(0); - assert_eq!(compact_capture.width, 720); - assert_eq!(compact_capture.height, 480); + assert_eq!(compact_capture.preset, CaptureSizePreset::P720); + assert_eq!(compact_capture.width, 1280); + assert_eq!(compact_capture.height, 720); 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); - assert_eq!(effective_source.width, 720); - assert_eq!(effective_source.height, 480); + assert_eq!(effective_source.width, 1280); + assert_eq!(effective_source.height, 720); assert_eq!(effective_source.fps, 60); let display = state.breakout_size_choice(0); - assert_eq!(display.width, 852); - assert_eq!(display.height, 480); + assert_eq!(display.width, 1280); + assert_eq!(display.height, 720); state.set_breakout_size_preset(0, BreakoutSizePreset::P360); let smaller = state.breakout_size_choice(0); @@ -1186,7 +1187,7 @@ mod tests { assert_eq!(compact.height, 540); 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].width, 1920); assert_eq!(capture_options[0].height, 1080); @@ -1197,8 +1198,8 @@ mod tests { assert!(breakout_options.len() >= 5); assert!(breakout_options.iter().any(|choice| { choice.preset == BreakoutSizePreset::Source - && choice.width == 852 - && choice.height == 480 + && choice.width == 1280 + && choice.height == 720 })); } @@ -1274,16 +1275,16 @@ mod tests { state.set_capture_size_preset(0, CaptureSizePreset::P576); let compact = state.capture_size_choice(0); - assert_eq!(compact.preset, CaptureSizePreset::P576); - assert_eq!(compact.width, 720); - assert_eq!(compact.height, 576); - assert_eq!(compact.fps, 50); + assert_eq!(compact.preset, CaptureSizePreset::P720); + assert_eq!(compact.width, 1280); + assert_eq!(compact.height, 720); + assert_eq!(compact.fps, 60); state.set_capture_size_preset(0, CaptureSizePreset::Vga); let small = state.capture_size_choice(0); - assert_eq!(small.preset, CaptureSizePreset::Vga); - assert_eq!(small.width, 640); - assert_eq!(small.height, 480); + assert_eq!(small.preset, CaptureSizePreset::P720); + assert_eq!(small.width, 1280); + assert_eq!(small.height, 720); assert_eq!(small.fps, 60); } diff --git a/common/Cargo.toml b/common/Cargo.toml index 0ce8daa..e57a253 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lesavka_common" -version = "0.11.17" +version = "0.11.18" edition = "2024" build = "build.rs" diff --git a/common/src/cli.rs b/common/src/cli.rs index 44b3486..c34af10 100644 --- a/common/src/cli.rs +++ b/common/src/cli.rs @@ -17,6 +17,6 @@ mod tests { #[test] 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)"); } } diff --git a/common/src/eye_source.rs b/common/src/eye_source.rs index 768535b..9b11eb4 100644 --- a/common/src/eye_source.rs +++ b/common/src/eye_source.rs @@ -5,7 +5,7 @@ pub struct EyeSourceMode { pub fps: u32, } -const GC311_H264_SOURCE_MODES: [EyeSourceMode; 5] = [ +const GC311_H264_SOURCE_MODES: [EyeSourceMode; 2] = [ EyeSourceMode { width: 1920, height: 1080, @@ -16,21 +16,6 @@ const GC311_H264_SOURCE_MODES: [EyeSourceMode; 5] = [ height: 720, 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] { @@ -100,8 +85,8 @@ mod tests { assert_eq!( eye_source_mode_for_request(960, 540), EyeSourceMode { - width: 720, - height: 480, + width: 1280, + height: 720, fps: 60, } ); @@ -125,29 +110,5 @@ mod tests { }), (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) - ); } } diff --git a/server/Cargo.toml b/server/Cargo.toml index 062d81f..6fdd5b4 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -10,7 +10,7 @@ bench = false [package] name = "lesavka_server" -version = "0.11.17" +version = "0.11.18" edition = "2024" autobins = false