diff --git a/src/modules/module-profiler.c b/src/modules/module-profiler.c index f04e75f12..fa4910f73 100644 --- a/src/modules/module-profiler.c +++ b/src/modules/module-profiler.c @@ -379,6 +379,10 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) struct pw_properties *props; struct impl *impl; struct pw_loop *main_loop = pw_context_get_main_loop(context); + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + NULL + }; PW_LOG_TOPIC_INIT(mod_topic); @@ -409,9 +413,14 @@ int pipewire__module_init(struct pw_impl_module *module, const char *args) free(impl); return -errno; } + pw_properties_setf(impl->properties, PW_KEY_OBJECT_ID, "%d", impl->global->id); + pw_properties_setf(impl->properties, PW_KEY_OBJECT_SERIAL, "%"PRIu64, + pw_global_get_serial(impl->global)); impl->flush_timeout = pw_loop_add_timer(main_loop, flush_timeout, impl); + pw_global_update_keys(impl->global, &impl->properties->dict, keys); + pw_impl_module_add_listener(module, &impl->module_listener, &module_events, impl); pw_impl_module_update_properties(module, &SPA_DICT_INIT_ARRAY(module_props)); diff --git a/src/pipewire/impl-module.c b/src/pipewire/impl-module.c index 4e5f1894f..aab6f7029 100644 --- a/src/pipewire/impl-module.c +++ b/src/pipewire/impl-module.c @@ -171,6 +171,11 @@ pw_context_load_module(struct pw_context *context, const char *state = NULL, *p; size_t len; char path_part[PATH_MAX]; + static const char * const keys[] = { + PW_KEY_OBJECT_SERIAL, + PW_KEY_MODULE_NAME, + NULL + }; module_dir = getenv("PIPEWIRE_MODULE_DIR"); if (module_dir == NULL) { @@ -234,9 +239,7 @@ pw_context_load_module(struct pw_context *context, this->global = pw_global_new(context, PW_TYPE_INTERFACE_Module, PW_VERSION_MODULE, - pw_properties_new( - PW_KEY_MODULE_NAME, name, - NULL), + NULL, global_bind, this); @@ -251,6 +254,8 @@ pw_context_load_module(struct pw_context *context, pw_global_get_serial(this->global)); this->info.props = &this->properties->dict; + pw_global_update_keys(this->global, &this->properties->dict, keys); + pw_impl_module_emit_initialized(this); pw_global_add_listener(this->global, &this->global_listener, &global_events, this);