From 000a6608cf363b363acec039a39c3fb8be6d5c81 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 20 Sep 2022 10:48:09 +0200 Subject: [PATCH] context: suspend all nodes when doing rate change Suspend all nodes of the driver, even if the driver is already suspended. The suspend command makes sure that all nodes renegotiate to the new graph rate. This fixes the following sequence of events: 1. Play 44.1KHz file to loopback sink 2. Sink switches to 44.1, negotiates to 44.1 3. Loopback input and output streams negotiate to 44.1. All is good. 4. Stop playback, wait 5 seconds 5. Sink suspends, loopback input suspends (output stream doesn't suspend) 6. Play 48KHz file 7. Sink switches to 48, negotiates to 48. Sink (and followers) don't suspend because sink was already suspended. 8. loopback input negotiates to 48, output stays at 44.1 -> failure This patch fixes step 7. where it now tries to suspend all followers even when the driver was already suspended. This then ensures that all followers will try to negotiate to the new driver rate. --- src/pipewire/context.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index f86179121..d58c7ba2c 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1205,7 +1205,7 @@ again: if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD) suspend_driver(context, n); } else { - if (n->info.state >= PW_NODE_STATE_IDLE) + if (n->info.state >= PW_NODE_STATE_SUSPENDED) suspend_driver(context, n); } /* we're setting the pending rate. This will become the new