From 4c9ac08310e68c23a6e6ca15ae2d6a61b7c79c89 Mon Sep 17 00:00:00 2001 From: Huang-Huang Bao Date: Mon, 14 Jun 2021 20:06:37 +0800 Subject: [PATCH] bluez5: always emit node object info for dynamic node impl_add_listener() could be called more than one time, ensure that we always emit node info so that session manager(bluez-monitor) can receives it. Fixes #1308 --- spa/plugins/bluez5/bluez5-device.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/spa/plugins/bluez5/bluez5-device.c b/spa/plugins/bluez5/bluez5-device.c index 113a7515d..318383c95 100644 --- a/spa/plugins/bluez5/bluez5-device.c +++ b/spa/plugins/bluez5/bluez5-device.c @@ -506,8 +506,14 @@ static const struct spa_bt_transport_events dynamic_node_transport_events = { static void emit_dynamic_node(struct dynamic_node *this, struct impl *impl, struct spa_bt_transport *t, uint32_t id, const char *factory_name) { - if (this->transport != NULL) - return; + spa_log_debug(impl->log, NAME": dynamic node, transport: %p->%p id: %08x->%08x", + this->transport, t, this->id, id); + + if (this->transport) { + /* Session manager don't really handles transport ptr changing. */ + spa_assert(this->transport == t); + spa_hook_remove(&this->transport_listener); + } this->impl = impl; this->transport = t;