[pulseaudio-discuss] [PATCH 01/13] loopback: Fix the obviously-wrong "buffer+=buffer" logic

Georg Chini georg at chini.tk
Wed Feb 25 10:43:13 PST 2015


Avoid double-counting the calculated buffer latency in the else-branch.
This has already been submitted as a seperate patch but is included here
for completeness.
---
 src/modules/module-loopback.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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.1.4



More information about the pulseaudio-discuss mailing list