From ec1f3437e54e5d6c7d625a7b276a02d4feecbefa Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 2 Sep 2025 17:29:26 +0200 Subject: [PATCH] alsa: use 3 periods in IRQ mode by default 3 seems to work better as a default for Firewire. It does not actually add latency because we only keep 1 period filled with data at all times. --- spa/plugins/alsa/alsa-pcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 48af0e3f8..e3d746e04 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -2340,8 +2340,12 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_ /* period number given use that */ periods = state->default_period_num; else - /* IRQ mode, use 2 periods or 3 for batch */ - periods = state->is_batch ? 3 : 2; + /* IRQ mode, use 3 periods. This is a bit of a workaround + * for Firewire devices, which seem to only work with 3 periods. + * For PipeWire it does not actually matter how many periods + * are used, we will always keep 1 filled, so we can work fine + * with anything from 2 periods to MAX. */ + periods = 3; CHECK(snd_pcm_hw_params_set_periods_near(hndl, params, &periods, &dir), "set_periods"); state->buffer_frames = period_size * periods; } else {