mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	port: don't keep port flags
Always query the port flags when we need them because they can change and there is therefore no need to keep them around.
This commit is contained in:
		
							parent
							
								
									2b096993ed
								
							
						
					
					
						commit
						87d30a0e04
					
				
					 3 changed files with 13 additions and 12 deletions
				
			
		| 
						 | 
				
			
			@ -632,8 +632,14 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
 | 
			
		|||
	output = this->output;
 | 
			
		||||
 | 
			
		||||
	pw_log_debug("link %p: doing alloc buffers %p %p", this, output->node, input->node);
 | 
			
		||||
	oinfo = &output->spa_info;
 | 
			
		||||
	iinfo = &input->spa_info;
 | 
			
		||||
	if ((res = spa_node_port_get_info(input->node->node,
 | 
			
		||||
				input->direction, input->port_id,
 | 
			
		||||
				&iinfo)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
	if ((res = spa_node_port_get_info(output->node->node,
 | 
			
		||||
				output->direction, output->port_id,
 | 
			
		||||
				&oinfo)) < 0)
 | 
			
		||||
		return res;
 | 
			
		||||
 | 
			
		||||
	in_flags = iinfo->flags;
 | 
			
		||||
	out_flags = oinfo->flags;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -329,7 +329,6 @@ static int do_add_port(struct spa_loop *loop,
 | 
			
		|||
        struct pw_port *this = user_data;
 | 
			
		||||
	struct spa_graph_node *out, *in;
 | 
			
		||||
 | 
			
		||||
	this->rt.port.flags = this->spa_info.flags;
 | 
			
		||||
	spa_graph_port_add(&this->node->rt.node, &this->rt.port);
 | 
			
		||||
	spa_graph_port_add(&this->rt.mix_node, &this->rt.mix_port);
 | 
			
		||||
	spa_graph_port_link(&this->rt.port, &this->rt.mix_port);
 | 
			
		||||
| 
						 | 
				
			
			@ -518,14 +517,11 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
 | 
			
		|||
			       &spa_info)) < 0)
 | 
			
		||||
			goto info_failed;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	port->node = node;
 | 
			
		||||
	port->spa_info = *spa_info;
 | 
			
		||||
	port->spa_info.props = NULL;
 | 
			
		||||
 | 
			
		||||
	if (spa_info->props)
 | 
			
		||||
		pw_port_update_properties(port, spa_info->props);
 | 
			
		||||
 | 
			
		||||
	port->node = node;
 | 
			
		||||
 | 
			
		||||
	pw_node_events_port_init(node, port);
 | 
			
		||||
 | 
			
		||||
	pw_port_for_each_param(port, SPA_PARAM_IO, 0, 0, NULL, check_param_io, port);
 | 
			
		||||
| 
						 | 
				
			
			@ -548,12 +544,12 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
 | 
			
		|||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (SPA_FLAG_CHECK(port->spa_info.flags, SPA_PORT_INFO_FLAG_PHYSICAL))
 | 
			
		||||
	if (SPA_FLAG_CHECK(spa_info->flags, SPA_PORT_INFO_FLAG_PHYSICAL))
 | 
			
		||||
		pw_properties_set(port->properties, "port.physical", "1");
 | 
			
		||||
	if (SPA_FLAG_CHECK(port->spa_info.flags, SPA_PORT_INFO_FLAG_TERMINAL))
 | 
			
		||||
	if (SPA_FLAG_CHECK(spa_info->flags, SPA_PORT_INFO_FLAG_TERMINAL))
 | 
			
		||||
		pw_properties_set(port->properties, "port.terminal", "1");
 | 
			
		||||
 | 
			
		||||
	pw_log_debug("port %p: %d add to node %p %08x", port, port_id, node, port->spa_info.flags);
 | 
			
		||||
	pw_log_debug("port %p: %d add to node %p %08x", port, port_id, node, spa_info->flags);
 | 
			
		||||
 | 
			
		||||
	spa_list_append(ports, &port->link);
 | 
			
		||||
	pw_map_insert_at(portmap, port_id, port);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -403,7 +403,6 @@ struct pw_port {
 | 
			
		|||
 | 
			
		||||
	enum pw_direction direction;	/**< port direction */
 | 
			
		||||
	uint32_t port_id;		/**< port id */
 | 
			
		||||
	struct spa_port_info spa_info;
 | 
			
		||||
 | 
			
		||||
	struct pw_properties *properties;	/**< properties of the port */
 | 
			
		||||
	struct pw_port_info info;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue