From 43d02410e65624d931d90c06d5a17694225a2c81 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 18 Nov 2022 09:31:43 +0100 Subject: [PATCH] audioconvert: don't handle params when just enumerating When we are simply enumerating the params, just collect the info but don't act on them, like clearing the format or recalculating the latency. This avoids some useless work when enumerating params. Use the more complete configure_format function to clear the format and buffers when the EnumFormat param changed. --- spa/plugins/audioconvert/audioadapter.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 8f66dec76..505768ec2 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -1094,22 +1094,23 @@ static void follower_port_info(void *data, (this->params[idx].flags & SPA_PARAM_INFO_SERIAL) | (info->params[i].flags & SPA_PARAM_INFO_READWRITE); + this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS; + + if (this->add_listener) + continue; + if (idx == IDX_Latency) { res = recalc_latency(this, direction, port_id); spa_log_debug(this->log, "latency: %d (%s)", res, spa_strerror(res)); } if (idx == IDX_EnumFormat) { - this->have_format = false; - this->n_buffers = 0; spa_log_debug(this->log, "new formats"); + configure_format(this, 0, NULL); } - this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS; - if (!this->add_listener) { - this->params[idx].user++; - spa_log_debug(this->log, "param %d changed", info->params[i].id); - } + this->params[idx].user++; + spa_log_debug(this->log, "param %d changed", info->params[i].id); } } emit_node_info(this, false);