From 189f2ec95b854b4f6c12b67b533ae3263ee979dc Mon Sep 17 00:00:00 2001 From: Stefan Ursella Date: Wed, 4 Sep 2024 07:29:30 +0000 Subject: [PATCH] alsa-pcm: unlink pcm when driver is changed to a different pcm We have to unlink pcms when they are linked to a driver from a different pcm. When a playback and a capture pcm is linked and we start the playback pcm and the capture pcm later this can leads to a 'EPIPE' error on the capture device. ... spa.alsa: hw:3,0c: snd_pcm_start: Broken pipe ... --- spa/plugins/alsa/alsa-pcm.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index 768a1e22d..dba3900a4 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -3549,6 +3549,10 @@ static int do_state_sync(struct spa_loop *loop, bool async, uint32_t seq, spa_list_append(&state->driver->rt.followers, &rt->driver_link); rt->driver = state->driver; spa_log_debug(state->log, "state:%p -> driver:%p", state, state->driver); + + if(state->linked && state->matching) { + try_unlink(state); + } } if (state->following) { remove_sources(state);