From 4516bd48e1ccdebce3793d6b0ca4760dd924ddfa Mon Sep 17 00:00:00 2001 From: enricobuehler Date: Wed, 8 Jul 2026 12:29:22 +0200 Subject: [PATCH] =?UTF-8?q?perf(core):=20cap=20the=20QUIC=20datagram=20sen?= =?UTF-8?q?d=20buffer=20=E2=80=94=20audio/rumble=20go=20latest-wins?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit quinn's default 1 MiB datagram FIFO holds tens of seconds of Opus; on a congested link the audio/rumble/input planes built a standing delay that never drained while video (own latest-wins UDP path) stayed live — observed on the Deck as audio and rumble lagging together by the same experience-destroying amount. quinn sheds oldest-first at the cap, so a 4 KiB bound makes the plane latest-wins at the source: ~200 ms of stereo Opus worst case, and sustained congestion costs concealable drops instead of lag. Co-Authored-By: Claude Fable 5 --- crates/punktfunk-core/src/quic.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/crates/punktfunk-core/src/quic.rs b/crates/punktfunk-core/src/quic.rs index 7fe6f836..ff739047 100644 --- a/crates/punktfunk-core/src/quic.rs +++ b/crates/punktfunk-core/src/quic.rs @@ -1789,6 +1789,15 @@ pub mod endpoint { quinn::IdleTimeout::try_from(idle).expect("clamped idle timeout is a valid QUIC value"), )); t.keep_alive_interval(Some(keep_alive)); + // The datagram planes (audio/rumble/hidout/host-timing host→client; mic/rich-input + // client→host) carry realtime state, not bulk data — but they are congestion-controlled, + // unlike video, which rides its own latest-wins UDP path. quinn's default 1 MiB datagram + // send buffer is a FIFO that only sheds oldest-first at the cap, so on a congested link + // (Wi-Fi under streaming load) it holds tens of seconds of Opus: audio and rumble build a + // standing delay that never drains while video stays live. Capping the buffer makes the + // plane latest-wins at the source — ~200 ms of stereo Opus (proportionally less at + // surround bitrates), so sustained congestion costs concealable drops, never lag. + t.datagram_send_buffer_size(4 * 1024); Arc::new(t) }