pipewire/0007-alsa-never-queue-buffers-when-rate-matching.patch
2021-03-25 16:02:52 +01:00

42 lines
1.3 KiB
Diff

From aaffc0947a8144b6cfaa5ccc076bc8a7b64fb755 Mon Sep 17 00:00:00 2001
From: Wim Taymans <wtaymans@redhat.com>
Date: Wed, 24 Mar 2021 11:48:32 +0100
Subject: [PATCH 07/10] alsa: never queue buffers when rate matching
When we are following the resampler requested size in capture, never
keep queued buffers around or we might get out of sync with the
requested size and cause cracks and pops in the resampler.
See #805
---
spa/plugins/alsa/alsa-pcm.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c
index 911f12ba2..00d554070 100644
--- a/spa/plugins/alsa/alsa-pcm.c
+++ b/spa/plugins/alsa/alsa-pcm.c
@@ -1147,6 +1147,9 @@ push_frames(struct state *state,
snd_pcm_readi(state->hndl, bufs[0], total_frames);
}
}
+ spa_log_trace_fp(state->log, NAME" %p: wrote %ld frames into buffer %d",
+ state, total_frames, b->id);
+
spa_list_append(&state->ready, &b->link);
}
return total_frames;
@@ -1307,7 +1310,8 @@ static int handle_capture(struct state *state, uint64_t nsec,
return 0;
io = state->io;
- if (io != NULL && io->status != SPA_STATUS_HAVE_DATA) {
+ if (io != NULL &&
+ (io->status != SPA_STATUS_HAVE_DATA || state->rate_match != NULL)) {
struct buffer *b;
if (io->buffer_id < state->n_buffers)
--
2.26.3