From 3903eeb3ff8554371b78c57ef899b84900eaa25b Mon Sep 17 00:00:00 2001 From: Brad Stein Date: Tue, 21 Apr 2026 03:53:48 -0300 Subject: [PATCH] fix(launcher): tighten testing panel height and surface audio packet health --- client/src/app.rs | 41 ++++++++++++++++++++++++++-- client/src/launcher/device_test.rs | 4 +-- client/src/launcher/ui_components.rs | 11 ++++---- 3 files changed, 46 insertions(+), 10 deletions(-) diff --git a/client/src/app.rs b/client/src/app.rs index f1cdbd3..89e9e60 100644 --- a/client/src/app.rs +++ b/client/src/app.rs @@ -510,9 +510,44 @@ impl LesavkaClientApp { }; match cli.capture_audio(Request::new(req)).await { Ok(mut stream) => { - while let Some(res) = stream.get_mut().message().await.transpose() { - if let Ok(pkt) = res { - out.push(pkt); + tracing::info!("🔊 audio stream opened"); + let mut packet_count: u64 = 0; + let mut warned_no_packets = false; + loop { + match tokio::time::timeout( + Duration::from_secs(1), + stream.get_mut().message(), + ) + .await + { + Ok(Ok(Some(pkt))) => { + packet_count = packet_count.saturating_add(1); + if packet_count <= 8 || packet_count % 600 == 0 { + tracing::info!( + packet = packet_count, + bytes = pkt.data.len(), + remote_pts_us = pkt.pts, + "🔊 audio packet received" + ); + } + out.push(pkt); + } + Ok(Ok(None)) => { + tracing::warn!(packets = packet_count, "⚠️🔊 audio stream ended"); + break; + } + Ok(Err(err)) => { + tracing::warn!("❌🔊 audio stream recv error: {err}"); + break; + } + Err(_) => { + if packet_count == 0 && !warned_no_packets { + warned_no_packets = true; + tracing::warn!( + "⚠️🔊 audio stream connected but no packets received yet; source may be idle or unavailable" + ); + } + } } } } diff --git a/client/src/launcher/device_test.rs b/client/src/launcher/device_test.rs index 1218e90..98b1a9b 100644 --- a/client/src/launcher/device_test.rs +++ b/client/src/launcher/device_test.rs @@ -11,8 +11,8 @@ use std::sync::atomic::{AtomicBool, AtomicU64, Ordering}; use std::sync::{Arc, Mutex}; use std::time::Duration; -const CAMERA_PREVIEW_WIDTH: i32 = 300; -const CAMERA_PREVIEW_HEIGHT: i32 = 168; +const CAMERA_PREVIEW_WIDTH: i32 = 256; +const CAMERA_PREVIEW_HEIGHT: i32 = 144; const CAMERA_PREVIEW_IDLE: &str = "Select a webcam and click Start Preview."; const MIC_MONITOR_RATE: i32 = 16_000; const MIC_MONITOR_CHANNELS: i32 = 1; diff --git a/client/src/launcher/ui_components.rs b/client/src/launcher/ui_components.rs index 2847d1d..7bdf45e 100644 --- a/client/src/launcher/ui_components.rs +++ b/client/src/launcher/ui_components.rs @@ -111,8 +111,8 @@ const LESAVKA_ICON_SEARCH_PATH: &str = concat!(env!("CARGO_MANIFEST_DIR"), "/ass const LAUNCHER_DEFAULT_WIDTH: i32 = 1380; const LAUNCHER_DEFAULT_HEIGHT: i32 = 860; const OPERATIONS_RAIL_WIDTH: i32 = 288; -const CAMERA_PREVIEW_VIEWPORT_HEIGHT: i32 = 168; -const CAMERA_PREVIEW_VIEWPORT_WIDTH: i32 = 300; +const CAMERA_PREVIEW_VIEWPORT_HEIGHT: i32 = 144; +const CAMERA_PREVIEW_VIEWPORT_WIDTH: i32 = 256; pub fn build_launcher_view( app: >k::Application, @@ -322,7 +322,7 @@ pub fn build_launcher_view( preview_panel.set_hexpand(true); preview_panel.set_vexpand(false); preview_panel.set_valign(gtk::Align::Start); - preview_body.set_spacing(8); + preview_body.set_spacing(6); let camera_preview = gtk::Picture::new(); camera_preview.set_can_shrink(false); camera_preview.set_hexpand(true); @@ -335,7 +335,8 @@ pub fn build_launcher_view( camera_preview.add_css_class("camera-preview-frame"); let camera_status = gtk::Label::new(Some("Select a webcam and click Start Preview.")); camera_status.add_css_class("dim-label"); - camera_status.set_wrap(true); + camera_status.set_wrap(false); + camera_status.set_ellipsize(pango::EllipsizeMode::End); camera_status.set_xalign(0.0); camera_status.set_visible(true); let camera_preview_shell = gtk::Box::new(gtk::Orientation::Vertical, 0); @@ -354,7 +355,7 @@ pub fn build_launcher_view( preview_body.append(&webcam_group); let playback_group = build_subgroup("Mic Playback"); - let playback_body = gtk::Box::new(gtk::Orientation::Vertical, 8); + let playback_body = gtk::Box::new(gtk::Orientation::Vertical, 6); let playback_row = gtk::Box::new(gtk::Orientation::Horizontal, 8); playback_row.set_homogeneous(false); let microphone_replay_button = gtk::Button::with_label("Replay Last 3s");