]> code.delx.au - pulseaudio/commitdiff
echo-cancel: Fix apply_diff_time() to use correct sample spec
authorStefan Huber <s.huber@bct-electronic.com>
Tue, 4 Dec 2012 13:54:58 +0000 (14:54 +0100)
committerTanu Kaskinen <tanuk@iki.fi>
Wed, 19 Dec 2012 10:31:48 +0000 (12:31 +0200)
apply_diff_time() fails when dropping bytes from the playback stream
and the sample spec of sink and source differ as source's sample spec is
used. Fix this by using sink's sample spec.

Signed-off-by: Stefan Huber <s.huber@bct-electronic.com>
Acked-by: Peter Meerwald <p.meerwald@bct-electronic.com>
src/modules/echo-cancel/module-echo-cancel.c

index 8a9823b987e12dbd8d0a372c94ea817d7559c51b..26ac30b81bac18379688aa5f0a9ca25c26adb8cf 100644 (file)
@@ -660,12 +660,12 @@ static void apply_diff_time(struct userdata *u, int64_t diff_time) {
     int64_t diff;
 
     if (diff_time < 0) {
-        diff = pa_usec_to_bytes(-diff_time, &u->source_output->sample_spec);
+        diff = pa_usec_to_bytes(-diff_time, &u->sink_input->sample_spec);
 
         if (diff > 0) {
             /* add some extra safety samples to compensate for jitter in the
              * timings */
-            diff += 10 * pa_frame_size (&u->source_output->sample_spec);
+            diff += 10 * pa_frame_size (&u->sink_input->sample_spec);
 
             pa_log("Playback after capture (%lld), drop sink %lld", (long long) diff_time, (long long) diff);