impl-node: handle node <-> driver links with node_peer

Also handle the relation between a node and the driver with pw_node_peer,
like we do with the links.

Because these are refcounted, we only make one peer for a node that is
linked to another node that is also the driver (pw-play -> sink) and we
save some fds as well as some admin stuff and overhead for the refcounts.

This in return then results in less problems getting all the refcounts
right when adding/removing nodes.
This commit is contained in:
Wim Taymans 2024-06-14 11:41:14 +02:00
parent 1466d0ae78
commit c89a68b0b4
5 changed files with 30 additions and 31 deletions

View file

@ -1210,8 +1210,8 @@ static struct pw_proxy *node_export(struct pw_core *core, void *object, bool do_
/* the node might have been registered and added to a driver. When we export,
* we will be assigned a new driver target from the server and we can forget our
* local ones. */
pw_impl_node_remove_target(node, &node->rt.driver_target);
pw_impl_node_remove_target(node->driver_node, &node->rt.target);
pw_node_peer_unref(spa_steal_ptr(node->from_driver_peer));
pw_node_peer_unref(spa_steal_ptr(node->to_driver_peer));
data->allow_mlock = pw_properties_get_bool(node->properties, "mem.allow-mlock",
data->context->settings.mem_allow_mlock);