mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-16 07:00:00 -05:00
context: avoid useless graph recalculations
Only recalculate the state of the graph when we actually managed to suspend a driver node.
This commit is contained in:
parent
04aa803d7e
commit
ea4e5cf364
1 changed files with 7 additions and 3 deletions
|
|
@ -1195,6 +1195,7 @@ again:
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target_rate != current_rate) {
|
if (target_rate != current_rate) {
|
||||||
|
bool do_suspend = false;
|
||||||
/* we doing a rate switch */
|
/* we doing a rate switch */
|
||||||
pw_log_info("(%s-%u) state:%s new rate:%u->%u",
|
pw_log_info("(%s-%u) state:%s new rate:%u->%u",
|
||||||
n->name, n->info.id,
|
n->name, n->info.id,
|
||||||
|
|
@ -1204,18 +1205,21 @@ again:
|
||||||
|
|
||||||
if (force_rate) {
|
if (force_rate) {
|
||||||
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
if (settings->clock_rate_update_mode == CLOCK_RATE_UPDATE_MODE_HARD)
|
||||||
suspend_driver(context, n);
|
do_suspend = true;
|
||||||
} else {
|
} else {
|
||||||
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
if (n->info.state >= PW_NODE_STATE_SUSPENDED)
|
||||||
suspend_driver(context, n);
|
do_suspend = true;
|
||||||
}
|
}
|
||||||
|
if (do_suspend)
|
||||||
|
suspend_driver(context, n);
|
||||||
/* we're setting the pending rate. This will become the new
|
/* we're setting the pending rate. This will become the new
|
||||||
* current rate in the next iteration of the graph. */
|
* current rate in the next iteration of the graph. */
|
||||||
n->current_rate = SPA_FRACTION(1, target_rate);
|
n->current_rate = SPA_FRACTION(1, target_rate);
|
||||||
n->current_pending = true;
|
n->current_pending = true;
|
||||||
current_rate = target_rate;
|
current_rate = target_rate;
|
||||||
/* we might be suspended now and the links need to be prepared again */
|
/* we might be suspended now and the links need to be prepared again */
|
||||||
goto again;
|
if (do_suspend)
|
||||||
|
goto again;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rate_quantum != 0 && current_rate != rate_quantum) {
|
if (rate_quantum != 0 && current_rate != rate_quantum) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue