client-node: send the mix_info before Buffer IO

We don't always need to send buffers to a remote port, when the port
is an output port, all the mix ports use the same buffers. This means
that when we add another link to a port, we don't get the mix_info
anymore and then we don't know the peer_id and we don't complete the
link and we don't call the connection_callback.

Instead, send the mix_info right before sending the Buffer Io area. We
always do this for all mix io and after we have sent the buffers so this
is a better place.

Fixes #2841
This commit is contained in:
Wim Taymans 2022-11-20 19:24:01 +01:00
parent a0adb52124
commit 0918899bf8
2 changed files with 8 additions and 8 deletions

View File

@ -2484,7 +2484,7 @@ static int client_node_port_set_mix_info(void *data,
else
mix->peer_port = l->port_link.our_input;
pw_log_info("peer port %p %p %p", mix->peer_port,
pw_log_debug("peer port %p %p %p", mix->peer_port,
l->port_link.our_output, l->port_link.our_input);
if (!l->port_link.is_complete) {

View File

@ -744,7 +744,7 @@ do_port_use_buffers(struct impl *impl,
struct node *this = &impl->node;
struct port *p;
struct mix *mix;
uint32_t i, j, peer_id;
uint32_t i, j;
struct pw_client_node_buffer *mb;
p = GET_PORT(this, direction, port_id);
@ -762,8 +762,6 @@ do_port_use_buffers(struct impl *impl,
if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
return -EINVAL;
peer_id = mix->peer_id;
if (direction == SPA_DIRECTION_OUTPUT) {
mix_id = SPA_ID_INVALID;
if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
@ -881,10 +879,6 @@ do_port_use_buffers(struct impl *impl,
}
mix->n_buffers = n_buffers;
if (this->resource->version >= 4)
pw_client_node_resource_port_set_mix_info(this->resource,
direction, port_id, mix_id,
peer_id, NULL);
return pw_client_node_resource_port_use_buffers(this->resource,
direction, port_id, mix_id, flags,
n_buffers, mb);
@ -1486,6 +1480,7 @@ static int impl_mix_port_set_io(void *object,
struct port *p = object;
struct pw_impl_port *port = p->port;
struct impl *impl = port->owner_data;
struct node *this = &impl->node;
struct pw_impl_port_mix *mix;
mix = pw_map_lookup(&port->mix_port_map, mix_id);
@ -1497,6 +1492,11 @@ static int impl_mix_port_set_io(void *object,
mix->io = data;
else
mix->io = NULL;
if (this->resource->version >= 4 && mix->io != NULL)
pw_client_node_resource_port_set_mix_info(this->resource,
direction, port->port_id,
mix->port.port_id, mix->peer_id, NULL);
}
return do_port_set_io(impl,