From: Arun Raghavan Date: Wed, 5 Oct 2011 06:59:10 +0000 (+0530) Subject: echo-cancel: Skip processing till there's enough data X-Git-Tag: v1.99.1~256 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=17011fcf70f723648c1c76d5d80fe98591e5f8a4;p=platform%2Fupstream%2Fpulseaudio.git echo-cancel: Skip processing till there's enough data This makes sure that we only perform any processing (resync or actual cancellation) after the source provides enough data to actuall run the canceller. --- diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 8d77a3b..77c8ff8 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -665,15 +665,19 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) while (pa_asyncmsgq_process_one(u->asyncmsgq) > 0) ; - if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) { - do_resync(u); - } - pa_memblockq_push_align(u->source_memblockq, chunk); rlen = pa_memblockq_get_length(u->source_memblockq); plen = pa_memblockq_get_length(u->sink_memblockq); + /* Let's not do anything else till we have enough data to process */ + if (rlen < u->blocksize) + return; + + if (pa_atomic_cmpxchg (&u->request_resync, 1, 0)) { + do_resync(u); + } + while (rlen >= u->blocksize) { pa_memchunk rchunk, pchunk;