client-node: send the right peer_id

Output ports share the same buffers on all mix outputs and the buffers
are stored in a special mix area with id SPA_ID_INVALID.

The special mix area does not have the peer_id of the link, we need to
get that from the non-shared mix area.

This fixes some invalid peer port-id values in the set_mix_info event.
This commit is contained in:
Wim Taymans 2021-09-30 16:36:21 +02:00
parent ddfbd684e7
commit 3dde9fef9c

View file

@ -749,7 +749,7 @@ do_port_use_buffers(struct impl *impl,
struct node *this = &impl->node; struct node *this = &impl->node;
struct port *p; struct port *p;
struct mix *mix; struct mix *mix;
uint32_t i, j; uint32_t i, j, peer_id;
struct pw_client_node_buffer *mb; struct pw_client_node_buffer *mb;
if (!CHECK_PORT(this, direction, port_id)) if (!CHECK_PORT(this, direction, port_id))
@ -761,12 +761,17 @@ do_port_use_buffers(struct impl *impl,
direction == SPA_DIRECTION_INPUT ? "input" : "output", direction == SPA_DIRECTION_INPUT ? "input" : "output",
port_id, mix_id, buffers, n_buffers, flags); port_id, mix_id, buffers, n_buffers, flags);
if (direction == SPA_DIRECTION_OUTPUT)
mix_id = SPA_ID_INVALID;
if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid) if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
return -EINVAL; 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)
return -EINVAL;
}
clear_buffers(this, mix); clear_buffers(this, mix);
if (n_buffers > 0) { if (n_buffers > 0) {
@ -875,7 +880,7 @@ do_port_use_buffers(struct impl *impl,
if (this->resource->version >= 4) if (this->resource->version >= 4)
pw_client_node_resource_port_set_mix_info(this->resource, pw_client_node_resource_port_set_mix_info(this->resource,
direction, port_id, mix_id, direction, port_id, mix_id,
mix->peer_id, NULL); peer_id, NULL);
return pw_client_node_resource_port_use_buffers(this->resource, return pw_client_node_resource_port_use_buffers(this->resource,
direction, port_id, mix_id, flags, direction, port_id, mix_id, flags,
n_buffers, mb); n_buffers, mb);