From fe428301d051b35a13e682468879aa7b752b3658 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Nov 2025 23:12:47 +0000 Subject: [PATCH] Increase BROADCAST_CAPACITY to fix client lag warnings The broadcast channel capacity was too small (512) causing clients to lag behind the encoder and drop thousands of messages, resulting in choppy playback. Increased to 4096 to provide ~5 minutes of buffer at typical FLAC streaming rates (~12-15 chunks/sec at 8KB each). This resolves the "FLAC client lagged, skipped N messages" warnings. --- pmoaudio-ext/src/sinks/streaming_flac_sink.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pmoaudio-ext/src/sinks/streaming_flac_sink.rs b/pmoaudio-ext/src/sinks/streaming_flac_sink.rs index 765ccf19..050a8061 100644 --- a/pmoaudio-ext/src/sinks/streaming_flac_sink.rs +++ b/pmoaudio-ext/src/sinks/streaming_flac_sink.rs @@ -81,7 +81,9 @@ use tracing::{debug, error, info, trace, warn}; const DEFAULT_ICY_METAINT: usize = 16000; /// Broadcast channel capacity for FLAC bytes. -const BROADCAST_CAPACITY: usize = 512; +/// Increased to 4096 to handle network backpressure and late-joining clients. +/// At ~12-15 chunks/sec (8KB each), this provides ~5 minutes of buffer. +const BROADCAST_CAPACITY: usize = 4096; /// Snapshot of track metadata at a point in time. ///