mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
pulse-server: always send at least fragsize data
Make sure to never send less than the negotiated fragsize to a client. Also make sure we don't send too much data in one go. This is more in line with what pulseaudio does. Fixes capture from multiple tabs in chrome. Fixes #2418
This commit is contained in:
parent
1245309a7b
commit
0d51f3b74e
1 changed files with 6 additions and 5 deletions
|
|
@ -87,6 +87,9 @@
|
|||
#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)
|
||||
|
||||
|
|
@ -1284,7 +1287,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 (avail > (int32_t)stream->attr.maxlength) {
|
||||
if ((uint32_t)avail > 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",
|
||||
|
|
@ -1294,10 +1297,8 @@ do_process_done(struct spa_loop *loop,
|
|||
avail = stream->attr.fragsize;
|
||||
}
|
||||
|
||||
while (avail > 0) {
|
||||
towrite = avail;
|
||||
if (towrite > stream->attr.fragsize)
|
||||
towrite = stream->attr.fragsize;
|
||||
while ((uint32_t)avail >= stream->attr.fragsize) {
|
||||
towrite = SPA_MIN(avail, MAX_FRAGSIZE);
|
||||
|
||||
msg = message_alloc(impl, stream->channel, towrite);
|
||||
if (msg == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue