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:
Wim Taymans 2018-10-15 17:49:54 +02:00
parent 2b096993ed
commit 87d30a0e04
3 changed files with 13 additions and 12 deletions

View file

@ -632,8 +632,14 @@ static int do_allocation(struct pw_link *this, uint32_t in_state, uint32_t out_s
output = this->output; output = this->output;
pw_log_debug("link %p: doing alloc buffers %p %p", this, output->node, input->node); pw_log_debug("link %p: doing alloc buffers %p %p", this, output->node, input->node);
oinfo = &output->spa_info; if ((res = spa_node_port_get_info(input->node->node,
iinfo = &input->spa_info; 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; in_flags = iinfo->flags;
out_flags = oinfo->flags; out_flags = oinfo->flags;

View file

@ -329,7 +329,6 @@ static int do_add_port(struct spa_loop *loop,
struct pw_port *this = user_data; struct pw_port *this = user_data;
struct spa_graph_node *out, *in; 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->node->rt.node, &this->rt.port);
spa_graph_port_add(&this->rt.mix_node, &this->rt.mix_port); spa_graph_port_add(&this->rt.mix_node, &this->rt.mix_port);
spa_graph_port_link(&this->rt.port, &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) &spa_info)) < 0)
goto info_failed; goto info_failed;
} }
port->node = node;
port->spa_info = *spa_info;
port->spa_info.props = NULL;
if (spa_info->props) if (spa_info->props)
pw_port_update_properties(port, spa_info->props); pw_port_update_properties(port, spa_info->props);
port->node = node;
pw_node_events_port_init(node, port); pw_node_events_port_init(node, port);
pw_port_for_each_param(port, SPA_PARAM_IO, 0, 0, NULL, check_param_io, 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"); 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_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); spa_list_append(ports, &port->link);
pw_map_insert_at(portmap, port_id, port); pw_map_insert_at(portmap, port_id, port);

View file

@ -403,7 +403,6 @@ struct pw_port {
enum pw_direction direction; /**< port direction */ enum pw_direction direction; /**< port direction */
uint32_t port_id; /**< port id */ uint32_t port_id; /**< port id */
struct spa_port_info spa_info;
struct pw_properties *properties; /**< properties of the port */ struct pw_properties *properties; /**< properties of the port */
struct pw_port_info info; struct pw_port_info info;