Use configured quantum_limit instead of hardcoded value

Parse the quantum_limit parameters and use this to scale the buffers so
that they can contain the maximum allowed samples instead of the
hardcoded 8192 value.

See #1931
This commit is contained in:
Wim Taymans 2022-01-12 17:50:12 +01:00
parent 4e5ab4bcbe
commit 776b52749f
16 changed files with 124 additions and 44 deletions

View file

@ -53,7 +53,6 @@ static void reset_props(struct props *props)
props->mute = DEFAULT_MUTE;
}
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 16
struct buffer {
@ -90,6 +89,7 @@ struct impl {
struct spa_node node;
struct spa_log *log;
uint32_t quantum_limit;
uint64_t info_all;
struct spa_node_info info;
@ -386,7 +386,7 @@ impl_node_port_enum_params(void *object, int seq,
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(2, 1, MAX_BUFFERS),
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(1),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
MAX_SAMPLES * this->bpf,
this->quantum_limit * this->bpf,
16 * this->bpf,
INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->bpf));
@ -777,6 +777,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);
@ -788,6 +789,13 @@ impl_init(const struct spa_handle_factory *factory,
this->log = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_Log);
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(