control: use quantum_limit for midi buffer size

Instead of the arbitrary default.
This commit is contained in:
Wim Taymans 2024-05-10 11:49:31 +02:00
parent 7e87bd9b34
commit 89edb9f6c5
4 changed files with 23 additions and 3 deletions

View file

@ -60,6 +60,8 @@ struct impl {
struct spa_handle handle;
struct spa_node node;
uint32_t quantum_limit;
struct spa_log *log;
struct spa_loop *data_loop;
@ -363,7 +365,8 @@ next:
SPA_TYPE_OBJECT_ParamBuffers, id,
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(1, 1, MAX_BUFFERS),
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(4096, 512, INT32_MAX),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(this->quantum_limit,
this->quantum_limit, INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(1));
break;
@ -866,6 +869,7 @@ impl_init(const struct spa_handle_factory *factory,
{
struct impl *this;
struct port *port;
uint32_t i;
spa_return_val_if_fail(factory != NULL, -EINVAL);
spa_return_val_if_fail(handle != NULL, -EINVAL);
@ -883,6 +887,16 @@ impl_init(const struct spa_handle_factory *factory,
return -EINVAL;
}
this->quantum_limit = 8192;
for (i = 0; info && i < info->n_items; i++) {
const char *k = info->items[i].key;
const char *s = info->items[i].value;
if (spa_streq(k, "clock.quantum-limit")) {
spa_atou32(s, &this->quantum_limit, 0);
}
}
spa_hook_list_init(&this->hooks);
this->node.iface = SPA_INTERFACE_INIT(