summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander E. Patrakov <patrakov@gmail.com>2015-09-12 19:27:56 +0500
committerTanu Kaskinen <tanuk@iki.fi>2015-09-13 19:24:10 +0300
commitc7310f8e379915b42579adb3f5288f5bcb09ba8f (patch)
tree452bd0049205c21c42453c034b437cd1348e5c81
parent11d22f97cfc76e4c49e34e262eee3e1a8a91cc0e (diff)
loopback: Fix the obviously-wrong "buffer+=buffer" logic
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.
-rw-r--r--src/modules/module-loopback.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/module-loopback.c b/src/modules/module-loopback.c
index 3b0d68d20..0af393702 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);