[pulseaudio-commits] src/modules

Tanu Kaskinen tanuk at kemper.freedesktop.org
Sun Sep 13 09:36:19 PDT 2015


 src/modules/module-loopback.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

New commits:
commit c7310f8e379915b42579adb3f5288f5bcb09ba8f
Author: Alexander E. Patrakov <patrakov at gmail.com>
Date:   Sat Sep 12 19:27:56 2015 +0500

    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.

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);
 



More information about the pulseaudio-commits mailing list