From 4694a6643dc09c5e41969d33ed98f42278a02d40 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Mon, 25 Mar 2019 16:15:07 +0100 Subject: [PATCH] pcm: multi plugin - fix wait_for_avail_min All slaves should be asked to wait otherwise the write loop might be interrupted and zero frames might be returned. Signed-off-by: Jaroslav Kysela --- src/pcm/pcm_multi.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index 28440378..0afd31bf 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -775,11 +775,15 @@ static int snd_pcm_multi_mmap(snd_pcm_t *pcm) return 0; } -static int snd_pcm_multi_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t avail ATTRIBUTE_UNUSED) +static int snd_pcm_multi_may_wait_for_avail_min(snd_pcm_t *pcm, snd_pcm_uframes_t avail) { snd_pcm_multi_t *multi = pcm->private_data; - snd_pcm_t *slave = multi->slaves[multi->master_slave].pcm; - return snd_pcm_may_wait_for_avail_min(slave, snd_pcm_mmap_avail(slave)); + unsigned int i; + for (i = 0; i < multi->slaves_count; ++i) { + if (snd_pcm_may_wait_for_avail_min(multi->slaves[i].pcm, avail)) + return 1; + } + return 0; } static snd_pcm_chmap_query_t **snd_pcm_multi_query_chmaps(snd_pcm_t *pcm) -- 2.47.1