mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-01 22:58:50 -04:00
remote-node: refactor init/create/ensure mix
Make a create_mix function that also takes the peer_id.
This commit is contained in:
parent
6806af954e
commit
001f0656d4
2 changed files with 30 additions and 14 deletions
|
|
@ -518,9 +518,10 @@ static void free_object(struct client *c, struct object *o)
|
|||
|
||||
}
|
||||
|
||||
static void init_mix(struct mix *mix, uint32_t mix_id, struct port *port)
|
||||
static void init_mix(struct mix *mix, uint32_t mix_id, struct port *port, uint32_t peer_id)
|
||||
{
|
||||
mix->id = mix_id;
|
||||
mix->peer_id = mix_id;
|
||||
mix->port = port;
|
||||
mix->io = NULL;
|
||||
mix->n_buffers = 0;
|
||||
|
|
@ -549,14 +550,12 @@ static struct mix *find_mix(struct client *c, struct port *port, uint32_t mix_id
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static struct mix *ensure_mix(struct client *c, struct port *port, uint32_t mix_id)
|
||||
static struct mix *create_mix(struct client *c, struct port *port,
|
||||
uint32_t mix_id, uint32_t peer_id)
|
||||
{
|
||||
struct mix *mix;
|
||||
uint32_t i;
|
||||
|
||||
if ((mix = find_mix(c, port, mix_id)) != NULL)
|
||||
return mix;
|
||||
|
||||
if (spa_list_is_empty(&c->free_mix)) {
|
||||
mix = calloc(OBJECT_CHUNK, sizeof(struct mix));
|
||||
if (mix == NULL)
|
||||
|
|
@ -570,11 +569,19 @@ static struct mix *ensure_mix(struct client *c, struct port *port, uint32_t mix_
|
|||
|
||||
spa_list_append(&port->mix, &mix->port_link);
|
||||
|
||||
init_mix(mix, mix_id, port);
|
||||
init_mix(mix, mix_id, port, peer_id);
|
||||
|
||||
return mix;
|
||||
}
|
||||
|
||||
static struct mix *ensure_mix(struct client *c, struct port *port, uint32_t mix_id)
|
||||
{
|
||||
struct mix *mix;
|
||||
if ((mix = find_mix(c, port, mix_id)) != NULL)
|
||||
return mix;
|
||||
return create_mix(c, port, mix_id, SPA_ID_INVALID);
|
||||
}
|
||||
|
||||
static int clear_buffers(struct client *c, struct mix *mix)
|
||||
{
|
||||
struct port *port = mix->port;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue