The webrtc canceller requires that the set_stream_drift_samples() method be called before every call of ProcessStream(). We do kind of leak this into the generic bits of module-echo-cancel, but this should not be harmful in the general case either. Relatedly, we also require that this happen when there are no sink samples being sent, so we just drop the special-case check for whether the sink is running to do the drift compensation calculations. --- src/modules/echo-cancel/module-echo-cancel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/modules/echo-cancel/module-echo-cancel.c b/src/modules/echo-cancel/module-echo-cancel.c index 0a9f290..3ba5a46 100644 --- a/src/modules/echo-cancel/module-echo-cancel.c +++ b/src/modules/echo-cancel/module-echo-cancel.c @@ -736,9 +736,6 @@ static void do_push_drift_comp(struct userdata *u) { u->sink_rem = plen % u->sink_blocksize; u->source_rem = rlen % u->source_output_blocksize; - /* Now let the canceller work its drift compensation magic */ - u->ec->set_drift(u->ec, drift); - if (u->save_aec) { if (u->drift_file) fprintf(u->drift_file, "d %a\n", drift); @@ -778,6 +775,7 @@ static void do_push_drift_comp(struct userdata *u) { cchunk.memblock = pa_memblock_new(u->source->core->mempool, cchunk.length); cdata = pa_memblock_acquire(cchunk.memblock); + u->ec->set_drift(u->ec, drift); u->ec->record(u->ec, rdata, cdata); if (u->save_aec) { @@ -947,7 +945,7 @@ static void source_output_push_cb(pa_source_output *o, const pa_memchunk *chunk) } /* process and push out samples, do drift compensation only if the sink is actually running */ - if (u->ec->params.drift_compensation && u->sink->thread_info.state == PA_SINK_RUNNING) + if (u->ec->params.drift_compensation) do_push_drift_comp(u); else do_push(u); -- 2.9.3