From bb558b7d953a8e5a52ed32ee491e440fd8e1c2e8 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 18 Nov 2022 13:21:14 +0100 Subject: [PATCH] audioconvert: don't overwrite port Make a new variable to iterate the other ports so that we can use the original port to emit notifications. Fixes Latency and other params set on DSP ports. --- spa/plugins/audioconvert/audioadapter.c | 22 ++++++++++++---------- spa/plugins/audioconvert/audioconvert.c | 10 +++++----- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 505768ec2..14bf3e6d9 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -897,10 +897,11 @@ static void convert_node_info(void *data, const struct spa_node_info *info) (this->params[idx].flags & SPA_PARAM_INFO_SERIAL) | (info->params[i].flags & SPA_PARAM_INFO_READWRITE); - if (!this->add_listener) { - this->params[idx].user++; - spa_log_debug(this->log, "param %d changed", info->params[i].id); - } + if (this->add_listener) + continue; + + this->params[idx].user++; + spa_log_debug(this->log, "param %d changed", info->params[i].id); } } emit_node_info(this, false); @@ -1005,10 +1006,11 @@ static void follower_info(void *data, const struct spa_node_info *info) (this->params[idx].flags & SPA_PARAM_INFO_SERIAL) | (info->params[i].flags & SPA_PARAM_INFO_READWRITE); - if (!this->add_listener) { - this->params[idx].user++; - spa_log_debug(this->log, "param %d changed", info->params[i].id); - } + if (this->add_listener) + continue; + + this->params[idx].user++; + spa_log_debug(this->log, "param %d changed", info->params[i].id); } } emit_node_info(this, false); @@ -1085,17 +1087,17 @@ static void follower_port_info(void *data, default: continue; } + if (!this->add_listener && this->follower_params_flags[idx] == info->params[i].flags) continue; + this->info.change_mask |= SPA_NODE_CHANGE_MASK_PARAMS; this->follower_params_flags[idx] = info->params[i].flags; this->params[idx].flags = (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; diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 2e18dbfa9..8e5237bdb 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -1869,7 +1869,7 @@ static int port_set_latency(void *object, const struct spa_pod *latency) { struct impl *this = object; - struct port *port; + struct port *port, *oport; enum spa_direction other = SPA_DIRECTION_REVERSE(direction); uint32_t i; @@ -1891,10 +1891,10 @@ static int port_set_latency(void *object, } for (i = 0; i < this->dir[other].n_ports; i++) { - port = GET_PORT(this, other, i); - port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; - port->params[IDX_Latency].user++; - emit_port_info(this, port, false); + oport = GET_PORT(this, other, i); + oport->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; + oport->params[IDX_Latency].user++; + emit_port_info(this, oport, false); } port->info.change_mask |= SPA_PORT_CHANGE_MASK_PARAMS; port->params[IDX_Latency].user++;