mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
context: handle leaf nodes better
Find leaf nodes by looking at the number of max in/out ports and the
link group. This should give us nodes that only consume/produce data.
If a leaf node is linked to a driver with only passive links, it will
never be able to be scheduled unless we also make it runnable when the
driver is made runnable from another node.
This can happen when you do:
pw-record -P '{ node.passive=true }' test.wav
and then
pw-record test2.wav
Without this, the first pw-record would never be scheduled. With the
patch it will be scheduled when the second pw-record is started.
Fixes #4915
This commit is contained in:
parent
468a9ac954
commit
3cf182255f
3 changed files with 21 additions and 2 deletions
|
|
@ -1101,11 +1101,25 @@ static int collect_nodes(struct pw_context *context, struct pw_impl_node *node,
|
|||
pw_log_debug(" next node %p: '%s' runnable:%u %p %p %p", n, n->name, n->runnable,
|
||||
n->groups, n->link_groups, sync);
|
||||
}
|
||||
spa_list_for_each(n, collect, sort_link)
|
||||
if (!n->driving && n->runnable) {
|
||||
/* All non-driver runnable nodes (ie. reachable with a non-passive link) now make
|
||||
* all linked nodes up and downstream runnable as well */
|
||||
spa_list_for_each(n, collect, sort_link) {
|
||||
if (!n->driver && n->runnable) {
|
||||
run_nodes(context, n, collect, PW_DIRECTION_OUTPUT, 0);
|
||||
run_nodes(context, n, collect, PW_DIRECTION_INPUT, 0);
|
||||
}
|
||||
}
|
||||
/* now we might have made a driver runnable, if the node is not runnable at this point
|
||||
* it means it was linked to the driver with passives links and some other node
|
||||
* made the driver active. If the node is a leaf it can not be activated in any other
|
||||
* way and we will also make it, and all its peers, runnable */
|
||||
spa_list_for_each(n, collect, sort_link) {
|
||||
if (!n->driver && n->driver_node->runnable && !n->runnable && n->leaf) {
|
||||
n->runnable = true;
|
||||
run_nodes(context, n, collect, PW_DIRECTION_OUTPUT, 0);
|
||||
run_nodes(context, n, collect, PW_DIRECTION_INPUT, 0);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1309,6 +1309,10 @@ static void check_properties(struct pw_impl_node *node)
|
|||
}
|
||||
}
|
||||
node->lock_rate = pw_properties_get_bool(node->properties, PW_KEY_NODE_LOCK_RATE, false);
|
||||
/* the leaf node is one that only produces/consumes the data. We can deduce this from the
|
||||
* absence of a link-group and the fact that it has no output/input ports. */
|
||||
node->leaf = node->link_groups == NULL &&
|
||||
(node->info.max_input_ports == 0 || node->info.max_output_ports == 0);
|
||||
|
||||
value = pw_properties_get_uint32(node->properties, PW_KEY_NODE_FORCE_RATE, SPA_ID_INVALID);
|
||||
if (value == 0)
|
||||
|
|
|
|||
|
|
@ -784,6 +784,7 @@ struct pw_impl_node {
|
|||
unsigned int async:1; /**< async processing, one cycle latency */
|
||||
unsigned int lazy:1; /**< the graph is lazy scheduling */
|
||||
unsigned int exclusive:1; /**< ports can only be linked once */
|
||||
unsigned int leaf:1; /**< node only produces/consumes data */
|
||||
|
||||
uint32_t transport; /**< latest transport request */
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue