From af3f8f34398de2eaeb03a695d7584eeb0c58ccde Mon Sep 17 00:00:00 2001 From: Wanjohi Date: Sun, 18 Oct 2026 15:53:08 +0300 Subject: [PATCH] fix(neswire): log dropped audio frames once per burst, not once per frame A stalled encoder drops about fifty frames a second, and with warn now visible by default each drop would be its own journal line. Count them and log the first and every 250th. --- apps/neswire/src/sink.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/apps/neswire/src/sink.rs b/apps/neswire/src/sink.rs index e9cd1b9c..69483110 100644 --- a/apps/neswire/src/sink.rs +++ b/apps/neswire/src/sink.rs @@ -83,6 +83,9 @@ pub fn run(sample_rate: u32, channels: u32, frame_size: u32, tx: Sender) /// Where the accumulator ends when the graph gives no position: a count /// of the frames received, so packets still carry a continuous timeline. counted_end: u64, + /// Frames dropped because the encoder was behind. A stalled encoder + /// drops ~50 a second, so only the first and every 250th are logged. + dropped: u64, } let state = State { @@ -93,6 +96,7 @@ pub fn run(sample_rate: u32, channels: u32, frame_size: u32, tx: Sender) sample_rate, next_ticks: None, counted_end: 0, + dropped: 0, }; let _listener = stream @@ -174,7 +178,10 @@ pub fn run(sample_rate: u32, channels: u32, frame_size: u32, tx: Sender) }; if state.tx.try_send(packet).is_err() { - tracing::warn!("encoder falling behind, dropping frame"); + state.dropped += 1; + if state.dropped % 250 == 1 { + tracing::warn!(dropped = state.dropped, "encoder falling behind, dropping frames"); + } } } }