From cd9a25a966ba5f23517e9e4f0462a0c672fcee7d Mon Sep 17 00:00:00 2001 From: th2tran Date: Tue, 10 Nov 2026 21:16:20 -0500 Subject: [PATCH] fix(calls):: Put back the native call playback buffer target (PLAY_AHEAD_MS) to 60ms to fix audio crackling. This gives the audio thread more headroom against scheduling delays and output callback bursts, and reduces buffer underruns, which otherwise insert silence into the audio stream and can produce audible crackling, at the cost of approximately 30 ms of additional playback latency. Root cause analysis: The native playback buffer could run out of decoded audio before the output callback needed its next samples, causing the mixer to insert silence. These repeated underruns created audible crackling; increasing the buffer gives playback more headroom to absorb scheduling delays. --- src-tauri/src/calls/media.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-tauri/src/calls/media.rs b/src-tauri/src/calls/media.rs index 3e882ab87..45df73ba4 100644 --- a/src-tauri/src/calls/media.rs +++ b/src-tauri/src/calls/media.rs @@ -44,7 +44,8 @@ const VOICE_MAX_KBPS: u32 = START_KBPS; /// How far ahead of the speaker the decoder keeps the play ring. Small on purpose: /// the jitter buffer holds the margin, the ring only covers the callback's stride. -pub(crate) const PLAY_AHEAD_MS: u32 = 30; +// pub(crate) const PLAY_AHEAD_MS: u32 = 30; +pub(crate) const PLAY_AHEAD_MS: u32 = 60; /// Where captured frames go: one call's peer, or everyone in a voice Channel's call. #[derive(Clone)]