From aceb9ab2a1e7bda7129b726cfe5a6d5ae8314615 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 11 Nov 2025 23:16:56 +0000 Subject: [PATCH] Reduce BROADCAST_CAPACITY to maintain metadata synchronization Changed from 4096 to 128 messages (~10s buffer instead of ~5min). The large buffer was causing metadata drift: clients could be hearing audio 5 minutes behind the metadata endpoint and ICY metadata updates. With TimerNode pacing the stream to real-time, we only need a small buffer for network jitter. This keeps metadata properly synchronized with the actual audio being played. --- pmoaudio-ext/src/sinks/streaming_flac_sink.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pmoaudio-ext/src/sinks/streaming_flac_sink.rs b/pmoaudio-ext/src/sinks/streaming_flac_sink.rs index 050a8061..9fe8fb24 100644 --- a/pmoaudio-ext/src/sinks/streaming_flac_sink.rs +++ b/pmoaudio-ext/src/sinks/streaming_flac_sink.rs @@ -81,9 +81,10 @@ use tracing::{debug, error, info, trace, warn}; const DEFAULT_ICY_METAINT: usize = 16000; /// Broadcast channel capacity for FLAC bytes. -/// 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; +/// Set to 128 to provide ~10 seconds of buffer for network jitter. +/// With TimerNode pacing the stream to real-time, this is sufficient +/// while keeping metadata synchronized (larger buffers cause metadata drift). +const BROADCAST_CAPACITY: usize = 128; /// Snapshot of track metadata at a point in time. ///