echo-cancel: Fix apply_diff_time() to use correct sample spec

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>
This commit is contained in:
Stefan Huber 2012-12-04 14:54:58 +01:00 committed by Tanu Kaskinen
parent 4d65c9582d
commit 53f2964b40

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