From c18c9fa378ffefe3e0bcc8902c4d621bbd13f662 Mon Sep 17 00:00:00 2001 From: Phillip Schichtel Date: Sat, 11 Jun 2022 00:35:41 +0200 Subject: [PATCH] Revert broken broken pulse-server commits This reverts commit 0d51f3b74e1efc2787e29f00e0ccc4b28b5da8a6 and 2c4d36e4d03f08734fcc41fd0d136981551d01a7. --- src/modules/module-protocol-pulse/pulse-server.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/src/modules/module-protocol-pulse/pulse-server.c b/src/modules/module-protocol-pulse/pulse-server.c index 7dead6055..3675aa619 100644 --- a/src/modules/module-protocol-pulse/pulse-server.c +++ b/src/modules/module-protocol-pulse/pulse-server.c @@ -87,9 +87,6 @@ #define DEFAULT_POSITION "[ FL FR ]" #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) @@ -1309,7 +1306,7 @@ do_process_done(struct spa_loop *loop, pw_log_warn("%p: [%s] underrun read:%u avail:%d", stream, client->name, index, avail); } else { - if ((uint32_t)avail > stream->attr.maxlength) { + if (avail > (int32_t)stream->attr.maxlength) { uint32_t skip = avail - stream->attr.fragsize; /* overrun, catch up to latest fragment and send it */ pw_log_warn("%p: [%s] overrun recover read:%u avail:%d max:%u skip:%u", @@ -1319,9 +1316,10 @@ do_process_done(struct spa_loop *loop, avail = stream->attr.fragsize; } - while ((uint32_t)avail >= stream->attr.fragsize) { - towrite = SPA_MIN(avail, MAX_FRAGSIZE); - towrite = SPA_ROUND_DOWN(towrite, stream->frame_size); + while (avail > 0) { + towrite = avail; + if (towrite > stream->attr.fragsize) + towrite = stream->attr.fragsize; msg = message_alloc(impl, stream->channel, towrite); if (msg == NULL) -- 2.36.1