Video Fix

This commit is contained in:
Brad Stein 2025-06-28 03:46:39 -05:00
parent d198fbf55c
commit 6520e5301d
2 changed files with 7 additions and 10 deletions

View File

@ -83,7 +83,6 @@ impl LesavkaClientApp {
let (video_tx, mut video_rx) = tokio::sync::mpsc::unbounded_channel::<VideoPacket>();
std::thread::spawn(move || {
tracing::info!("🎥 spawn move");
let el = EventLoopBuilder::<()>::new().with_any_thread(true).build().unwrap();
let win0 = MonitorWindow::new(0, &el).expect("win0");
let win1 = MonitorWindow::new(1, &el).expect("win1");
@ -91,11 +90,9 @@ impl LesavkaClientApp {
let _ = el.run(move |_: Event<()>, _elwt| {
_elwt.set_control_flow(ControlFlow::WaitUntil(
std::time::Instant::now() + std::time::Duration::from_millis(16)));
tracing::info!("🎥 el run move");
static CNT: std::sync::atomic::AtomicU64 = std::sync::atomic::AtomicU64::new(0);
static DUMP_CNT: std::sync::atomic::AtomicU32 = std::sync::atomic::AtomicU32::new(0);
while let Ok(pkt) = video_rx.try_recv() {
tracing::info!("🎥 pkt recieved?");
CNT.fetch_add(1, std::sync::atomic::Ordering::Relaxed);
if CNT.load(std::sync::atomic::Ordering::Relaxed) % 300 == 0 {
tracing::debug!("🎥 received {} video packets", CNT.load(std::sync::atomic::Ordering::Relaxed));
@ -196,25 +193,25 @@ impl LesavkaClientApp {
let req = MonitorRequest { id: monitor_id, max_bitrate: 6_000 };
match cli.capture_video(Request::new(req)).await {
Ok(mut stream) => {
tracing::info!("cli video{monitor_id}: stream opened");
tracing::info!("🎥 cli video{monitor_id}: stream opened");
while let Some(res) = stream.get_mut().message().await.transpose() {
match res {
Ok(pkt) => {
tracing::debug!("cli video{monitor_id}: got {}bytes", pkt.data.len());
tracing::debug!("🎥 cli video{monitor_id}: got {}bytes", pkt.data.len());
if tx.send(pkt).is_err() {
tracing::warn!("cli video{monitor_id}: GUI thread gone");
tracing::warn!("⚠️🎥 cli video{monitor_id}: GUI thread gone");
break;
}
}
Err(e) => {
tracing::error!("cli video{monitor_id}: gRPC error: {e}");
tracing::error!("❌🎥 cli video{monitor_id}: gRPC error: {e}");
break;
}
}
}
tracing::warn!("cli video{monitor_id}: stream ended");
tracing::warn!("⚠️🎥 li video{monitor_id}: stream ended");
}
Err(e) => error!("video {monitor_id}: {e}"),
Err(e) => error!("❌🎥 video {monitor_id}: {e}"),
}
tokio::time::sleep(Duration::from_secs(1)).await;
}

View File

@ -105,7 +105,7 @@ After=network.target lesavka-core.service
[Service]
ExecStart=/usr/local/bin/lesavka-server
Restart=always
Environment=RUST_LOG=lesavka_server=info,lesavka_server::video=trace,lesavka_server::usb_gadget=infotonic=debug,h2=debug,lesavka_client::app=trace
Environment=RUST_LOG=lesavka_server=info,lesavka_server::video=info,lesavka_server::usb_gadget=info,tonic=info,h2=info,lesavka_client::app=info
Environment=RUST_BACKTRACE=1
Restart=always
RestartSec=5