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.
This commit is contained in:
Wim Taymans 2022-09-20 10:48:09 +02:00
parent 6b6cd85e54
commit 000a6608cf

View file

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