mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
add some constants for max samples
This commit is contained in:
parent
605a0a6f97
commit
2fa97daa24
8 changed files with 31 additions and 22 deletions
|
|
@ -42,8 +42,8 @@
|
|||
#define CHECK_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) == 0)
|
||||
|
||||
static const char default_device[] = "hw:0";
|
||||
static const uint32_t default_min_latency = 16;
|
||||
static const uint32_t default_max_latency = 1024;
|
||||
static const uint32_t default_min_latency = MIN_LATENCY;
|
||||
static const uint32_t default_max_latency = MAX_LATENCY;
|
||||
|
||||
static void reset_props(struct props *props)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -42,8 +42,8 @@
|
|||
#define CHECK_PORT(this,d,p) ((d) == SPA_DIRECTION_OUTPUT && (p) == 0)
|
||||
|
||||
static const char default_device[] = "hw:0";
|
||||
static const uint32_t default_min_latency = 64;
|
||||
static const uint32_t default_max_latency = 1024;
|
||||
static const uint32_t default_min_latency = MIN_LATENCY;
|
||||
static const uint32_t default_max_latency = MAX_LATENCY;
|
||||
|
||||
static void reset_props(struct props *props)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,6 +44,9 @@ extern "C" {
|
|||
#include <spa/param/param.h>
|
||||
#include <spa/param/audio/format-utils.h>
|
||||
|
||||
#define MIN_LATENCY 16
|
||||
#define MAX_LATENCY 1024
|
||||
|
||||
#define DEFAULT_RATE 48000u
|
||||
#define DEFAULT_CHANNELS 2u
|
||||
|
||||
|
|
|
|||
|
|
@ -45,6 +45,7 @@
|
|||
#define DEFAULT_RATE 44100
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 1024
|
||||
#define MAX_BUFFERS 32
|
||||
#define MAX_DATAS 32
|
||||
|
||||
|
|
@ -569,7 +570,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
size = other->size / other->stride;
|
||||
} else {
|
||||
buffers = 1;
|
||||
size = port->format.info.raw.rate * 1024 / DEFAULT_RATE;
|
||||
size = MAX_SAMPLES;
|
||||
}
|
||||
|
||||
param = spa_pod_builder_add_object(&b,
|
||||
|
|
@ -579,7 +580,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
|
||||
size * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX / port->stride),
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -47,7 +47,9 @@
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 1024
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_DATAS 32
|
||||
#define MAX_PORTS 128
|
||||
|
||||
|
|
@ -473,9 +475,9 @@ 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(
|
||||
2048 * port->stride,
|
||||
MAX_SAMPLES * 2 * port->stride,
|
||||
16 * port->stride,
|
||||
INT32_MAX / port->stride),
|
||||
INT32_MAX),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride),
|
||||
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
|
||||
}
|
||||
|
|
@ -698,7 +700,7 @@ impl_node_port_use_buffers(void *object,
|
|||
this, j, i);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!SPA_IS_ALIGNED(d[j].data, 16)) {
|
||||
if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) {
|
||||
spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned",
|
||||
this, j, i);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,7 +48,8 @@
|
|||
#define DEFAULT_RATE 48000
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 2048
|
||||
#define MAX_SAMPLES 1024
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_DATAS 32
|
||||
#define MAX_PORTS 128
|
||||
|
|
@ -110,7 +111,7 @@ struct impl {
|
|||
unsigned int monitor:1;
|
||||
unsigned int have_profile:1;
|
||||
|
||||
float empty[MAX_SAMPLES + 15];
|
||||
float empty[MAX_SAMPLES*2 + MAX_ALIGN];
|
||||
};
|
||||
|
||||
#define CHECK_IN_PORT(this,d,p) ((d) == SPA_DIRECTION_INPUT && (p) < this->port_count)
|
||||
|
|
@ -490,7 +491,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(
|
||||
1024 * port->stride,
|
||||
MAX_SAMPLES * port->stride,
|
||||
16 * port->stride,
|
||||
MAX_SAMPLES * port->stride),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride),
|
||||
|
|
@ -793,7 +794,7 @@ impl_node_port_use_buffers(void *object,
|
|||
this, j, i, d[j].type, d[j].data);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!SPA_IS_ALIGNED(d[j].data, 16)) {
|
||||
if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) {
|
||||
spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned",
|
||||
this, j, i);
|
||||
}
|
||||
|
|
@ -962,7 +963,7 @@ static int impl_node_process(void *object)
|
|||
struct port *inport = GET_IN_PORT(this, i);
|
||||
|
||||
if (get_in_buffer(this, inport, &sbuf) < 0) {
|
||||
src_datas[n_src_datas++] = SPA_PTR_ALIGN(this->empty, 16, void);
|
||||
src_datas[n_src_datas++] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -47,6 +47,7 @@
|
|||
#define DEFAULT_RATE 44100
|
||||
#define DEFAULT_CHANNELS 2
|
||||
|
||||
#define MAX_SAMPLES 1024
|
||||
#define MAX_BUFFERS 32
|
||||
|
||||
struct impl;
|
||||
|
|
@ -425,7 +426,7 @@ impl_node_port_enum_params(void *object, int seq,
|
|||
}
|
||||
else {
|
||||
buffers = 1;
|
||||
size = 2048 * other->stride;
|
||||
size = MAX_SAMPLES * 2 * other->stride;
|
||||
}
|
||||
|
||||
param = spa_pod_builder_add_object(&b,
|
||||
|
|
@ -755,7 +756,7 @@ static int impl_node_process(void *object)
|
|||
if (this->io_position) {
|
||||
max = this->io_position->clock.duration;
|
||||
} else {
|
||||
max = 1024;
|
||||
max = maxsize / sizeof(float);
|
||||
}
|
||||
|
||||
switch (this->mode) {
|
||||
|
|
|
|||
|
|
@ -49,7 +49,8 @@
|
|||
#define DEFAULT_CHANNELS 2
|
||||
#define DEFAULT_MASK (1LL << SPA_AUDIO_CHANNEL_FL) | (1LL << SPA_AUDIO_CHANNEL_FR)
|
||||
|
||||
#define MAX_SAMPLES 2048
|
||||
#define MAX_SAMPLES 1024
|
||||
#define MAX_ALIGN 16
|
||||
#define MAX_BUFFERS 64
|
||||
#define MAX_DATAS 32
|
||||
#define MAX_PORTS 128
|
||||
|
|
@ -112,7 +113,7 @@ struct impl {
|
|||
|
||||
bool have_profile;
|
||||
|
||||
float empty[MAX_SAMPLES + 15];
|
||||
float empty[MAX_SAMPLES*2 + MAX_ALIGN];
|
||||
};
|
||||
|
||||
#define CHECK_OUT_PORT(this,d,p) ((d) == SPA_DIRECTION_OUTPUT && (p) < this->port_count)
|
||||
|
|
@ -473,7 +474,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(
|
||||
1024 * port->stride,
|
||||
MAX_SAMPLES * port->stride,
|
||||
16 * port->stride,
|
||||
MAX_SAMPLES * port->stride),
|
||||
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride),
|
||||
|
|
@ -751,7 +752,7 @@ impl_node_port_use_buffers(void *object,
|
|||
this, j, i, d[j].type, d[j].data);
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!SPA_IS_ALIGNED(d[j].data, 16)) {
|
||||
if (!SPA_IS_ALIGNED(d[j].data, MAX_ALIGN)) {
|
||||
spa_log_warn(this->log, NAME " %p: memory %d on buffer %d not aligned",
|
||||
this, j, i);
|
||||
}
|
||||
|
|
@ -878,7 +879,7 @@ static int impl_node_process(void *object)
|
|||
outio->status = -EPIPE;
|
||||
empty:
|
||||
spa_log_trace_fp(this->log, NAME" %p: %d skip output", this, i);
|
||||
dst_datas[n_dst_datas++] = SPA_PTR_ALIGN(this->empty, 16, void);
|
||||
dst_datas[n_dst_datas++] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -902,7 +903,7 @@ static int impl_node_process(void *object)
|
|||
}
|
||||
while (n_dst_datas < this->port_count) {
|
||||
spa_log_trace_fp(this->log, NAME" %p: %d fill output", this, n_dst_datas);
|
||||
dst_datas[n_dst_datas++] = SPA_PTR_ALIGN(this->empty, 16, void);
|
||||
dst_datas[n_dst_datas++] = SPA_PTR_ALIGN(this->empty, MAX_ALIGN, void);
|
||||
}
|
||||
|
||||
spa_log_trace_fp(this->log, NAME " %p: n_src:%d n_dst:%d n_samples:%d max:%d stride:%d p:%d", this,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue