mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-chain: move data allocation out of the link loop
The port data allocation does not depend on the links so move it out of the loop.
This commit is contained in:
		
							parent
							
								
									d1cd199f16
								
							
						
					
					
						commit
						ac67475e64
					
				
					 1 changed files with 14 additions and 14 deletions
				
			
		| 
						 | 
				
			
			@ -1654,22 +1654,22 @@ static int setup_output_port(struct graph *graph, struct port *port)
 | 
			
		|||
	struct link *link;
 | 
			
		||||
	uint32_t i, n_hndl = port->node->n_hndl;
 | 
			
		||||
 | 
			
		||||
	spa_list_for_each(link, &port->link_list, output_link) {
 | 
			
		||||
		for (i = 0; i < n_hndl; i++) {
 | 
			
		||||
			float *data;
 | 
			
		||||
			if ((data = port->audio_data[i]) == NULL) {
 | 
			
		||||
				data = calloc(1, MAX_SAMPLES * sizeof(float));
 | 
			
		||||
				if (data == NULL)
 | 
			
		||||
					return -errno;
 | 
			
		||||
			}
 | 
			
		||||
			port->audio_data[i] = data;
 | 
			
		||||
			pw_log_info("connect output port %s[%d]:%s %p",
 | 
			
		||||
					port->node->name, i, d->ports[port->p].name,
 | 
			
		||||
					port->audio_data[i]);
 | 
			
		||||
			d->connect_port(port->node->hndl[i], port->p, data);
 | 
			
		||||
	for (i = 0; i < n_hndl; i++) {
 | 
			
		||||
		float *data;
 | 
			
		||||
		if ((data = port->audio_data[i]) == NULL) {
 | 
			
		||||
			data = calloc(1, MAX_SAMPLES * sizeof(float));
 | 
			
		||||
			if (data == NULL)
 | 
			
		||||
				return -errno;
 | 
			
		||||
		}
 | 
			
		||||
		link->input->node->n_deps--;
 | 
			
		||||
		port->audio_data[i] = data;
 | 
			
		||||
		pw_log_info("connect output port %s[%d]:%s %p",
 | 
			
		||||
				port->node->name, i, d->ports[port->p].name,
 | 
			
		||||
				port->audio_data[i]);
 | 
			
		||||
		d->connect_port(port->node->hndl[i], port->p, data);
 | 
			
		||||
	}
 | 
			
		||||
	spa_list_for_each(link, &port->link_list, output_link)
 | 
			
		||||
		link->input->node->n_deps--;
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue