fix(launcher): tighten testing panel height and surface audio packet health

This commit is contained in:
Brad Stein 2026-04-21 03:53:48 -03:00
parent 736c4e3bac
commit 3903eeb3ff
3 changed files with 46 additions and 10 deletions

View File

@ -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"
);
}
}
}
}
}

View File

@ -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;

View File

@ -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: &gtk::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");