From 697976f416f7e610e8de929a8eff8c3cb44e55a9 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Tue, 13 Aug 2019 18:42:21 +0200 Subject: [PATCH] audioconvert: only emit node_info once in add_listener --- spa/plugins/audioconvert/audioadapter.c | 10 +++++++++- spa/plugins/audioconvert/audioconvert.c | 10 +++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/spa/plugins/audioconvert/audioadapter.c b/spa/plugins/audioconvert/audioadapter.c index 6df4f5a14..06a7c0ef3 100644 --- a/spa/plugins/audioconvert/audioadapter.c +++ b/spa/plugins/audioconvert/audioadapter.c @@ -71,6 +71,7 @@ struct impl { struct spa_hook_list hooks; struct spa_callbacks callbacks; + unsigned int add_listener:1; unsigned int use_converter:1; unsigned int started:1; unsigned int driver:1; @@ -186,6 +187,9 @@ static int link_io(struct impl *this) static void emit_node_info(struct impl *this, bool full) { + if (this->add_listener) + return; + if (full) this->info.change_mask = this->info_all; @@ -446,7 +450,7 @@ static int impl_node_add_listener(void *object, spa_log_trace(this->log, NAME" %p: add listener %p", this, listener); spa_hook_list_isolate(&this->hooks, &save, listener, events, data); - emit_node_info(this, true); + this->add_listener = true; if (this->use_converter) { spa_zero(l); @@ -454,6 +458,10 @@ static int impl_node_add_listener(void *object, spa_hook_remove(&l); } + this->add_listener = false; + + emit_node_info(this, true); + spa_hook_list_join(&this->hooks, &save); return 0; diff --git a/spa/plugins/audioconvert/audioconvert.c b/spa/plugins/audioconvert/audioconvert.c index 2be32592c..693c35edf 100644 --- a/spa/plugins/audioconvert/audioconvert.c +++ b/spa/plugins/audioconvert/audioconvert.c @@ -106,6 +106,7 @@ struct impl { struct spa_hook listener[2]; unsigned int started:1; + unsigned int add_listener:1; }; #define IS_MONITOR_PORT(this,dir,port_id) (dir == SPA_DIRECTION_OUTPUT && port_id > 0 && \ @@ -113,6 +114,9 @@ struct impl { static void emit_node_info(struct impl *this, bool full) { + if (this->add_listener) + return; + if (full) this->info.change_mask = this->info_all; if (this->info.change_mask) { @@ -798,7 +802,7 @@ impl_node_add_listener(void *object, spa_log_trace(this->log, "%p: add listener %p", this, listener); - emit_node_info(this, true); + this->add_listener = true; spa_zero(l); spa_node_add_listener(this->fmt[SPA_DIRECTION_INPUT], @@ -815,6 +819,10 @@ impl_node_add_listener(void *object, spa_hook_remove(&l[2]); spa_hook_remove(&l[3]); + this->add_listener = false; + + emit_node_info(this, true); + spa_hook_list_join(&this->hooks, &save); return 0;