context: don't try to restore rate on !runnable nodes

There is no point in trying to restore a node to the default rate when
it's not going to run.

This avoids loops when rate switching from one forced rate to another.
This commit is contained in:
Wim Taymans 2023-03-31 10:14:36 +02:00
parent 108715ebfb
commit 7372a078b4
2 changed files with 3 additions and 1 deletions

View file

@ -1304,7 +1304,7 @@ again:
s->moved = false;
}
if (n->forced_rate && !force_rate) {
if (n->forced_rate && !force_rate && n->runnable) {
/* A node that was forced to a rate but is no longer being
* forced can restore its rate */
pw_log_info("(%s-%u) restore rate", n->name, n->info.id);

View file

@ -1026,6 +1026,8 @@ static void check_properties(struct pw_impl_node *node)
if ((str = pw_properties_get(node->properties, PW_KEY_NODE_FORCE_RATE))) {
if (spa_atou32(str, &value, 0) &&
node->force_rate != value) {
pw_log_info("(%s-%u) force-rate:%u -> %u", node->name,
node->info.id, node->force_rate, value);
node->force_rate = value;
node->stamp = ++context->stamp;
recalc_reason = "force rate changed";