mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-04 13:30:12 -05:00
small cleanups
This commit is contained in:
parent
c9fb320987
commit
8b74a3c0d2
4 changed files with 18 additions and 2 deletions
|
|
@ -287,6 +287,9 @@ static int setup_convert(struct impl *this)
|
|||
outport->format.info.raw.rate,
|
||||
outport->format.info.raw.layout);
|
||||
|
||||
if (this->n_links > 0)
|
||||
return 0;
|
||||
|
||||
/* unpack */
|
||||
make_link(this, NULL, 0, this->fmt_in, 0, &inport->format);
|
||||
prev = this->fmt_in;
|
||||
|
|
|
|||
|
|
@ -100,6 +100,9 @@ on_process(void *_data)
|
|||
uint8_t *src, *dst;
|
||||
|
||||
b = pw_stream_dequeue_buffer(stream);
|
||||
if (b == NULL)
|
||||
return;
|
||||
|
||||
buf = b->buffer;
|
||||
|
||||
pw_log_trace("new buffer %d", buf->id);
|
||||
|
|
|
|||
|
|
@ -1198,6 +1198,10 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
|||
if (output == input)
|
||||
goto same_ports;
|
||||
|
||||
if (output->direction != PW_DIRECTION_OUTPUT ||
|
||||
input->direction != PW_DIRECTION_INPUT)
|
||||
goto wrong_direction;
|
||||
|
||||
if (pw_link_find(output, input))
|
||||
goto link_exists;
|
||||
|
||||
|
|
@ -1276,6 +1280,9 @@ struct pw_link *pw_link_new(struct pw_core *core,
|
|||
same_ports:
|
||||
asprintf(error, "can't link the same ports");
|
||||
return NULL;
|
||||
wrong_direction:
|
||||
asprintf(error, "ports have wrong direction");
|
||||
return NULL;
|
||||
link_exists:
|
||||
asprintf(error, "link already exists");
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -815,8 +815,10 @@ struct pw_port *pw_node_get_free_port(struct pw_node *node, enum pw_direction di
|
|||
|
||||
/* first try to find an unlinked port */
|
||||
spa_list_for_each(p, ports, link) {
|
||||
if (spa_list_is_empty(&p->links))
|
||||
return p;
|
||||
if (spa_list_is_empty(&p->links)) {
|
||||
port = p;
|
||||
goto found;
|
||||
}
|
||||
/* for output we can reuse an existing port, for input only
|
||||
* when there is a multiplex */
|
||||
if (direction == PW_DIRECTION_OUTPUT || p->mix != NULL)
|
||||
|
|
@ -841,6 +843,7 @@ struct pw_port *pw_node_get_free_port(struct pw_node *node, enum pw_direction di
|
|||
} else {
|
||||
port = mixport;
|
||||
}
|
||||
found:
|
||||
pw_log_debug("node %p: return port %p", node, port);
|
||||
return port;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue