[pulseaudio-discuss] [PATCH RESEND] loopback: Fix the obviously-wrong "buffer+=buffer" logic
Alexander E. Patrakov
patrakov at gmail.com
Sat Sep 12 07:27:56 PDT 2015
Originally pointed out by Georg Chini.
Calculating buffer = buffer + (send_counter - recv_counter)
in one branch and buffer = 2 * buffer - (recv_counter - send_counter)
looks very obviously wrong. In other words, before the patch, the
contribution from the previous lines was double-counted.
---
src/modules/module-loopback.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
This is a resend of
http://article.gmane.org/gmane.comp.audio.pulseaudio.general/22951 and
http://article.gmane.org/gmane.comp.audio.pulseaudio.general/22913
No Signed-off-by line, because the original patch by Georg Chini did
not have one.
The equivalent fix has been already applied to module-echo-cancel in commit
7c223a6565551cb18ef9db8930b0ce4eced7336c
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 3b0d68d..0af3937 100644
--- a/src/modules/module-loopback.c
+++ b/src/modules/module-loopback.c
@@ -186,7 +186,7 @@ static void adjust_rates(struct userdata *u) {
if (u->latency_snapshot.recv_counter <= u->latency_snapshot.send_counter)
buffer += (size_t) (u->latency_snapshot.send_counter - u->latency_snapshot.recv_counter);
else
- buffer += PA_CLIP_SUB(buffer, (size_t) (u->latency_snapshot.recv_counter - u->latency_snapshot.send_counter));
+ buffer = PA_CLIP_SUB(buffer, (size_t) (u->latency_snapshot.recv_counter - u->latency_snapshot.send_counter));
buffer_latency = pa_bytes_to_usec(buffer, &u->sink_input->sample_spec);
--
2.2.1
More information about the pulseaudio-discuss
mailing list