LADI
/
spa
1
Fork 0

pulse-server: adjust_latency should update the fragsize

Rename MAX_FRAGSIZE to MAX_BLOCK because it does not really limit the
fragsize, just the amount of data we can send in one block.

See #2711
This commit is contained in:
Wim Taymans 2022-09-20 13:24:30 +02:00
parent 3faca67ffe
commit 0ce95e69fd
1 changed files with 6 additions and 3 deletions

View File

@ -89,7 +89,7 @@
#define MAX_FORMATS 32
/* The max amount of data we send in one block when capturing. In PulseAudio this
* size is derived from the mempool PA_MEMPOOL_SLOT_SIZE */
#define MAX_FRAGSIZE (64*1024)
#define MAX_BLOCK (64*1024)
#define TEMPORARY_MOVE_TIMEOUT (SPA_NSEC_PER_SEC)
@ -681,13 +681,16 @@ static uint64_t fix_record_buffer_attr(struct stream *s, struct buffer_attr *att
attr->tlength = attr->minreq = attr->prebuf = 0;
/* make sure can queue at least to fragsize without overruns */
/* make sure we can queue at least to fragsize without overruns */
if (attr->maxlength < attr->fragsize * 4)
attr->maxlength = attr->fragsize * 4;
/* pulseaudio configures half the fragsize as latency in the source. */
latency = attr->fragsize / 2;
if (s->adjust_latency)
attr->fragsize = SPA_ROUND_UP(latency, frame_size);
lat->num = latency / frame_size;
lat->denom = rate;
clamp_latency(s, lat);
@ -1342,7 +1345,7 @@ do_process_done(struct spa_loop *loop,
pw_log_trace("avail:%d index:%u", avail, index);
while ((uint32_t)avail >= stream->attr.fragsize) {
towrite = SPA_MIN(avail, MAX_FRAGSIZE);
towrite = SPA_MIN(avail, MAX_BLOCK);
towrite = SPA_ROUND_DOWN(towrite, stream->frame_size);
msg = message_alloc(impl, stream->channel, towrite);