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.
This commit is contained in:
Arun Raghavan 2011-10-05 12:29:10 +05:30
parent cee6011572
commit 17011fcf70

View file

@ -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) 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); pa_memblockq_push_align(u->source_memblockq, chunk);
rlen = pa_memblockq_get_length(u->source_memblockq); rlen = pa_memblockq_get_length(u->source_memblockq);
plen = pa_memblockq_get_length(u->sink_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) { while (rlen >= u->blocksize) {
pa_memchunk rchunk, pchunk; pa_memchunk rchunk, pchunk;