mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
mixer-dsp: mix a quantum of data at a time
When there is no input, mix up to a quantum of data. Otherwise we might send too much data to the next node and cause a delay if it does not handle this.
This commit is contained in:
parent
a427e602bd
commit
ecc0eecf0f
1 changed files with 20 additions and 2 deletions
|
|
@ -105,6 +105,7 @@ struct impl {
|
||||||
uint32_t cpu_flags;
|
uint32_t cpu_flags;
|
||||||
uint32_t max_align;
|
uint32_t max_align;
|
||||||
|
|
||||||
|
struct spa_io_position *io_position;
|
||||||
uint32_t quantum_limit;
|
uint32_t quantum_limit;
|
||||||
|
|
||||||
struct mix_ops ops;
|
struct mix_ops ops;
|
||||||
|
|
@ -152,7 +153,20 @@ static int impl_node_set_param(void *object, uint32_t id, uint32_t flags,
|
||||||
|
|
||||||
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
||||||
{
|
{
|
||||||
return -ENOTSUP;
|
struct impl *this = object;
|
||||||
|
|
||||||
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
|
|
||||||
|
spa_log_debug(this->log, "%p: io %d %p/%zd", this, id, data, size);
|
||||||
|
|
||||||
|
switch (id) {
|
||||||
|
case SPA_IO_Position:
|
||||||
|
this->io_position = data;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return -ENOENT;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||||
|
|
@ -694,7 +708,10 @@ static int impl_node_process(void *object)
|
||||||
datas = alloca(MAX_PORTS * sizeof(void *));
|
datas = alloca(MAX_PORTS * sizeof(void *));
|
||||||
n_buffers = 0;
|
n_buffers = 0;
|
||||||
|
|
||||||
maxsize = UINT32_MAX;
|
if (SPA_LIKELY(this->io_position))
|
||||||
|
maxsize = this->io_position->clock.duration * sizeof(float);
|
||||||
|
else
|
||||||
|
maxsize = this->quantum_limit;
|
||||||
|
|
||||||
for (i = 0; i < this->last_port; i++) {
|
for (i = 0; i < this->last_port; i++) {
|
||||||
struct port *inport = GET_IN_PORT(this, i);
|
struct port *inport = GET_IN_PORT(this, i);
|
||||||
|
|
@ -846,6 +863,7 @@ impl_init(const struct spa_handle_factory *factory,
|
||||||
this->max_align = SPA_MIN(MAX_ALIGN, spa_cpu_get_max_align(this->cpu));
|
this->max_align = SPA_MIN(MAX_ALIGN, spa_cpu_get_max_align(this->cpu));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this->quantum_limit = 8192;
|
||||||
for (i = 0; info && i < info->n_items; i++) {
|
for (i = 0; info && i < info->n_items; i++) {
|
||||||
const char *k = info->items[i].key;
|
const char *k = info->items[i].key;
|
||||||
const char *s = info->items[i].value;
|
const char *s = info->items[i].value;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue