From 17f52414acf91d3459150d94ac95f3e2bd3507bd Mon Sep 17 00:00:00 2001 From: Alex P Date: Mon, 17 Nov 2025 13:50:21 +0200 Subject: [PATCH] Fix: increase ALSA buffer size to reduce audio crackling Increase buffer from 80ms (4 periods) to 240ms (12 periods) for better jitter tolerance on USB gadget audio capture. --- internal/audio/c/audio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/internal/audio/c/audio.c b/internal/audio/c/audio.c index b32b2e8b..822825c0 100644 --- a/internal/audio/c/audio.c +++ b/internal/audio/c/audio.c @@ -288,7 +288,7 @@ static int configure_alsa_device(snd_pcm_t *handle, const char *device_name) { err = snd_pcm_hw_params_set_period_size_near(handle, params, &period_size, 0); if (err < 0) return err; - snd_pcm_uframes_t buffer_size = period_size * 4; // 4 periods = 80ms buffer for stability + snd_pcm_uframes_t buffer_size = period_size * 12; // 12 periods = 240ms buffer for better jitter tolerance err = snd_pcm_hw_params_set_buffer_size_near(handle, params, &buffer_size); if (err < 0) return err;