[pulseaudio-discuss] [PATCH] echo-cancel: Fix send/recv_counter in calc_diff()

Peter Meerwald pmeerw at pmeerw.net
Mon Apr 22 06:36:12 PDT 2013


From: Peter Meerwald <p.meerwald at bct-electronic.com>

send_counter/recv_counter relate to the bytes (play stream) passed
through the queue, hence the same sample spec must be used

Signed-off-by: Peter Meerwald <p.meerwald at bct-electronic.com>
Acked-by: Stefan Huber <shuber at sthu.org>
---
 src/modules/echo-cancel/module-echo-cancel.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c
index 53c81ff..9f7b5f9 100644
--- a/src/modules/echo-cancel/module-echo-cancel.c
+++ b/src/modules/echo-cancel/module-echo-cancel.c
@@ -334,8 +334,8 @@ static int64_t calc_diff(struct userdata *u, struct snapshot *snapshot) {
     buffer_latency += source_delay + sink_delay;
 
     /* add the latency difference due to samples not yet transferred */
-    send_counter = pa_bytes_to_usec(snapshot->send_counter, &u->sink_input->sample_spec);
-    recv_counter = pa_bytes_to_usec(snapshot->recv_counter, &u->source_output->sample_spec);
+    send_counter = pa_bytes_to_usec(snapshot->send_counter, &u->sink->sample_spec);
+    recv_counter = pa_bytes_to_usec(snapshot->recv_counter, &u->sink->sample_spec);
     if (recv_counter <= send_counter)
         buffer_latency += (int64_t) (send_counter - recv_counter);
     else
-- 
1.7.9.5



More information about the pulseaudio-discuss mailing list