mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	improve debug
This commit is contained in:
		
							parent
							
								
									4048a730e0
								
							
						
					
					
						commit
						7614604250
					
				
					 5 changed files with 28 additions and 15 deletions
				
			
		| 
						 | 
					@ -142,7 +142,9 @@ void pw_device_destroy(struct pw_device *device)
 | 
				
			||||||
		spa_hook_remove(&device->global_listener);
 | 
							spa_hook_remove(&device->global_listener);
 | 
				
			||||||
		pw_global_destroy(device->global);
 | 
							pw_global_destroy(device->global);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: free", device);
 | 
				
			||||||
	pw_device_emit_free(device);
 | 
						pw_device_emit_free(device);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	free((char *)device->info.name);
 | 
						free((char *)device->info.name);
 | 
				
			||||||
	pw_properties_free(device->properties);
 | 
						pw_properties_free(device->properties);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,8 @@
 | 
				
			||||||
#include "pipewire/interfaces.h"
 | 
					#include "pipewire/interfaces.h"
 | 
				
			||||||
#include "pipewire/keys.h"
 | 
					#include "pipewire/keys.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "factory"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#define pw_factory_resource_info(r,...) pw_resource_call(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__)
 | 
					#define pw_factory_resource_info(r,...) pw_resource_call(r,struct pw_factory_proxy_events,info,0,__VA_ARGS__)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
struct resource_data {
 | 
					struct resource_data {
 | 
				
			||||||
| 
						 | 
					@ -64,7 +66,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core,
 | 
				
			||||||
	if (user_data_size > 0)
 | 
						if (user_data_size > 0)
 | 
				
			||||||
		this->user_data = SPA_MEMBER(this, sizeof(*this), void);
 | 
							this->user_data = SPA_MEMBER(this, sizeof(*this), void);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("factory %p: new %s", this, name);
 | 
						pw_log_debug(NAME" %p: new %s", this, name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return this;
 | 
						return this;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -72,7 +74,7 @@ struct pw_factory *pw_factory_new(struct pw_core *core,
 | 
				
			||||||
SPA_EXPORT
 | 
					SPA_EXPORT
 | 
				
			||||||
void pw_factory_destroy(struct pw_factory *factory)
 | 
					void pw_factory_destroy(struct pw_factory *factory)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	pw_log_debug("factory %p: destroy", factory);
 | 
						pw_log_debug(NAME" %p: destroy", factory);
 | 
				
			||||||
	pw_factory_emit_destroy(factory);
 | 
						pw_factory_emit_destroy(factory);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (factory->registered)
 | 
						if (factory->registered)
 | 
				
			||||||
| 
						 | 
					@ -82,6 +84,8 @@ void pw_factory_destroy(struct pw_factory *factory)
 | 
				
			||||||
		spa_hook_remove(&factory->global_listener);
 | 
							spa_hook_remove(&factory->global_listener);
 | 
				
			||||||
		pw_global_destroy(factory->global);
 | 
							pw_global_destroy(factory->global);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: free", factory);
 | 
				
			||||||
	free((char *)factory->info.name);
 | 
						free((char *)factory->info.name);
 | 
				
			||||||
	if (factory->properties)
 | 
						if (factory->properties)
 | 
				
			||||||
		pw_properties_free(factory->properties);
 | 
							pw_properties_free(factory->properties);
 | 
				
			||||||
| 
						 | 
					@ -116,7 +120,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
	data = pw_resource_get_user_data(resource);
 | 
						data = pw_resource_get_user_data(resource);
 | 
				
			||||||
	pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
 | 
						pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("factory %p: bound to %d", this, resource->id);
 | 
						pw_log_debug(NAME" %p: bound to %d", this, resource->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&global->resource_list, &resource->link);
 | 
						spa_list_append(&global->resource_list, &resource->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -127,7 +131,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error_resource:
 | 
					error_resource:
 | 
				
			||||||
	pw_log_error("can't create factory resource: %m");
 | 
						pw_log_error(NAME" %p: can't create factory resource: %m", this);
 | 
				
			||||||
	return -errno;
 | 
						return -errno;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -40,6 +40,8 @@
 | 
				
			||||||
#include "pipewire/module.h"
 | 
					#include "pipewire/module.h"
 | 
				
			||||||
#include "pipewire/type.h"
 | 
					#include "pipewire/type.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "module"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \cond */
 | 
					/** \cond */
 | 
				
			||||||
struct impl {
 | 
					struct impl {
 | 
				
			||||||
	struct pw_module this;
 | 
						struct pw_module this;
 | 
				
			||||||
| 
						 | 
					@ -134,7 +136,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
	data = pw_resource_get_user_data(resource);
 | 
						data = pw_resource_get_user_data(resource);
 | 
				
			||||||
	pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
 | 
						pw_resource_add_listener(resource, &data->resource_listener, &resource_events, resource);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("module %p: bound to %d", this, resource->id);
 | 
						pw_log_debug(NAME" %p: bound to %d", this, resource->id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&global->resource_list, &resource->link);
 | 
						spa_list_append(&global->resource_list, &resource->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +147,7 @@ global_bind(void *_data, struct pw_client *client, uint32_t permissions,
 | 
				
			||||||
	return 0;
 | 
						return 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
error_resource:
 | 
					error_resource:
 | 
				
			||||||
	pw_log_error("can't create module resource: %m");
 | 
						pw_log_error(NAME" %p: can't create module resource: %m", this);
 | 
				
			||||||
	return -errno;
 | 
						return -errno;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -268,7 +270,7 @@ pw_module_load(struct pw_core *core,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_global_register(this->global, owner, parent);
 | 
						pw_global_register(this->global, owner, parent);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("loaded module: %s", this->info.name);
 | 
						pw_log_debug(NAME" %p: loaded module: %s", this, this->info.name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return this;
 | 
						return this;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -320,7 +322,7 @@ void pw_module_destroy(struct pw_module *module)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
 | 
						struct impl *impl = SPA_CONTAINER_OF(module, struct impl, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("module %p: destroy", module);
 | 
						pw_log_debug(NAME" %p: destroy", module);
 | 
				
			||||||
	pw_module_emit_destroy(module);
 | 
						pw_module_emit_destroy(module);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (module->global) {
 | 
						if (module->global) {
 | 
				
			||||||
| 
						 | 
					@ -329,6 +331,7 @@ void pw_module_destroy(struct pw_module *module)
 | 
				
			||||||
		pw_global_destroy(module->global);
 | 
							pw_global_destroy(module->global);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: destroy", module);
 | 
				
			||||||
	free((char *) module->info.name);
 | 
						free((char *) module->info.name);
 | 
				
			||||||
	free((char *) module->info.filename);
 | 
						free((char *) module->info.filename);
 | 
				
			||||||
	free((char *) module->info.args);
 | 
						free((char *) module->info.args);
 | 
				
			||||||
| 
						 | 
					@ -336,7 +339,7 @@ void pw_module_destroy(struct pw_module *module)
 | 
				
			||||||
	pw_properties_free(module->properties);
 | 
						pw_properties_free(module->properties);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (dlclose(impl->hnd) != 0)
 | 
						if (dlclose(impl->hnd) != 0)
 | 
				
			||||||
		pw_log_warn("dlclose failed: %s", dlerror());
 | 
							pw_log_warn(NAME" %p: dlclose failed: %s", module, dlerror());
 | 
				
			||||||
	free(impl);
 | 
						free(impl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -367,7 +370,7 @@ int pw_module_update_properties(struct pw_module *module, const struct spa_dict
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	changed = pw_properties_update(module->properties, dict);
 | 
						changed = pw_properties_update(module->properties, dict);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("module %p: updated %d properties", module, changed);
 | 
						pw_log_debug(NAME" %p: updated %d properties", module, changed);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (!changed)
 | 
						if (!changed)
 | 
				
			||||||
		return 0;
 | 
							return 0;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -32,6 +32,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include <spa/debug/types.h>
 | 
					#include <spa/debug/types.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					#define NAME "proxy"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/** \cond */
 | 
					/** \cond */
 | 
				
			||||||
struct proxy {
 | 
					struct proxy {
 | 
				
			||||||
	struct pw_proxy this;
 | 
						struct pw_proxy this;
 | 
				
			||||||
| 
						 | 
					@ -71,7 +73,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->marshal = pw_protocol_get_marshal(remote->conn->protocol, type);
 | 
						this->marshal = pw_protocol_get_marshal(remote->conn->protocol, type);
 | 
				
			||||||
	if (this->marshal == NULL) {
 | 
						if (this->marshal == NULL) {
 | 
				
			||||||
		pw_log_error("proxy %p: no marshal for type %d", this, type);
 | 
							pw_log_error(NAME" %p: no marshal for type %d", this, type);
 | 
				
			||||||
		res = -EPROTO;
 | 
							res = -EPROTO;
 | 
				
			||||||
		goto error_clean;
 | 
							goto error_clean;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
| 
						 | 
					@ -79,7 +81,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
 | 
				
			||||||
	this->id = pw_map_insert_new(&remote->objects, this);
 | 
						this->id = pw_map_insert_new(&remote->objects, this);
 | 
				
			||||||
	if (this->id == SPA_ID_INVALID) {
 | 
						if (this->id == SPA_ID_INVALID) {
 | 
				
			||||||
		res = -errno;
 | 
							res = -errno;
 | 
				
			||||||
		pw_log_error("proxy %p: can't allocate new id: %m", this);
 | 
							pw_log_error(NAME" %p: can't allocate new id: %m", this);
 | 
				
			||||||
		goto error_clean;
 | 
							goto error_clean;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -96,7 +98,7 @@ struct pw_proxy *pw_proxy_new(struct pw_proxy *factory,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_append(&this->remote->proxy_list, &this->link);
 | 
						spa_list_append(&this->remote->proxy_list, &this->link);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("proxy %p: new %u %s remote %p, marshal %p",
 | 
						pw_log_debug(NAME" %p: new %u %s remote %p, marshal %p",
 | 
				
			||||||
			this, this->id,
 | 
								this, this->id,
 | 
				
			||||||
			spa_debug_type_find_name(pw_type_info(), type),
 | 
								spa_debug_type_find_name(pw_type_info(), type),
 | 
				
			||||||
			remote, this->marshal);
 | 
								remote, this->marshal);
 | 
				
			||||||
| 
						 | 
					@ -159,7 +161,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
 | 
				
			||||||
	struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
 | 
						struct proxy *impl = SPA_CONTAINER_OF(proxy, struct proxy, this);
 | 
				
			||||||
	struct pw_remote *remote = proxy->remote;
 | 
						struct pw_remote *remote = proxy->remote;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("proxy %p: destroy %u", proxy, proxy->id);
 | 
						pw_log_debug(NAME" %p: destroy %u", proxy, proxy->id);
 | 
				
			||||||
	pw_proxy_emit_destroy(proxy);
 | 
						pw_proxy_emit_destroy(proxy);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_remove(&proxy->link);
 | 
						spa_list_remove(&proxy->link);
 | 
				
			||||||
| 
						 | 
					@ -173,6 +175,7 @@ void pw_proxy_destroy(struct pw_proxy *proxy)
 | 
				
			||||||
		if (remote->core_proxy)
 | 
							if (remote->core_proxy)
 | 
				
			||||||
			pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
								pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: free", proxy);
 | 
				
			||||||
	free(impl);
 | 
						free(impl);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -184,7 +187,7 @@ int pw_proxy_sync(struct pw_proxy *proxy, int seq)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (remote->core_proxy != NULL) {
 | 
						if (remote->core_proxy != NULL) {
 | 
				
			||||||
		res = pw_core_proxy_sync(remote->core_proxy, proxy->id, seq);
 | 
							res = pw_core_proxy_sync(remote->core_proxy, proxy->id, seq);
 | 
				
			||||||
		pw_log_debug("proxy %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
 | 
							pw_log_debug(NAME" %p: %u seq:%d sync %u", proxy, proxy->id, seq, res);
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1235,6 +1235,7 @@ void pw_stream_destroy(struct pw_stream *stream)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clear_params(stream, PARAM_TYPE_INIT | PARAM_TYPE_OTHER | PARAM_TYPE_FORMAT);
 | 
						clear_params(stream, PARAM_TYPE_INIT | PARAM_TYPE_OTHER | PARAM_TYPE_FORMAT);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						pw_log_debug(NAME" %p: free", stream);
 | 
				
			||||||
	free(stream->error);
 | 
						free(stream->error);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_properties_free(stream->properties);
 | 
						pw_properties_free(stream->properties);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue