From 84856229235c3267a73b5ca1b1f7456e0a9a7a4e Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 31 May 2021 15:53:34 +0200 Subject: [PATCH] echo-cancel: reuse buffer on error Queue the dequeued buffers when there is an error so that we can recover. --- src/modules/module-echo-cancel.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/modules/module-echo-cancel.c b/src/modules/module-echo-cancel.c index 8ee36d853..c4c735e00 100644 --- a/src/modules/module-echo-cancel.c +++ b/src/modules/module-echo-cancel.c @@ -147,7 +147,7 @@ static void process(struct impl *impl) pw_log_warn("out of playback buffers: %m"); if (cin == NULL || cout == NULL || pin == NULL || pout == NULL) - return; + goto done; for (i = 0; i < impl->info.channels; i++) { /* captured samples, with echo from sink */ @@ -178,10 +178,15 @@ static void process(struct impl *impl) } echo_cancel_run(impl->aec_info, impl->aec, rec, play, out, size / sizeof(float)); - pw_stream_queue_buffer(impl->capture, cin); - pw_stream_queue_buffer(impl->source, cout); - pw_stream_queue_buffer(impl->sink, pin); - pw_stream_queue_buffer(impl->playback, pout); +done: + if (cin != NULL) + pw_stream_queue_buffer(impl->capture, cin); + if (cout != NULL) + pw_stream_queue_buffer(impl->source, cout); + if (pin != NULL) + pw_stream_queue_buffer(impl->sink, pin); + if (pout != NULL) + pw_stream_queue_buffer(impl->playback, pout); impl->sink_ready = false; impl->capture_ready = false;