diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index ac6107005..77c059b78 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -713,10 +713,15 @@ impl_node_port_set_io(struct spa_node *node, uint32_t id, void *data, size_t size) { struct impl *this; + struct type *t; spa_return_val_if_fail(node != NULL, -EINVAL); this = SPA_CONTAINER_OF(node, struct impl, node); + t = &this->type; + + if (id == t->io.ControlRange) + spa_node_port_set_io(this->resample, direction, 0, id, data, size); return spa_node_port_set_io(this->fmt[direction], direction, port_id, id, data, size); } diff --git a/spa/plugins/audioconvert/resample.c b/spa/plugins/audioconvert/resample.c index 3d2c410f8..bd7edd47b 100644 --- a/spa/plugins/audioconvert/resample.c +++ b/spa/plugins/audioconvert/resample.c @@ -61,6 +61,7 @@ struct port { uint32_t id; struct spa_io_buffers *io; + struct spa_io_control_range *ctrl; struct spa_port_info info; bool have_format; @@ -675,6 +676,8 @@ impl_node_port_set_io(struct spa_node *node, if (id == t->io.Buffers) port->io = data; + else if (id == t->io.ControlRange) + port->ctrl = data; else return -ENOENT; @@ -784,6 +787,8 @@ static int impl_node_process(struct spa_node *node) size = sb->datas[0].chunk->size; maxsize = db->datas[0].maxsize; + if (outport->ctrl) + maxsize = SPA_MIN(outport->ctrl->max_size, maxsize); pin_len = in_len = (size - inport->offset) / sizeof(float); pout_len = out_len = (maxsize - outport->offset) / sizeof(float);