From cb2cc28da09930e82b01ed65064040d3309aa363 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 26 Jan 2023 16:18:58 +0100 Subject: [PATCH] context: don't switch driver rate when nothing is running When the driver has no followers to run, we can keep the current rate and don't need to switch. This avoids a useless switch to the default samplerate when all followers are removed. --- src/pipewire/context.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pipewire/context.c b/src/pipewire/context.c index 6ba6488f5..5d8196df6 100644 --- a/src/pipewire/context.c +++ b/src/pipewire/context.c @@ -1201,10 +1201,12 @@ again: running = true; current_rate = n->current_rate.denom; - if (lock_rate || n->reconfigure || + if (lock_rate || n->reconfigure || !running || (!force_rate && (n->info.state > PW_NODE_STATE_IDLE))) /* when someone wants us to lock the rate of this driver or + * when we are in the process of reconfiguring the driver or + * when we are not running any followers or * when the driver is busy and we don't need to force a rate, * keep the current rate */ target_rate = current_rate;