diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 77c059b78..f8fec8fae 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -756,6 +756,7 @@ static int impl_node_process(struct spa_node *node) { struct impl *this; int r, i, res = SPA_STATUS_OK; + int ready; spa_return_val_if_fail(node != NULL, -EINVAL); @@ -763,22 +764,25 @@ static int impl_node_process(struct spa_node *node) spa_log_trace(this->log, NAME " %p: process %d", this, this->n_links); - for (i = 0; i < this->n_nodes; i++) { - r = spa_node_process(this->nodes[i]); - spa_log_trace(this->log, NAME " %p: process %d %d", this, i, r); + while (1) { + res = SPA_STATUS_OK; + ready = 0; + for (i = 0; i < this->n_nodes; i++) { + r = spa_node_process(this->nodes[i]); + spa_log_trace(this->log, NAME " %p: process %d %d", this, i, r); - if (i == 0) - res |= r & SPA_STATUS_NEED_BUFFER; - if (i == this->n_nodes-1) - res |= r & SPA_STATUS_HAVE_BUFFER; + if (r & SPA_STATUS_HAVE_BUFFER) + ready++; - if (!SPA_FLAG_CHECK(r, SPA_STATUS_HAVE_BUFFER)) { - if (SPA_FLAG_CHECK(r, SPA_STATUS_NEED_BUFFER) && i == 0) - break; - res = SPA_STATUS_OK; - i = -1; - continue; + if (i == 0) + res |= r & SPA_STATUS_NEED_BUFFER; + if (i == this->n_nodes-1) + res |= r & SPA_STATUS_HAVE_BUFFER; } + if (res & SPA_STATUS_HAVE_BUFFER) + break; + if (ready == 0) + break; } spa_log_trace(this->log, NAME " %p: process result: %d", this, res); diff --git a/spa/plugins/audioconvert/channelmix.c b/spa/plugins/audioconvert/channelmix.c index f0d087e25..bdd5345e9 100644 --- a/spa/plugins/audioconvert/channelmix.c +++ b/spa/plugins/audioconvert/channelmix.c @@ -777,7 +777,7 @@ static int impl_node_process(struct spa_node *node) spa_log_trace(this->log, NAME " %p: status %d %d", this, inio->status, outio->status); if (outio->status == SPA_STATUS_HAVE_BUFFER) - return outio->status; + goto done; if (inio->status != SPA_STATUS_HAVE_BUFFER) return SPA_STATUS_NEED_BUFFER; @@ -824,6 +824,7 @@ static int impl_node_process(struct spa_node *node) inio->status = SPA_STATUS_NEED_BUFFER; + done: return SPA_STATUS_HAVE_BUFFER | SPA_STATUS_NEED_BUFFER; } diff --git a/spa/plugins/audioconvert/fmtconvert.c b/spa/plugins/audioconvert/fmtconvert.c index 73fa93b7a..6bc031ab4 100644 --- a/spa/plugins/audioconvert/fmtconvert.c +++ b/spa/plugins/audioconvert/fmtconvert.c @@ -78,7 +78,10 @@ struct port { struct spa_io_buffers *io; struct spa_io_control_range *ctrl; + struct spa_port_info info; + struct spa_dict info_props; + struct spa_dict_item info_props_items[2]; bool have_format; struct spa_audio_info format; @@ -367,8 +370,14 @@ static int init_port(struct impl *this, enum spa_direction direction, uint32_t p spa_list_init(&port->queue); port->info.flags = flags; + + port->info_props_items[0] = SPA_DICT_ITEM_INIT("port.dsp", "32 bit float mono audio"); + port->info_props = SPA_DICT_INIT(port->info_props_items, 1); + port->info.props = &port->info_props; + this->n_ports[direction]++; port->have_format = false; + return 0; }