impl-link: handle passive nodes

Parse the NODE_PASSIVE flag on nodes.
When a node is marked passive, make a passive link unless explicitly
set with a link property.

This removes the need for the session manager to set the passive flag
and it also makes things work better when using tools like pw-link.
This commit is contained in:
Wim Taymans 2023-03-08 15:28:52 +01:00
parent c04b3b3261
commit 40f43d4715
3 changed files with 7 additions and 1 deletions

View file

@ -1152,6 +1152,7 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
struct impl *impl;
struct pw_impl_link *this;
struct pw_impl_node *input_node, *output_node;
const char *str;
int res;
if (output == input)
@ -1201,7 +1202,10 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
this->input = input;
/* passive means that this link does not make the nodes active */
this->passive = pw_properties_get_bool(properties, PW_KEY_LINK_PASSIVE, false);
str = pw_properties_get(properties, PW_KEY_LINK_PASSIVE);
this->passive = str ? spa_atob(str) : output_node->passive | input_node->passive;
if (this->passive && str == NULL)
pw_properties_set(properties, PW_KEY_LINK_PASSIVE, "true");
spa_hook_list_init(&this->listener_list);

View file

@ -947,6 +947,7 @@ static void check_properties(struct pw_impl_node *node)
recalc_reason = "link group changed";
}
node->passive = pw_properties_get_bool(node->properties, PW_KEY_NODE_PASSIVE, false);
node->want_driver = pw_properties_get_bool(node->properties, PW_KEY_NODE_WANT_DRIVER, false);
node->always_process = pw_properties_get_bool(node->properties, PW_KEY_NODE_ALWAYS_PROCESS, false);

View file

@ -686,6 +686,7 @@ struct pw_impl_node {
* is selected to drive the graph */
unsigned int visited:1; /**< for sorting */
unsigned int want_driver:1; /**< this node wants to be assigned to a driver */
unsigned int passive:1; /**< node links should be passive */
unsigned int runnable:1; /**< node is runnable */
unsigned int freewheel:1; /**< if this is the freewheel driver */
unsigned int loopchecked:1; /**< for feedback loop checking */