Stable Point - AV/K/M/Mic working

This commit is contained in:
Brad Stein 2025-07-01 22:38:56 -05:00
parent e81b9a2952
commit f96bb0f8c2
2 changed files with 12 additions and 3 deletions

View File

@ -3,6 +3,7 @@
use anyhow::Result; use anyhow::Result;
use std::time::Duration; use std::time::Duration;
use std::sync::Arc; use std::sync::Arc;
use std::sync::atomic::{AtomicUsize, Ordering};
use tokio::sync::broadcast; use tokio::sync::broadcast;
use tokio_stream::{wrappers::BroadcastStream, StreamExt}; use tokio_stream::{wrappers::BroadcastStream, StreamExt};
use tonic::{transport::Channel, Request}; use tonic::{transport::Channel, Request};
@ -255,6 +256,7 @@ impl LesavkaClientApp {
/*──────────────── mic stream ─────────────────*/ /*──────────────── mic stream ─────────────────*/
async fn mic_loop(ep: Channel, mic: Arc<MicrophoneCapture>) { async fn mic_loop(ep: Channel, mic: Arc<MicrophoneCapture>) {
static FAIL_CNT: AtomicUsize = AtomicUsize::new(0);
loop { loop {
let mut cli = RelayClient::new(ep.clone()); let mut cli = RelayClient::new(ep.clone());
@ -278,10 +280,17 @@ impl LesavkaClientApp {
match cli.stream_microphone(Request::new(outbound)).await { match cli.stream_microphone(Request::new(outbound)).await {
Ok(mut resp) => { Ok(mut resp) => {
// Drain and ignore Empty replies
while resp.get_mut().message().await.transpose().is_some() {} while resp.get_mut().message().await.transpose().is_some() {}
} }
Err(e) => warn!("❌🎤 connect failed: {e}"), Err(e) => {
// first failure → warn, subsequent ones → debug
if FAIL_CNT.fetch_add(1, Ordering::Relaxed) == 0 {
warn!("❌🎤 connect failed: {e}");
warn!("⚠️🎤 further microphonestream failures will be logged at DEBUG");
} else {
debug!("❌🎤 reconnect failed: {e}");
}
}
} }
let _ = stop_tx.send(()); let _ = stop_tx.send(());
tokio::time::sleep(Duration::from_secs(1)).await; tokio::time::sleep(Duration::from_secs(1)).await;

View File

@ -122,7 +122,7 @@ After=network.target lesavka-core.service
[Service] [Service]
ExecStart=/usr/local/bin/lesavka-server ExecStart=/usr/local/bin/lesavka-server
Restart=always Restart=always
Environment=RUST_LOG=lesavka_server=info,lesavka_server::audio=trace,lesavka_server::video=info,lesavka_server::gadget=info Environment=RUST_LOG=lesavka_server=info,lesavka_server::audio=info,lesavka_server::video=info,lesavka_server::gadget=info
Environment=RUST_BACKTRACE=1 Environment=RUST_BACKTRACE=1
Environment=GST_DEBUG="*:2,alsasink:6,alsasrc:6" Environment=GST_DEBUG="*:2,alsasink:6,alsasrc:6"
Restart=always Restart=always