mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	filter-graph: cleanup up port data
An input port has at most 1 link so we can avoid the loop and the default port data. We can then also improve the logging and log something when we set silence.
This commit is contained in:
		
							parent
							
								
									c5ae456b9e
								
							
						
					
					
						commit
						e7d61a6fdf
					
				
					 1 changed files with 18 additions and 17 deletions
				
			
		| 
						 | 
					@ -1434,7 +1434,7 @@ static int impl_activate(void *object, const struct spa_dict *props)
 | 
				
			||||||
	const struct spa_fga_plugin *p;
 | 
						const struct spa_fga_plugin *p;
 | 
				
			||||||
	uint32_t i, j, max_samples = impl->quantum_limit;
 | 
						uint32_t i, j, max_samples = impl->quantum_limit;
 | 
				
			||||||
	int res;
 | 
						int res;
 | 
				
			||||||
	float *sd, *dd;
 | 
						float *sd, *dd, *data;
 | 
				
			||||||
	const char *rate;
 | 
						const char *rate;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (graph->activated)
 | 
						if (graph->activated)
 | 
				
			||||||
| 
						 | 
					@ -1478,17 +1478,17 @@ static int impl_activate(void *object, const struct spa_dict *props)
 | 
				
			||||||
		for (i = 0; i < node->n_hndl; i++) {
 | 
							for (i = 0; i < node->n_hndl; i++) {
 | 
				
			||||||
			for (j = 0; j < desc->n_input; j++) {
 | 
								for (j = 0; j < desc->n_input; j++) {
 | 
				
			||||||
				port = &node->input_port[j];
 | 
									port = &node->input_port[j];
 | 
				
			||||||
				d->connect_port(node->hndl[i], port->p, sd);
 | 
									if (!spa_list_is_empty(&port->link_list)) {
 | 
				
			||||||
 | 
										link = spa_list_first(&port->link_list, struct link, input_link);
 | 
				
			||||||
				spa_list_for_each(link, &port->link_list, input_link) {
 | 
										if ((res = port_ensure_data(link->output, i, max_samples)) < 0)
 | 
				
			||||||
					struct port *peer = link->output;
 | 
					 | 
				
			||||||
					if ((res = port_ensure_data(peer, i, max_samples)) < 0)
 | 
					 | 
				
			||||||
						goto error;
 | 
											goto error;
 | 
				
			||||||
					spa_log_info(impl->log, "connect input port %s[%d]:%s %p",
 | 
										data = link->output->audio_data[i];
 | 
				
			||||||
							node->name, i, d->ports[port->p].name,
 | 
									} else {
 | 
				
			||||||
							peer->audio_data[i]);
 | 
										data = sd;
 | 
				
			||||||
					d->connect_port(node->hndl[i], port->p, peer->audio_data[i]);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									spa_log_info(impl->log, "connect input port %s[%d]:%s %p",
 | 
				
			||||||
 | 
											node->name, i, d->ports[port->p].name, data);
 | 
				
			||||||
 | 
									d->connect_port(node->hndl[i], port->p, data);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for (j = 0; j < desc->n_output; j++) {
 | 
								for (j = 0; j < desc->n_output; j++) {
 | 
				
			||||||
				port = &node->output_port[j];
 | 
									port = &node->output_port[j];
 | 
				
			||||||
| 
						 | 
					@ -1500,15 +1500,16 @@ static int impl_activate(void *object, const struct spa_dict *props)
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for (j = 0; j < desc->n_control; j++) {
 | 
								for (j = 0; j < desc->n_control; j++) {
 | 
				
			||||||
				port = &node->control_port[j];
 | 
									port = &node->control_port[j];
 | 
				
			||||||
				d->connect_port(node->hndl[i], port->p, &port->control_data[i]);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
				spa_list_for_each(link, &port->link_list, input_link) {
 | 
									if (!spa_list_is_empty(&port->link_list)) {
 | 
				
			||||||
					struct port *peer = link->output;
 | 
										link = spa_list_first(&port->link_list, struct link, input_link);
 | 
				
			||||||
					spa_log_info(impl->log, "connect control port %s[%d]:%s %p",
 | 
										data = &link->output->control_data[i];
 | 
				
			||||||
							node->name, i, d->ports[port->p].name,
 | 
									} else {
 | 
				
			||||||
							&peer->control_data[i]);
 | 
										data = &port->control_data[i];
 | 
				
			||||||
					d->connect_port(node->hndl[i], port->p, &peer->control_data[i]);
 | 
					 | 
				
			||||||
				}
 | 
									}
 | 
				
			||||||
 | 
									spa_log_info(impl->log, "connect control port %s[%d]:%s %p",
 | 
				
			||||||
 | 
											node->name, i, d->ports[port->p].name, data);
 | 
				
			||||||
 | 
									d->connect_port(node->hndl[i], port->p, data);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			for (j = 0; j < desc->n_notify; j++) {
 | 
								for (j = 0; j < desc->n_notify; j++) {
 | 
				
			||||||
				port = &node->notify_port[j];
 | 
									port = &node->notify_port[j];
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue