pulse-server: increase buffer size

Because we keep everything in a ringbuffer and provide exactly the
required amount of data, we can use 1/4 buffers.
Also increase the buffer size. We don't want to limit the buffer size
to the negotiated tlength because it can be increased later. Instead
scale it to the max quantum size (8192) with a max resample rate of 32.
This commit is contained in:
Wim Taymans 2021-12-14 15:42:19 +01:00
parent 57dae3e2b3
commit fd4ea442d9
2 changed files with 6 additions and 6 deletions

View file

@ -49,8 +49,8 @@
#define NATIVE_COOKIE_LENGTH 256 #define NATIVE_COOKIE_LENGTH 256
#define MAX_TAG_SIZE (64*1024) #define MAX_TAG_SIZE (64*1024)
#define MIN_BUFFERS 8u #define MIN_BUFFERS 1u
#define MAX_BUFFERS 64u #define MAX_BUFFERS 4u
#define MAXLENGTH (4*1024*1024) /* 4MB */ #define MAXLENGTH (4*1024*1024) /* 4MB */

View file

@ -1005,12 +1005,11 @@ static const struct spa_pod *get_buffers_param(struct stream *s,
blocks = 1; blocks = 1;
stride = s->frame_size; stride = s->frame_size;
maxsize = 8192 * 32 * s->frame_size;
if (s->direction == PW_DIRECTION_OUTPUT) { if (s->direction == PW_DIRECTION_OUTPUT) {
maxsize = attr->tlength * s->frame_size; size = attr->minreq;
size = attr->minreq * s->frame_size;
} else { } else {
size = attr->fragsize; size = attr->fragsize;
maxsize = attr->fragsize * MAX_BUFFERS;
} }
buffers = SPA_CLAMP(maxsize / size, MIN_BUFFERS, MAX_BUFFERS); buffers = SPA_CLAMP(maxsize / size, MIN_BUFFERS, MAX_BUFFERS);
@ -1019,7 +1018,8 @@ static const struct spa_pod *get_buffers_param(struct stream *s,
param = spa_pod_builder_add_object(b, param = spa_pod_builder_add_object(b,
SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers, SPA_TYPE_OBJECT_ParamBuffers, SPA_PARAM_Buffers,
SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(buffers, MIN_BUFFERS, MAX_BUFFERS), SPA_PARAM_BUFFERS_buffers, SPA_POD_CHOICE_RANGE_Int(buffers,
MIN_BUFFERS, MAX_BUFFERS),
SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(blocks), SPA_PARAM_BUFFERS_blocks, SPA_POD_Int(blocks),
SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int( SPA_PARAM_BUFFERS_size, SPA_POD_CHOICE_RANGE_Int(
size, size, maxsize), size, size, maxsize),