mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
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:
parent
4e5ab4bcbe
commit
776b52749f
16 changed files with 124 additions and 44 deletions
|
|
@ -551,8 +551,8 @@ 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(this->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
this->props.max_latency * this->frame_size,
|
||||
this->props.min_latency * this->frame_size,
|
||||
this->quantum_limit * this->frame_size,
|
||||
16 * this->frame_size,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -500,8 +500,8 @@ 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(this->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
this->props.max_latency * this->frame_size,
|
||||
this->props.min_latency * this->frame_size,
|
||||
this->quantum_limit * this->frame_size,
|
||||
16 * this->frame_size,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->frame_size));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -427,6 +427,8 @@ int spa_alsa_init(struct state *state, const struct spa_dict *info)
|
|||
state->card_index = atoi(s);
|
||||
} else if (spa_streq(k, SPA_KEY_API_ALSA_OPEN_UCM)) {
|
||||
state->open_ucm = spa_atob(s);
|
||||
} else if (spa_streq(k, "clock.quantum-limit")) {
|
||||
spa_atou32(s, &state->quantum_limit, 0);
|
||||
} else if (spa_streq(k, "latency.internal.rate")) {
|
||||
state->process_latency.rate = atoi(s);
|
||||
} else if (spa_streq(k, "latency.internal.ns")) {
|
||||
|
|
@ -2308,7 +2310,7 @@ int spa_alsa_start(struct state *state)
|
|||
else {
|
||||
spa_log_warn(state->log, "%s: no position set, using defaults",
|
||||
state->props.device);
|
||||
state->duration = state->props.min_latency;
|
||||
state->duration = 1024;
|
||||
state->rate_denom = state->rate;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -148,6 +148,7 @@ struct state {
|
|||
unsigned int disable_mmap;
|
||||
unsigned int disable_batch;
|
||||
char clock_name[64];
|
||||
uint32_t quantum_limit;
|
||||
|
||||
snd_pcm_uframes_t buffer_frames;
|
||||
snd_pcm_uframes_t period_frames;
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define DEFAULT_SAMPLES 8192
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
||||
|
||||
|
|
@ -142,6 +141,7 @@ struct impl {
|
|||
|
||||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
|
||||
|
|
@ -978,7 +978,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
size = other->size / other->stride;
|
||||
} else {
|
||||
buffers = 1;
|
||||
size = DEFAULT_SAMPLES;
|
||||
size = this->quantum_limit;
|
||||
}
|
||||
|
||||
param = spa_pod_builder_add_object(&b,
|
||||
|
|
@ -1546,6 +1546,8 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
const char *s = info->items[i].value;
|
||||
if (spa_streq(k, SPA_KEY_AUDIO_POSITION))
|
||||
this->props.n_channels = parse_position(this->props.channel_map, s, strlen(s));
|
||||
else if (spa_streq(k, "clock.quantum-limit"))
|
||||
spa_atou32(s, &this->quantum_limit, 0);
|
||||
else
|
||||
channelmix_set_param(this, k, s);
|
||||
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.fmtconvert");
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
||||
|
|
@ -118,6 +117,8 @@ struct impl {
|
|||
|
||||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
uint32_t cpu_flags;
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
|
||||
|
|
@ -136,7 +137,6 @@ struct impl {
|
|||
|
||||
struct spa_latency_info latency[2];
|
||||
|
||||
uint32_t cpu_flags;
|
||||
struct convert conv;
|
||||
unsigned int started:1;
|
||||
unsigned int is_passthrough:1;
|
||||
|
|
@ -545,7 +545,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(port->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * 2 * port->stride,
|
||||
this->quantum_limit * 2 * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride));
|
||||
|
|
@ -1077,6 +1077,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
uint32_t n_support)
|
||||
{
|
||||
struct impl *this;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -1093,6 +1094,13 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (this->cpu)
|
||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
SPA_TYPE_INTERFACE_Node,
|
||||
SPA_VERSION_NODE,
|
||||
|
|
|
|||
|
|
@ -55,7 +55,6 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.merger");
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
||||
|
|
@ -146,6 +145,9 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
|
||||
uint32_t cpu_flags;
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
|
||||
uint64_t info_all;
|
||||
|
|
@ -167,7 +169,6 @@ struct impl {
|
|||
unsigned int have_profile:1;
|
||||
|
||||
struct convert conv;
|
||||
uint32_t cpu_flags;
|
||||
unsigned int is_passthrough:1;
|
||||
unsigned int started:1;
|
||||
unsigned int monitor:1;
|
||||
|
|
@ -873,7 +874,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(1, 1, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(port->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * port->stride,
|
||||
this->quantum_limit * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride));
|
||||
|
|
@ -1579,7 +1580,10 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
for (i = 0; info && i < info->n_items; i++) {
|
||||
const char *k = info->items[i].key;
|
||||
const char *s = info->items[i].value;
|
||||
merger_set_param(this, k, s);
|
||||
if (spa_streq(k, "clock.quantum-limit"))
|
||||
spa_atou32(s, &this->quantum_limit, 0);
|
||||
else
|
||||
merger_set_param(this, k, s);
|
||||
}
|
||||
|
||||
this->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,6 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.resample");
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 8192u
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_BUFFERS 32
|
||||
|
||||
|
|
@ -104,6 +103,8 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
struct spa_io_rate_match *io_rate_match;
|
||||
|
||||
|
|
@ -495,9 +496,9 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
size = (other->size / other->stride) * rate;
|
||||
} else {
|
||||
buffers = 1;
|
||||
size = MAX_SAMPLES * rate;
|
||||
size = this->quantum_limit * rate;
|
||||
}
|
||||
size = SPA_MAX(size, MAX_SAMPLES) * 2;
|
||||
size = SPA_MAX(size, this->quantum_limit) * 2;
|
||||
|
||||
param = spa_pod_builder_add_object(&b,
|
||||
SPA_TYPE_OBJECT_ParamBuffers, id,
|
||||
|
|
@ -1025,7 +1026,7 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
{
|
||||
struct impl *this;
|
||||
struct port *port;
|
||||
const char *str;
|
||||
uint32_t i;
|
||||
|
||||
spa_return_val_if_fail(factory != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(handle != NULL, -EINVAL);
|
||||
|
|
@ -1044,20 +1045,25 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
|
||||
props_reset(&this->props);
|
||||
|
||||
if (info != NULL) {
|
||||
if ((str = spa_dict_lookup(info, "resample.quality")) != NULL)
|
||||
this->props.quality = atoi(str);
|
||||
if ((str = spa_dict_lookup(info, "resample.peaks")) != NULL)
|
||||
this->peaks = spa_atob(str);
|
||||
if ((str = spa_dict_lookup(info, "factory.mode")) != NULL) {
|
||||
if (spa_streq(str, "split"))
|
||||
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);
|
||||
else if (spa_streq(k, "resample.quality"))
|
||||
this->props.quality = atoi(s);
|
||||
else if (spa_streq(k, "resample.peaks"))
|
||||
this->peaks = spa_atob(s);
|
||||
else if (spa_streq(k, "factory.mode")) {
|
||||
if (spa_streq(s, "split"))
|
||||
this->mode = MODE_SPLIT;
|
||||
else if (spa_streq(str, "merge"))
|
||||
else if (spa_streq(s, "merge"))
|
||||
this->mode = MODE_MERGE;
|
||||
else
|
||||
this->mode = MODE_CONVERT;
|
||||
}
|
||||
}
|
||||
|
||||
spa_log_debug(this->log, "mode:%d", this->mode);
|
||||
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
|
|
|
|||
|
|
@ -53,7 +53,6 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.splitter");
|
|||
#define DEFAULT_CHANNELS 2
|
||||
#define DEFAULT_MASK (1LL << SPA_AUDIO_CHANNEL_FL) | (1LL << SPA_AUDIO_CHANNEL_FR)
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_DATAS SPA_AUDIO_MAX_CHANNELS
|
||||
|
|
@ -107,6 +106,9 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
|
||||
uint32_t cpu_flags;
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_io_position *io_position;
|
||||
|
||||
uint64_t info_all;
|
||||
|
|
@ -124,7 +126,6 @@ struct impl {
|
|||
struct spa_audio_info format;
|
||||
unsigned int have_profile:1;
|
||||
|
||||
uint32_t cpu_flags;
|
||||
struct convert conv;
|
||||
unsigned int is_passthrough:1;
|
||||
unsigned int started:1;
|
||||
|
|
@ -554,7 +555,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(1, 1, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(port->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * port->stride,
|
||||
this->quantum_limit * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride));
|
||||
|
|
@ -1149,6 +1150,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);
|
||||
|
|
@ -1165,6 +1167,13 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (this->cpu)
|
||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||
|
||||
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->latency[SPA_DIRECTION_INPUT] = SPA_LATENCY_INFO(SPA_DIRECTION_INPUT);
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
#define DEFAULT_RATE 44100
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_BUFFERS 32
|
||||
|
||||
struct impl;
|
||||
|
|
@ -101,6 +100,8 @@ struct impl {
|
|||
|
||||
struct spa_log *log;
|
||||
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct spa_hook_list hooks;
|
||||
|
||||
uint64_t info_all;
|
||||
|
|
@ -458,7 +459,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(port->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * port->stride,
|
||||
this->quantum_limit * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride));
|
||||
|
|
@ -830,6 +831,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);
|
||||
|
|
@ -841,6 +843,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_log_debug(this->log, NAME " %p: init", this);
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,6 @@
|
|||
#define SPA_LOG_TOPIC_DEFAULT log_topic
|
||||
static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.audiomixer");
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_PORTS 128
|
||||
#define MAX_CHANNELS 64
|
||||
|
|
@ -104,6 +103,7 @@ struct impl {
|
|||
struct spa_log *log;
|
||||
struct spa_cpu *cpu;
|
||||
uint32_t cpu_flags;
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct mix_ops ops;
|
||||
|
||||
|
|
@ -415,7 +415,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(1, 1, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(this->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * this->stride,
|
||||
this->quantum_limit * this->stride,
|
||||
16 * this->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride));
|
||||
|
|
@ -874,6 +874,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);
|
||||
|
|
@ -890,6 +891,13 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (this->cpu)
|
||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -47,7 +47,6 @@ static struct spa_log_topic *log_topic = &SPA_LOG_TOPIC(0, "spa.mixer-dsp");
|
|||
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_PORTS 128
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_ALIGN 64
|
||||
|
||||
#define PORT_DEFAULT_VOLUME 1.0
|
||||
|
|
@ -105,6 +104,8 @@ struct impl {
|
|||
struct spa_cpu *cpu;
|
||||
uint32_t cpu_flags;
|
||||
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct mix_ops ops;
|
||||
|
||||
uint64_t info_all;
|
||||
|
|
@ -396,7 +397,7 @@ next:
|
|||
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(
|
||||
MAX_SAMPLES * this->stride,
|
||||
this->quantum_limit * this->stride,
|
||||
16 * this->stride,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride));
|
||||
|
|
@ -816,6 +817,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);
|
||||
|
|
@ -832,6 +834,13 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
if (this->cpu)
|
||||
this->cpu_flags = spa_cpu_get_flags(this->cpu);
|
||||
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -75,7 +75,6 @@ static void reset_props(struct props *props)
|
|||
props->volume = DEFAULT_VOLUME;
|
||||
}
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_BUFFERS 16
|
||||
#define MAX_PORTS 1
|
||||
|
||||
|
|
@ -119,6 +118,8 @@ struct impl {
|
|||
struct spa_loop *data_loop;
|
||||
struct spa_system *data_system;
|
||||
|
||||
uint32_t quantum_limit;
|
||||
|
||||
uint64_t info_all;
|
||||
struct spa_node_info info;
|
||||
struct spa_param_info params[2];
|
||||
|
|
@ -646,7 +647,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
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(
|
||||
MAX_SAMPLES * port->bpf,
|
||||
this->quantum_limit * port->bpf,
|
||||
16 * port->bpf,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf));
|
||||
|
|
@ -1014,6 +1015,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);
|
||||
|
|
@ -1027,6 +1029,12 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
this->data_loop = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataLoop);
|
||||
this->data_system = spa_support_find(support, n_support, SPA_TYPE_INTERFACE_DataSystem);
|
||||
|
||||
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(
|
||||
|
|
|
|||
|
|
@ -70,7 +70,6 @@ static void reset_props(struct props *props)
|
|||
#define DEFAULT_CHANNELS 2
|
||||
#define DEFAULT_RATE 44100
|
||||
|
||||
#define MAX_SAMPLES 8192
|
||||
#define MAX_BUFFERS 16
|
||||
#define MAX_PORTS 1
|
||||
|
||||
|
|
@ -107,6 +106,8 @@ struct impl {
|
|||
struct spa_loop *data_loop;
|
||||
struct spa_system *data_system;
|
||||
|
||||
uint32_t quantum_limit;
|
||||
|
||||
struct props props;
|
||||
|
||||
uint64_t info_all;
|
||||
|
|
@ -538,7 +539,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(1, 1, MAX_BUFFERS),
|
||||
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(port->blocks),
|
||||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
MAX_SAMPLES * port->bpf,
|
||||
this->quantum_limit * port->bpf,
|
||||
16 * port->bpf,
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->bpf));
|
||||
|
|
@ -856,7 +857,6 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
spa_log_error(this->log, "a data_system is needed");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
spa_hook_list_init(&this->hooks);
|
||||
|
||||
this->node.iface = SPA_INTERFACE_INIT(
|
||||
|
|
@ -904,7 +904,9 @@ impl_init(const struct spa_handle_factory *factory,
|
|||
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, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
if (spa_streq(k, "clock.quantum-limit")) {
|
||||
spa_atou32(s, &this->quantum_limit, 0);
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_CHANNELS)) {
|
||||
this->props.channels = atoi(s);
|
||||
} else if (spa_streq(k, SPA_KEY_AUDIO_RATE)) {
|
||||
this->props.rate = atoi(s);
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -704,6 +704,8 @@ static void manager_added(void *data, struct pw_manager_object *o)
|
|||
client->impl->defs.sample_spec.rate = atoi(str);
|
||||
if ((str = spa_dict_lookup(info->props, "default.clock.max-quantum")) != NULL)
|
||||
client->impl->defs.max_quantum = atoi(str);
|
||||
if ((str = spa_dict_lookup(info->props, "default.clock.quantum-limit")) != NULL)
|
||||
client->impl->defs.quantum_limit = atoi(str);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -994,11 +996,12 @@ static const struct spa_pod *get_buffers_param(struct stream *s,
|
|||
{
|
||||
const struct spa_pod *param;
|
||||
uint32_t blocks, buffers, size, maxsize, stride;
|
||||
struct defs *defs = &s->impl->defs;
|
||||
|
||||
blocks = 1;
|
||||
stride = s->frame_size;
|
||||
|
||||
maxsize = 8192 * 32 * s->frame_size;
|
||||
maxsize = defs->quantum_limit * 32 * s->frame_size;
|
||||
if (s->direction == PW_DIRECTION_OUTPUT) {
|
||||
size = attr->minreq;
|
||||
} else {
|
||||
|
|
@ -5143,6 +5146,7 @@ static void load_defaults(struct defs *def, struct pw_properties *props)
|
|||
parse_position(props, "pulse.default.position", DEFAULT_POSITION, &def->channel_map);
|
||||
def->sample_spec.channels = def->channel_map.channels;
|
||||
def->max_quantum = 8192;
|
||||
def->quantum_limit = 8192;
|
||||
}
|
||||
|
||||
struct pw_protocol_pulse *pw_protocol_pulse_new(struct pw_context *context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue