mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	node: implement activation
Make an eventfd for each node and listen for events when the node is activated. Reorganize some graphs links to make it possible to activiate nodes by signaling the eventfd Pass the peer node to each remote node and let the remote node directly activate the peer when needed. Let each node signal the driver node when finished. With this we don't need to go through the daemon to schedule the graph, nodes will simply activate eachother. We only go to the server when there is a server node to schedule. Keep stats about the state of each node and the time it was triggered, running and finished.
This commit is contained in:
		
							parent
							
								
									f45e0b8966
								
							
						
					
					
						commit
						5de7898808
					
				
					 15 changed files with 470 additions and 173 deletions
				
			
		| 
						 | 
				
			
			@ -893,7 +893,7 @@ static int impl_node_process(struct spa_node *node)
 | 
			
		|||
		trigger = status & SPA_STATUS_HAVE_BUFFER;
 | 
			
		||||
 | 
			
		||||
	if (trigger && !impl->this.node->driver)
 | 
			
		||||
		spa_graph_run(impl->client_node->node->rt.driver);
 | 
			
		||||
		spa_graph_node_process(&impl->client_node->node->rt.root);
 | 
			
		||||
 | 
			
		||||
	return status;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -988,9 +988,6 @@ static void client_node_initialized(void *data)
 | 
			
		|||
	else
 | 
			
		||||
		monitor = false;
 | 
			
		||||
 | 
			
		||||
	spa_graph_node_add(impl->client_node->node->rt.driver, &impl->client_node->node->rt.root);
 | 
			
		||||
	impl->client_node->node->driver_root = impl->this.node;
 | 
			
		||||
 | 
			
		||||
	impl->client_port = pw_node_find_port(impl->client_node->node, impl->direction, 0);
 | 
			
		||||
	if (impl->client_port == NULL)
 | 
			
		||||
		return;
 | 
			
		||||
| 
						 | 
				
			
			@ -1185,17 +1182,32 @@ static void node_initialized(void *data)
 | 
			
		|||
	pw_client_node_registered(impl->client_node, impl->this.node->global->id);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void node_driver_changed(void *data, struct pw_node *driver)
 | 
			
		||||
static void node_peer_added(void *data, struct pw_node *peer)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	pw_log_debug("client-stream %p: driver changed %p", &impl->this, driver);
 | 
			
		||||
	pw_node_events_peer_added(impl->client_node->node, peer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void node_peer_removed(void *data, struct pw_node *peer)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	pw_node_events_peer_removed(impl->client_node->node, peer);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void node_driver_changed(void *data, struct pw_node *old, struct pw_node *driver)
 | 
			
		||||
{
 | 
			
		||||
	struct impl *impl = data;
 | 
			
		||||
	pw_log_debug("client-stream %p: driver changed %p->%p", &impl->this, old, driver);
 | 
			
		||||
	impl->client_node->node->driver_node = driver;
 | 
			
		||||
	pw_node_events_driver_changed(impl->client_node->node, old, driver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const struct pw_node_events node_events = {
 | 
			
		||||
	PW_VERSION_NODE_EVENTS,
 | 
			
		||||
	.free = node_free,
 | 
			
		||||
	.initialized = node_initialized,
 | 
			
		||||
	.peer_added = node_peer_added,
 | 
			
		||||
	.peer_removed = node_peer_removed,
 | 
			
		||||
	.driver_changed = node_driver_changed,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue