From d67d0123625297e0dd9a25081ececed009b6d168 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 17 Dec 2019 15:11:31 +0100 Subject: [PATCH] audioadapter: loop until we have data Keep caling the slave processing function until we have data from the converter or until no process can be made. --- spa/plugins/audioconvert/audioadapter.c | 13 ++++++++++--- src/pipewire/stream.c | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 07c0ea041..696d5f3bb 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -875,12 +875,19 @@ static int impl_node_process(void *object) status = spa_node_process(this->convert); } +again: status = spa_node_process(this->slave); - if (this->direction == SPA_DIRECTION_OUTPUT && !this->master) { - if (this->use_converter) - status = spa_node_process(this->convert); + if (this->direction == SPA_DIRECTION_OUTPUT && + !this->master && this->use_converter) { + status = spa_node_process(this->convert); + + if (!(status & SPA_STATUS_HAVE_DATA) && + (status & SPA_STATUS_NEED_DATA)) + goto again; } + spa_log_trace_fp(this->log, "%p: process status:%d", this, status); + this->master = false; return status; diff --git a/src/pipewire/stream.c b/src/pipewire/stream.c index 0c8ea3051..da3e74b32 100644 --- a/src/pipewire/stream.c +++ b/src/pipewire/stream.c @@ -639,7 +639,7 @@ static int impl_port_use_buffers(void *object, } else size = buf_size; } - pw_log_debug(NAME" %p: got buffer %d %d datas, mapped size %d", stream, i, + pw_log_debug(NAME" %p: got buffer id:%d datas:%d, mapped size %d", stream, i, buffers[i]->n_datas, size); }