buffer: remove some hardcoded buffer size limits

Use the quantum_limit as the max buffer size instead of the hardcoded
8192 value.
This commit is contained in:
Wim Taymans 2023-10-13 13:07:48 +02:00
parent 6eb17393bf
commit ac51fbfd1e
2 changed files with 6 additions and 4 deletions

View file

@ -300,7 +300,7 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
blocks, minsize, stride, max_buffers, align, types);
} else {
pw_log_warn("%p: no buffers param", result);
minsize = 8192;
minsize = context->settings.clock_quantum_limit;
max_buffers = 2;
}

View file

@ -26,7 +26,6 @@
PW_LOG_TOPIC_EXTERN(log_filter);
#define PW_LOG_TOPIC_DEFAULT log_filter
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 64
#define MASK_BUFFERS (MAX_BUFFERS-1)
@ -110,6 +109,8 @@ struct filter {
struct pw_loop *main_loop;
struct pw_loop *data_loop;
uint32_t quantum_limit;
enum pw_filter_flags flags;
struct spa_node impl_node;
@ -1236,6 +1237,7 @@ filter_new(struct pw_context *context, const char *name,
}
impl->main_loop = pw_context_get_main_loop(context);
impl->quantum_limit = context->settings.clock_quantum_limit;
this = &impl->this;
pw_log_debug("%p: new", impl);
@ -1779,9 +1781,9 @@ static void add_audio_dsp_port_params(struct filter *impl, struct port *port)
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_STEP_Int(
MAX_SAMPLES * sizeof(float),
impl->quantum_limit * sizeof(float),
sizeof(float),
MAX_SAMPLES * sizeof(float),
impl->quantum_limit * sizeof(float),
sizeof(float)),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(4)));
}