mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-05 13:30:02 -05:00
port: don't keep port_info around but make copy
This commit is contained in:
parent
e1ec1bad23
commit
63333adca3
4 changed files with 15 additions and 11 deletions
|
|
@ -1056,6 +1056,7 @@ client_node_port_update(void *data,
|
|||
if (port == NULL) {
|
||||
target = &this->dummy;
|
||||
spa_zero(this->dummy);
|
||||
target->id = port_id;
|
||||
}
|
||||
else
|
||||
target = port;
|
||||
|
|
|
|||
|
|
@ -632,8 +632,8 @@ 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;
|
||||
oinfo = &output->spa_info;
|
||||
iinfo = &input->spa_info;
|
||||
|
||||
in_flags = iinfo->flags;
|
||||
out_flags = oinfo->flags;
|
||||
|
|
|
|||
|
|
@ -329,7 +329,7 @@ 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;
|
||||
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);
|
||||
|
|
@ -486,6 +486,7 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
|
|||
const char *str, *dir;
|
||||
int res;
|
||||
bool control;
|
||||
const struct spa_port_info *spa_info;
|
||||
|
||||
if (port->node != NULL)
|
||||
return -EEXIST;
|
||||
|
|
@ -504,7 +505,7 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
|
|||
|
||||
if ((res = spa_node_port_get_info(node->node,
|
||||
port->direction, port_id,
|
||||
&port->spa_info)) < 0) {
|
||||
&spa_info)) < 0) {
|
||||
/* can't get port info, try to add it.. */
|
||||
if ((res = spa_node_add_port(node->node, port->direction, port_id)) < 0)
|
||||
goto add_failed;
|
||||
|
|
@ -514,14 +515,16 @@ int pw_port_add(struct pw_port *port, struct pw_node *node)
|
|||
/* try again */
|
||||
if ((res = spa_node_port_get_info(node->node,
|
||||
port->direction, port_id,
|
||||
&port->spa_info)) < 0)
|
||||
&spa_info)) < 0)
|
||||
goto info_failed;
|
||||
}
|
||||
|
||||
port->node = node;
|
||||
port->spa_info = *spa_info;
|
||||
port->spa_info.props = NULL;
|
||||
|
||||
if (port->spa_info->props)
|
||||
pw_port_update_properties(port, port->spa_info->props);
|
||||
if (spa_info->props)
|
||||
pw_port_update_properties(port, spa_info->props);
|
||||
|
||||
pw_node_events_port_init(node, port);
|
||||
|
||||
|
|
@ -545,12 +548,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(port->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(port->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, port->spa_info.flags);
|
||||
|
||||
spa_list_append(ports, &port->link);
|
||||
pw_map_insert_at(portmap, port_id, port);
|
||||
|
|
|
|||
|
|
@ -403,7 +403,7 @@ struct pw_port {
|
|||
|
||||
enum pw_direction direction; /**< port direction */
|
||||
uint32_t port_id; /**< port id */
|
||||
const struct spa_port_info *spa_info;
|
||||
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