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.
This commit is contained in:
Wim Taymans 2023-01-26 16:18:58 +01:00
parent fba7083f8c
commit cb2cc28da0

View file

@ -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;