mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	node: improve debug
This commit is contained in:
		
							parent
							
								
									66ea505f22
								
							
						
					
					
						commit
						1646b13e29
					
				
					 3 changed files with 26 additions and 18 deletions
				
			
		| 
						 | 
					@ -1131,7 +1131,6 @@ static void node_free(void *data)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (remote->core_proxy)
 | 
						if (remote->core_proxy)
 | 
				
			||||||
		pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
							pw_core_proxy_destroy(remote->core_proxy, proxy);
 | 
				
			||||||
 | 
					 | 
				
			||||||
	spa_hook_remove(&d->proxy_listener);
 | 
						spa_hook_remove(&d->proxy_listener);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -222,9 +222,9 @@ struct pw_protocol_native_connection *pw_protocol_native_connection_new(struct p
 | 
				
			||||||
	this->fd = fd;
 | 
						this->fd = fd;
 | 
				
			||||||
	spa_hook_list_init(&this->listener_list);
 | 
						spa_hook_list_init(&this->listener_list);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl->out.buffer_data = malloc(MAX_BUFFER_SIZE);
 | 
						impl->out.buffer_data = calloc(1, MAX_BUFFER_SIZE);
 | 
				
			||||||
	impl->out.buffer_maxsize = MAX_BUFFER_SIZE;
 | 
						impl->out.buffer_maxsize = MAX_BUFFER_SIZE;
 | 
				
			||||||
	impl->in.buffer_data = malloc(MAX_BUFFER_SIZE);
 | 
						impl->in.buffer_data = calloc(1, MAX_BUFFER_SIZE);
 | 
				
			||||||
	impl->in.buffer_maxsize = MAX_BUFFER_SIZE;
 | 
						impl->in.buffer_maxsize = MAX_BUFFER_SIZE;
 | 
				
			||||||
	impl->in.update = true;
 | 
						impl->in.update = true;
 | 
				
			||||||
	impl->core = core;
 | 
						impl->core = core;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -600,9 +600,13 @@ static void dump_states(struct pw_node *driver)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each(t, &driver->rt.target_list, link) {
 | 
						spa_list_for_each(t, &driver->rt.target_list, link) {
 | 
				
			||||||
		struct pw_node_activation *a = t->activation;
 | 
							struct pw_node_activation *a = t->activation;
 | 
				
			||||||
		pw_log_warn("node %p: required:%d waiting:%"PRIu64
 | 
							pw_log_warn("node %p (%s): required:%d s:%"PRIu64" a:%"PRIu64" f:%"PRIu64
 | 
				
			||||||
				" process:%"PRIu64" status:%d",
 | 
									" waiting:%"PRIu64" process:%"PRIu64" status:%d",
 | 
				
			||||||
				t->node, a->state[0].required,
 | 
									t->node, t->node ? t->node->info.name : "",
 | 
				
			||||||
 | 
									a->state[0].required,
 | 
				
			||||||
 | 
									a->signal_time,
 | 
				
			||||||
 | 
									a->awake_time,
 | 
				
			||||||
 | 
									a->finish_time,
 | 
				
			||||||
				a->awake_time - a->signal_time,
 | 
									a->awake_time - a->signal_time,
 | 
				
			||||||
				a->finish_time - a->awake_time,
 | 
									a->finish_time - a->awake_time,
 | 
				
			||||||
				t->activation->status);
 | 
									t->activation->status);
 | 
				
			||||||
| 
						 | 
					@ -651,28 +655,30 @@ static inline int process_node(void *data)
 | 
				
			||||||
	struct pw_node *this = data;
 | 
						struct pw_node *this = data;
 | 
				
			||||||
	struct timespec ts;
 | 
						struct timespec ts;
 | 
				
			||||||
        struct pw_port *p;
 | 
					        struct pw_port *p;
 | 
				
			||||||
	struct pw_node_activation *activation = this->rt.activation;
 | 
						struct pw_node_activation *a = this->rt.activation;
 | 
				
			||||||
	int status;
 | 
						int status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        pw_log_trace("node %p: process", this);
 | 
					        pw_log_trace("node %p: process", this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
						clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
				
			||||||
	activation->status = AWAKE;
 | 
						a->status = AWAKE;
 | 
				
			||||||
	activation->awake_time = SPA_TIMESPEC_TO_NSEC(&ts);
 | 
						a->awake_time = SPA_TIMESPEC_TO_NSEC(&ts);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_list_for_each(p, &this->rt.input_mix, rt.node_link)
 | 
						spa_list_for_each(p, &this->rt.input_mix, rt.node_link)
 | 
				
			||||||
		spa_node_process(p->mix);
 | 
							spa_node_process(p->mix);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	status = spa_node_process(this->node);
 | 
						status = spa_node_process(this->node);
 | 
				
			||||||
	activation->state[0].status = status;
 | 
						a->state[0].status = status;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (this == this->driver_node && !this->exported) {
 | 
						if (this == this->driver_node && !this->exported) {
 | 
				
			||||||
		clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
							clock_gettime(CLOCK_MONOTONIC, &ts);
 | 
				
			||||||
		activation->status = FINISHED;
 | 
							a->status = FINISHED;
 | 
				
			||||||
		activation->signal_time = activation->finish_time;
 | 
							a->signal_time = a->finish_time;
 | 
				
			||||||
		activation->finish_time = SPA_TIMESPEC_TO_NSEC(&ts);
 | 
							a->finish_time = SPA_TIMESPEC_TO_NSEC(&ts);
 | 
				
			||||||
		activation->running = false;
 | 
							a->running = false;
 | 
				
			||||||
		pw_log_trace("node %p: graph completed", this);
 | 
							pw_log_trace("node %p: graph completed wait:%"PRIu64" run:%"PRIu64, this,
 | 
				
			||||||
 | 
									a->awake_time - a->signal_time,
 | 
				
			||||||
 | 
									a->finish_time - a->awake_time);
 | 
				
			||||||
	} else if (status == SPA_STATUS_OK) {
 | 
						} else if (status == SPA_STATUS_OK) {
 | 
				
			||||||
		pw_log_trace("node %p: async continue", this);
 | 
							pw_log_trace("node %p: async continue", this);
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
| 
						 | 
					@ -710,17 +716,20 @@ struct pw_node *pw_node_new(struct pw_core *core,
 | 
				
			||||||
	struct impl *impl;
 | 
						struct impl *impl;
 | 
				
			||||||
	struct pw_node *this;
 | 
						struct pw_node *this;
 | 
				
			||||||
	size_t size;
 | 
						size_t size;
 | 
				
			||||||
 | 
						char *n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	impl = calloc(1, sizeof(struct impl) + user_data_size);
 | 
						impl = calloc(1, sizeof(struct impl) + user_data_size);
 | 
				
			||||||
	if (impl == NULL)
 | 
						if (impl == NULL)
 | 
				
			||||||
		goto error;
 | 
							goto error;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (name == NULL)
 | 
						if (name == NULL)
 | 
				
			||||||
		name = "node";
 | 
							asprintf(&n, "node");
 | 
				
			||||||
 | 
						else
 | 
				
			||||||
 | 
							n = strdup(name);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this = &impl->this;
 | 
						this = &impl->this;
 | 
				
			||||||
	this->core = core;
 | 
						this->core = core;
 | 
				
			||||||
	pw_log_debug("node %p: new \"%s\"", this, name);
 | 
						pw_log_debug("node %p: new \"%s\"", this, n);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (user_data_size > 0)
 | 
						if (user_data_size > 0)
 | 
				
			||||||
                this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
 | 
					                this->user_data = SPA_MEMBER(impl, sizeof(struct impl), void);
 | 
				
			||||||
| 
						 | 
					@ -755,7 +764,7 @@ struct pw_node *pw_node_new(struct pw_core *core,
 | 
				
			||||||
	if (impl->work == NULL)
 | 
						if (impl->work == NULL)
 | 
				
			||||||
		goto clean_impl;
 | 
							goto clean_impl;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->info.name = strdup(name);
 | 
						this->info.name = n;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	this->data_loop = core->data_loop;
 | 
						this->data_loop = core->data_loop;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue