From 97473c8e8b475aa87791cdba9a5cbd2a1f7ea6bb Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 10 May 2018 11:28:59 +0200 Subject: [PATCH] audioconvert: fix scheduling --- spa/plugins/audioconvert/audioconvert.c | 13 +++++++++---- spa/plugins/audioconvert/channelmix.c | 2 +- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index de70b0601..ebe0ad738 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -808,11 +808,16 @@ static int impl_node_process(struct spa_node *node) spa_log_trace(this->log, NAME " %p: process %d", this, this->n_links); for (i = 1; i < this->n_links; i++) { - res = spa_node_process(this->links[i].out_node); - if (!SPA_FLAG_CHECK(res, SPA_STATUS_HAVE_BUFFER)) { - if (SPA_FLAG_CHECK(res, SPA_STATUS_NEED_BUFFER) && i == 1) + int r = spa_node_process(this->links[i].out_node); + if (i == 1) + res |= r & SPA_STATUS_NEED_BUFFER; + if (i == this->n_links - 1) + res |= r & SPA_STATUS_HAVE_BUFFER; + + if (!SPA_FLAG_CHECK(r, SPA_STATUS_HAVE_BUFFER)) { + if (SPA_FLAG_CHECK(r, SPA_STATUS_NEED_BUFFER) && i == 1) break; - i = 0; + i = res = SPA_STATUS_OK; continue; } } diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index ff9d61b57..832b3993a 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -824,7 +824,7 @@ static int impl_node_process(struct spa_node *node) inio->status = SPA_STATUS_NEED_BUFFER; - return outio->status; + return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER; } static const struct spa_node impl_node = {