mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
client-node: create mix explicitly
This commit is contained in:
parent
44deacbc67
commit
a9a9c72a0a
2 changed files with 26 additions and 24 deletions
|
|
@ -217,14 +217,12 @@ static void mix_init(struct mix *mix, struct port *p, uint32_t mix_id)
|
|||
mix->n_buffers = 0;
|
||||
}
|
||||
|
||||
static struct mix *ensure_mix(struct impl *impl, struct port *p, uint32_t mix_id)
|
||||
static struct mix *create_mix(struct impl *impl, struct port *p, uint32_t mix_id)
|
||||
{
|
||||
struct mix *mix;
|
||||
|
||||
if ((mix = find_mix(p, mix_id)) == NULL)
|
||||
if ((mix = find_mix(p, mix_id)) == NULL || mix->valid)
|
||||
return NULL;
|
||||
if (mix->valid)
|
||||
return mix;
|
||||
mix_init(mix, p, mix_id);
|
||||
return mix;
|
||||
}
|
||||
|
|
@ -726,15 +724,12 @@ do_port_use_buffers(struct impl *impl,
|
|||
direction == SPA_DIRECTION_INPUT ? "input" : "output",
|
||||
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)
|
||||
return -EINVAL;
|
||||
|
||||
if (direction == SPA_DIRECTION_OUTPUT) {
|
||||
mix_id = SPA_ID_INVALID;
|
||||
if ((mix = find_mix(p, mix_id)) == NULL || !mix->valid)
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
clear_buffers(impl, mix);
|
||||
|
||||
if (n_buffers > 0) {
|
||||
|
|
@ -1380,7 +1375,7 @@ static int port_init_mix(void *data, struct pw_impl_port_mix *mix)
|
|||
uint32_t idx, pos, len;
|
||||
struct pw_memblock *area;
|
||||
|
||||
if ((m = ensure_mix(impl, port, mix->port.port_id)) == NULL)
|
||||
if ((m = create_mix(impl, port, mix->port.port_id)) == NULL)
|
||||
return -ENOMEM;
|
||||
|
||||
mix->id = pw_map_insert_new(&impl->io_map, NULL);
|
||||
|
|
@ -1573,7 +1568,7 @@ static void node_port_init(void *data, struct pw_impl_port *port)
|
|||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
&impl_port_mix, p);
|
||||
ensure_mix(impl, p, SPA_ID_INVALID);
|
||||
create_mix(impl, p, SPA_ID_INVALID);
|
||||
|
||||
pw_map_insert_at(&impl->ports[p->direction], p->id, p);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue