pulse-server: Don't send more than fragsize chunks

Send exactly fragsize chunks when capturing.

See #2418 and #2434
This commit is contained in:
Wim Taymans 2022-06-14 11:18:52 +02:00
parent d3597ed149
commit 68bafcf166

View file

@ -87,9 +87,6 @@
#define DEFAULT_POSITION "[ FL FR ]" #define DEFAULT_POSITION "[ FL FR ]"
#define MAX_FORMATS 32 #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 TEMPORARY_MOVE_TIMEOUT (SPA_NSEC_PER_SEC) #define TEMPORARY_MOVE_TIMEOUT (SPA_NSEC_PER_SEC)
@ -1326,8 +1323,7 @@ do_process_done(struct spa_loop *loop,
} }
while ((uint32_t)avail >= stream->attr.fragsize) { while ((uint32_t)avail >= stream->attr.fragsize) {
towrite = SPA_MIN(avail, MAX_FRAGSIZE); towrite = SPA_MIN((uint32_t)avail, stream->attr.fragsize);
towrite = SPA_ROUND_DOWN(towrite, stream->frame_size);
msg = message_alloc(impl, stream->channel, towrite); msg = message_alloc(impl, stream->channel, towrite);
if (msg == NULL) if (msg == NULL)