From a0a8234391fb4ba17b64d4195d1b23e019910f1f Mon Sep 17 00:00:00 2001 From: zhouyong <13554917170@sina.cn> Date: Tue, 21 Apr 2026 15:35:31 +0800 Subject: [PATCH] alsa-sink: Failed to open the PCM device but the state has advanced --- src/modules/alsa/alsa-sink.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/modules/alsa/alsa-sink.c b/src/modules/alsa/alsa-sink.c index ca22f195f..035596500 100644 --- a/src/modules/alsa/alsa-sink.c +++ b/src/modules/alsa/alsa-sink.c @@ -2005,8 +2005,16 @@ static void thread_func(void *userdata) { if (work_done) { if (u->first) { + int err; + pa_log_info("Starting playback."); - snd_pcm_start(u->pcm_handle); + if ((err = snd_pcm_start(u->pcm_handle)) < 0) { + if ((err = try_recover(u, "snd_pcm_start", err)) < 0) + goto fail; + + /* Recovery resets startup state; retry in next loop iteration. */ + continue; + } #ifdef USE_SMOOTHER_2 pa_smoother_2_resume(u->smoother, pa_rtclock_now());