mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
port: allocate only from output ports
We don't need to use the mix_id to allocate, the allocation is always shared between all output mixer ports
This commit is contained in:
parent
dcbe94c55a
commit
f0eb59bc75
3 changed files with 18 additions and 22 deletions
|
|
@ -676,7 +676,6 @@ static int do_allocation(struct pw_link *this)
|
||||||
|
|
||||||
if (out_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS) {
|
if (out_flags & SPA_PORT_FLAG_CAN_ALLOC_BUFFERS) {
|
||||||
if ((res = pw_port_alloc_buffers(output,
|
if ((res = pw_port_alloc_buffers(output,
|
||||||
this->rt.out_mix.port.port_id,
|
|
||||||
params, n_params,
|
params, n_params,
|
||||||
allocation.buffers,
|
allocation.buffers,
|
||||||
&allocation.n_buffers)) < 0) {
|
&allocation.n_buffers)) < 0) {
|
||||||
|
|
|
||||||
|
|
@ -978,7 +978,7 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (n_buffers == 0) {
|
if (n_buffers == 0) {
|
||||||
if (port->n_mix == 0)
|
if (port->n_mix == 1)
|
||||||
pw_port_update_state(port, PW_PORT_STATE_READY);
|
pw_port_update_state(port, PW_PORT_STATE_READY);
|
||||||
}
|
}
|
||||||
if (port->state == PW_PORT_STATE_READY) {
|
if (port->state == PW_PORT_STATE_READY) {
|
||||||
|
|
@ -1001,37 +1001,34 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
SPA_EXPORT
|
SPA_EXPORT
|
||||||
int pw_port_alloc_buffers(struct pw_port *port, uint32_t mix_id,
|
int pw_port_alloc_buffers(struct pw_port *port,
|
||||||
struct spa_pod **params, uint32_t n_params,
|
struct spa_pod **params, uint32_t n_params,
|
||||||
struct spa_buffer **buffers, uint32_t *n_buffers)
|
struct spa_buffer **buffers, uint32_t *n_buffers)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
struct pw_node *node = port->node;
|
struct pw_node *node = port->node;
|
||||||
struct pw_port_mix *mix;
|
|
||||||
const struct pw_port_implementation *pi = port->implementation;
|
const struct pw_port_implementation *pi = port->implementation;
|
||||||
|
|
||||||
if (port->state < PW_PORT_STATE_READY)
|
if (port->state < PW_PORT_STATE_READY)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
||||||
if ((mix = pw_map_lookup(&port->mix_port_map, mix_id)) == NULL)
|
if ((res = spa_node_port_alloc_buffers(node->node, port->direction, port->port_id,
|
||||||
return -EIO;
|
params, n_params,
|
||||||
|
buffers, n_buffers)) < 0) {
|
||||||
if (port->mix->port_alloc_buffers) {
|
pw_log_error("port %p: %d alloc failed: %d (%s)", port, port->port_id,
|
||||||
struct spa_graph_port *p = &mix->port;
|
res, spa_strerror(res));
|
||||||
res = spa_node_port_alloc_buffers(port->mix, p->direction, p->port_id,
|
|
||||||
params, n_params,
|
|
||||||
buffers, n_buffers);
|
|
||||||
} else {
|
|
||||||
res = spa_node_port_alloc_buffers(node->node, port->direction, port->port_id,
|
|
||||||
params, n_params,
|
|
||||||
buffers, n_buffers);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pi && pi->alloc_buffers)
|
if (res >= 0 && pi && pi->alloc_buffers) {
|
||||||
res = pi->alloc_buffers(port->implementation_data, params, n_params, buffers, n_buffers);
|
if ((res = pi->alloc_buffers(port->implementation_data,
|
||||||
|
params, n_params, buffers, n_buffers)) < 0) {
|
||||||
|
pw_log_error("port %p: %d implementation alloc failed: %d (%s)",
|
||||||
|
port, port->port_id, res, spa_strerror(res));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pw_log_debug("port %p: %d.%d alloc %d buffers: %d (%s)", port,
|
pw_log_debug("port %p: %d alloc %d buffers: %d (%s)", port,
|
||||||
port->port_id, mix_id, *n_buffers, res, spa_strerror(res));
|
port->port_id, *n_buffers, res, spa_strerror(res));
|
||||||
|
|
||||||
free_allocation(&port->allocation);
|
free_allocation(&port->allocation);
|
||||||
|
|
||||||
|
|
@ -1043,7 +1040,7 @@ int pw_port_alloc_buffers(struct pw_port *port, uint32_t mix_id,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*n_buffers == 0) {
|
if (*n_buffers == 0) {
|
||||||
if (port->n_mix == 0)
|
if (port->n_mix == 1)
|
||||||
pw_port_update_state(port, PW_PORT_STATE_READY);
|
pw_port_update_state(port, PW_PORT_STATE_READY);
|
||||||
}
|
}
|
||||||
else if (!SPA_RESULT_IS_ASYNC(res)) {
|
else if (!SPA_RESULT_IS_ASYNC(res)) {
|
||||||
|
|
|
||||||
|
|
@ -778,7 +778,7 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id,
|
||||||
struct spa_buffer **buffers, uint32_t n_buffers);
|
struct spa_buffer **buffers, uint32_t n_buffers);
|
||||||
|
|
||||||
/** Allocate memory for buffers on a port \memberof pw_port */
|
/** Allocate memory for buffers on a port \memberof pw_port */
|
||||||
int pw_port_alloc_buffers(struct pw_port *port, uint32_t mix_id,
|
int pw_port_alloc_buffers(struct pw_port *port,
|
||||||
struct spa_pod **params, uint32_t n_params,
|
struct spa_pod **params, uint32_t n_params,
|
||||||
struct spa_buffer **buffers, uint32_t *n_buffers);
|
struct spa_buffer **buffers, uint32_t *n_buffers);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue