Increase max buffer size

This commit is contained in:
Wim Taymans 2019-10-24 15:26:59 +02:00
parent 81fc595e3d
commit af73585948
12 changed files with 38 additions and 26 deletions

View file

@ -45,7 +45,7 @@ extern "C" {
#include <spa/param/audio/format-utils.h>
#define MIN_LATENCY 16
#define MAX_LATENCY 1024
#define MAX_LATENCY 8192
#define DEFAULT_RATE 48000u
#define DEFAULT_CHANNELS 2u

View file

@ -45,7 +45,7 @@
#define DEFAULT_RATE 44100
#define DEFAULT_CHANNELS 2
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 32
#define MAX_DATAS 32

View file

@ -47,7 +47,7 @@
#define DEFAULT_RATE 48000
#define DEFAULT_CHANNELS 2
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 64
#define MAX_ALIGN 16
#define MAX_DATAS 32

View file

@ -48,7 +48,7 @@
#define DEFAULT_RATE 48000
#define DEFAULT_CHANNELS 2
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_ALIGN 16
#define MAX_BUFFERS 64
#define MAX_DATAS 32
@ -493,7 +493,7 @@ impl_node_port_enum_params(void *object, int seq,
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
MAX_SAMPLES * port->stride,
16 * port->stride,
MAX_SAMPLES * port->stride),
INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(port->stride),
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
break;

View file

@ -47,7 +47,7 @@
#define DEFAULT_RATE 44100
#define DEFAULT_CHANNELS 2
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 32
struct impl;
@ -426,7 +426,7 @@ impl_node_port_enum_params(void *object, int seq,
}
else {
buffers = 1;
size = MAX_SAMPLES * 2 * other->stride;
size = MAX_SAMPLES*2 * other->stride;
}
param = spa_pod_builder_add_object(&b,
@ -436,7 +436,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;
@ -821,6 +821,12 @@ static int impl_node_process(void *object)
SPA_FLAG_SET(res, SPA_STATUS_HAVE_DATA);
spa_log_trace_fp(this->log, NAME " %p: have output buffer", this);
}
if (out_len == 0 && this->peaks) {
outio->status = SPA_STATUS_HAVE_DATA;
outio->buffer_id = SPA_ID_INVALID;
SPA_FLAG_SET(res, SPA_STATUS_HAVE_DATA);
spa_log_trace_fp(this->log, NAME " %p: no output buffer", this);
}
if (this->io_rate_match) {
this->io_rate_match->delay = resample_delay(&this->resample);

View file

@ -49,7 +49,7 @@
#define DEFAULT_CHANNELS 2
#define DEFAULT_MASK (1LL << SPA_AUDIO_CHANNEL_FL) | (1LL << SPA_AUDIO_CHANNEL_FR)
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_ALIGN 16
#define MAX_BUFFERS 64
#define MAX_DATAS 32

View file

@ -43,6 +43,7 @@
#define DEFAULT_RATE 44100
#define DEFAULT_CHANNELS 2
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 32
struct impl;
@ -453,9 +454,9 @@ 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(
1024 * port->stride,
MAX_SAMPLES * 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;

View file

@ -41,6 +41,7 @@
#define NAME "audiomixer"
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 64
#define MAX_PORTS 128
@ -387,9 +388,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(1),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
1024 * this->bpf,
MAX_SAMPLES * this->bpf,
16 * this->bpf,
INT32_MAX / this->bpf),
INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(0),
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
break;

View file

@ -43,7 +43,7 @@
#define MAX_BUFFERS 64
#define MAX_PORTS 128
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_ALIGN 64
#define PORT_DEFAULT_VOLUME 1.0
@ -386,9 +386,9 @@ 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(
1024 * this->stride,
MAX_SAMPLES * this->stride,
16 * this->stride,
INT32_MAX / this->stride),
INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(this->stride),
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
break;
@ -602,6 +602,10 @@ impl_node_port_use_buffers(void *object,
}
if (direction == SPA_DIRECTION_OUTPUT)
queue_buffer(this, port, b);
spa_log_debug(this->log, NAME " %p: port %d.%d buffer %d n_data:%d data:%p maxsize:%d",
this, i, direction, port_id,
buffers[i]->n_datas, d[0].data, d[0].maxsize);
}
port->n_buffers = n_buffers;
@ -701,13 +705,12 @@ static int impl_node_process(void *object)
continue;
}
spa_log_trace_fp(this->log, NAME " %p: mix input %d %p->%p %d %d", this,
i, inio, outio, inio->status, inio->buffer_id);
inb = &inport->buffers[inio->buffer_id];
maxsize = SPA_MIN(inb->buffer->datas[0].chunk->size, maxsize);
spa_log_trace_fp(this->log, NAME " %p: mix input %d %p->%p %d %d %d", this,
i, inio, outio, inio->status, inio->buffer_id, maxsize);
datas[n_buffers] = inb->buffer->datas[0].data;
buffers[n_buffers++] = inb;
inio->status = SPA_STATUS_NEED_DATA;

View file

@ -72,8 +72,9 @@ static void reset_props(struct props *props)
props->volume = DEFAULT_VOLUME;
}
#define MAX_BUFFERS 16
#define MAX_PORTS 1
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 16
#define MAX_PORTS 1
struct buffer {
uint32_t id;
@ -600,9 +601,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(1),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
1024 * port->bpf,
MAX_SAMPLES * port->bpf,
16 * port->bpf,
INT32_MAX / port->bpf),
INT32_MAX),
SPA_PARAM_BUFFERS_stride, SPA_POD_Int(0),
SPA_PARAM_BUFFERS_align, SPA_POD_Int(16));
break;

View file

@ -51,7 +51,7 @@ static void reset_props(struct props *props)
props->mute = DEFAULT_MUTE;
}
#define MAX_SAMPLES 1024
#define MAX_SAMPLES 8192
#define MAX_BUFFERS 16
struct buffer {

View file

@ -1131,7 +1131,7 @@ static int collect_nodes(struct pw_node *driver)
quantum = DEFAULT_QUANTUM;
/* for now, we try to limit the latency between min and default, We can
* go higher but we should really only do this when in power save mode */
* go to max but we should really only do this when in power save mode */
driver->quantum_current = SPA_CLAMP(quantum, MIN_QUANTUM, DEFAULT_QUANTUM);
return 0;