From bf60614032c43bffb756ba38edbcdc97f2bbfcf2 Mon Sep 17 00:00:00 2001 From: George Kiagiadakis Date: Sun, 26 May 2019 12:36:20 +0300 Subject: [PATCH] improve debug statements a bit --- lib/wp/endpoint.c | 7 +++++++ lib/wp/factory.c | 6 ++++++ lib/wp/module.c | 4 ++++ modules/module-pipewire.c | 4 ---- modules/module-pw-alsa-udev.c | 7 +------ 5 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lib/wp/endpoint.c b/lib/wp/endpoint.c index 38e65110..b845ce3c 100644 --- a/lib/wp/endpoint.c +++ b/lib/wp/endpoint.c @@ -259,6 +259,10 @@ wp_endpoint_register (WpEndpoint * self, WpSessionManager * sm) g_return_if_fail (WP_IS_SESSION_MANAGER (sm)); priv = wp_endpoint_get_instance_private (self); + + g_info ("WpEndpoint:%p registering '%s' (%s)", self, priv->name, + priv->media_class); + g_weak_ref_set (&priv->sm, sm); wp_session_manager_add_endpoint (sm, self); } @@ -281,6 +285,9 @@ wp_endpoint_unregister (WpEndpoint * self) priv = wp_endpoint_get_instance_private (self); sm = g_weak_ref_get (&priv->sm); if (sm) { + g_info ("WpEndpoint:%p unregistering '%s' (%s)", self, priv->name, + priv->media_class); + g_weak_ref_set (&priv->sm, NULL); wp_session_manager_remove_endpoint (sm, self); } diff --git a/lib/wp/factory.c b/lib/wp/factory.c index 72921663..2d161f2b 100644 --- a/lib/wp/factory.c +++ b/lib/wp/factory.c @@ -30,6 +30,8 @@ wp_factory_finalize (GObject * obj) { WpFactory * self = WP_FACTORY (obj); + g_debug ("WpFactory:%p destroying factory: %s", self, self->name); + g_weak_ref_clear (&self->core); g_free (self->name); @@ -57,6 +59,8 @@ wp_factory_new (WpCore * core, const gchar * name, WpFactoryFunc func) f->name_quark = g_quark_from_string (f->name); f->create_object = func; + g_info ("WpFactory:%p new factory: %s", f, name); + if (!wp_core_register_global (core, f->name_quark, f, g_object_unref)) return NULL; @@ -84,6 +88,8 @@ wp_factory_get_core (WpFactory * self) gpointer wp_factory_create_object (WpFactory * self, GType type, GVariant * properties) { + g_debug ("WpFactory:%p (%s) create object of type %s", self, self->name, + g_type_name (type)); return self->create_object (self, type, properties); } diff --git a/lib/wp/module.c b/lib/wp/module.c index 3afea3dd..7e091e9b 100644 --- a/lib/wp/module.c +++ b/lib/wp/module.c @@ -36,6 +36,8 @@ wp_module_finalize (GObject * object) { WpModule *self = WP_MODULE (object); + g_debug ("WpModule:%p unloading module", self); + if (self->destroy) self->destroy (self->destroy_data); g_clear_pointer (&self->properties, g_variant_unref); @@ -112,6 +114,8 @@ wp_module_load (WpCore * core, const gchar * abi, module = g_object_new (WP_TYPE_MODULE, NULL); g_weak_ref_init (&module->core, core); + g_info ("WpModule:%p loading module %s (ABI: %s)", module, module_name, abi); + if (!g_strcmp0 (abi, "C")) { if (!wp_module_load_c (module, core, module_name, args, error)) return NULL; diff --git a/modules/module-pipewire.c b/modules/module-pipewire.c index fc0e13f3..759ba133 100644 --- a/modules/module-pipewire.c +++ b/modules/module-pipewire.c @@ -143,8 +143,6 @@ module_destroy (gpointer d) { struct module_data *data = d; - g_debug ("module-pipewire destroy"); - pw_remote_destroy (data->remote); pw_core_destroy (data->core); g_slice_free (struct module_data, data); @@ -156,8 +154,6 @@ wireplumber__module_init (WpModule * module, WpCore * core, GVariant * args) GSource *source; struct module_data *data; - g_debug ("module-pipewire init"); - pw_init (NULL, NULL); data = g_slice_new0 (struct module_data); diff --git a/modules/module-pw-alsa-udev.c b/modules/module-pw-alsa-udev.c index 6fcaf162..45db6ed2 100644 --- a/modules/module-pw-alsa-udev.c +++ b/modules/module-pw-alsa-udev.c @@ -14,8 +14,6 @@ #include #include -#define NAME "module-pw-alsa-udev" - struct impl { WpCore *wp_core; @@ -39,7 +37,7 @@ handle_node(struct impl *impl, uint32_t id, uint32_t parent_id, /* Make sure the node has properties */ if (!props) { - g_warning(NAME" %p: node has no properties, skipping...", impl); + g_warning("node has no properties, skipping..."); return; } @@ -127,9 +125,6 @@ static void module_destroy (gpointer data) { struct impl *impl = data; - - g_debug ("module-pipewire destroy"); - g_slice_free (struct impl, impl); }