From 19c9a550503843d9f8917ddbf0efa289455a0663 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 30 Sep 2020 10:14:44 +0200 Subject: [PATCH] pulse: first sync globals, then try operations First sync the globals and if no global created new pending operations, run through the operations. This ensures no operation is run before all globals have data. --- pipewire-pulseaudio/src/context.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pipewire-pulseaudio/src/context.c b/pipewire-pulseaudio/src/context.c index d6cfbb4cf..78184278b 100644 --- a/pipewire-pulseaudio/src/context.c +++ b/pipewire-pulseaudio/src/context.c @@ -1492,17 +1492,20 @@ static void core_done(void *data, uint32_t id, int seq) if (c->pending_seq != seq) return; - spa_list_init(&ops); - spa_list_consume(o, &c->operations, link) { - spa_list_remove(&o->link); - spa_list_append(&ops, &o->link); - } spa_list_for_each(g, &c->globals, link) { if (g->sync) { do_global_sync(g); g->sync = false; } } + if (c->pending_seq != seq) + return; + + spa_list_init(&ops); + spa_list_consume(o, &c->operations, link) { + spa_list_remove(&o->link); + spa_list_append(&ops, &o->link); + } spa_list_for_each_safe(o, t, &ops, link) { if (!o->sync) continue;