File periods-min-fail.patch of Package pipewire
From 2e2f7c9f7952823d6a876597dae1e68bd3009705 Mon Sep 17 00:00:00 2001
From: Pauli Virtanen <pav@iki.fi>
Date: Mon, 22 Sep 2025 20:27:19 +0300
Subject: [PATCH] alsa: don't fail if 3 periods_min fails
Some drivers (emu10k1) appear to not necessarily support more than 2
periods.
Don't fail start if snd_pcm_hw_params_set_periods_min() fails, then we
just set nearest possible periods and buffer sizes.
---
spa/plugins/alsa/alsa-pcm.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
index 4daaa44c22..b9e631c58d 100644
--- a/spa/plugins/alsa/alsa-pcm.c
+++ b/spa/plugins/alsa/alsa-pcm.c
@@ -2360,10 +2360,14 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
snd_pcm_uframes_t period_size_max;
unsigned int periods_min = (periods == UINT_MAX) ? 3 : periods;
- CHECK(snd_pcm_hw_params_set_periods_min(hndl, params, &periods_min, &dir), "set_periods_min");
- CHECK(snd_pcm_hw_params_get_period_size_max(params, &period_size_max, &dir), "get_period_size_max");
- if (period_size > period_size_max)
- period_size = SPA_MIN(period_size, flp2(period_size_max));
+ err = snd_pcm_hw_params_set_periods_min(hndl, params, &periods_min, &dir);
+ if (!err) {
+ CHECK(snd_pcm_hw_params_get_period_size_max(params, &period_size_max, &dir), "get_period_size_max");
+ if (period_size > period_size_max)
+ period_size = SPA_MIN(period_size, flp2(period_size_max));
+ } else {
+ spa_log_debug(state->log, "set_periods_min: %s", snd_strerror(err));
+ }
}
CHECK(snd_pcm_hw_params_set_period_size_near(hndl, params, &period_size, &dir), "set_period_size_near");
--
GitLab