mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Improve debug and small cleanups
This commit is contained in:
		
							parent
							
								
									170c3e4d6c
								
							
						
					
					
						commit
						0726a608df
					
				
					 7 changed files with 31 additions and 14 deletions
				
			
		| 
						 | 
					@ -587,6 +587,8 @@ impl_node_port_set_io(void *object,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
						spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_log_debug(this->log, NAME " %p: io %d %p %zd", this, id, data, size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	switch (id) {
 | 
						switch (id) {
 | 
				
			||||||
	case SPA_IO_Buffers:
 | 
						case SPA_IO_Buffers:
 | 
				
			||||||
		this->io = data;
 | 
							this->io = data;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -310,8 +310,8 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
 | 
				
			||||||
		SPA_PARAM_BUFFERS_align,   SPA_POD_Int(&align)) < 0)
 | 
							SPA_PARAM_BUFFERS_align,   SPA_POD_Int(&align)) < 0)
 | 
				
			||||||
		return -EINVAL;
 | 
							return -EINVAL;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d",
 | 
						spa_log_debug(this->log, "%p: buffers %d, blocks %d, size %d, align %d %d:%d",
 | 
				
			||||||
			this, buffers, blocks, size, align);
 | 
								this, buffers, blocks, size, align, out_alloc, in_alloc);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	datas = alloca(sizeof(struct spa_data) * blocks);
 | 
						datas = alloca(sizeof(struct spa_data) * blocks);
 | 
				
			||||||
	memset(datas, 0, sizeof(struct spa_data) * blocks);
 | 
						memset(datas, 0, sizeof(struct spa_data) * blocks);
 | 
				
			||||||
| 
						 | 
					@ -329,7 +329,7 @@ static int negotiate_link_buffers(struct impl *this, struct link *link)
 | 
				
			||||||
		free(link->buffers);
 | 
							free(link->buffers);
 | 
				
			||||||
	link->buffers = spa_buffer_alloc_array(buffers, flags, 0, NULL, blocks, datas, aligns);
 | 
						link->buffers = spa_buffer_alloc_array(buffers, flags, 0, NULL, blocks, datas, aligns);
 | 
				
			||||||
	if (link->buffers == NULL)
 | 
						if (link->buffers == NULL)
 | 
				
			||||||
		return -ENOMEM;
 | 
							return -errno;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	link->n_buffers = buffers;
 | 
						link->n_buffers = buffers;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -896,8 +896,8 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		ready = 0;
 | 
							ready = 0;
 | 
				
			||||||
		for (i = 0; i < this->n_nodes; i++) {
 | 
							for (i = 0; i < this->n_nodes; i++) {
 | 
				
			||||||
			r = spa_node_process(this->nodes[i]);
 | 
								r = spa_node_process(this->nodes[i]);
 | 
				
			||||||
			spa_log_trace_fp(this->log, NAME " %p: process %d %d", this, i, r);
 | 
								spa_log_trace_fp(this->log, NAME " %p: process %d %d: %s",
 | 
				
			||||||
 | 
										this, i, r, r < 0 ? spa_strerror(r) : "ok");
 | 
				
			||||||
			if (r < 0)
 | 
								if (r < 0)
 | 
				
			||||||
				return r;
 | 
									return r;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -809,8 +809,11 @@ static int impl_node_process(void *object)
 | 
				
			||||||
	inport = GET_IN_PORT(this, 0);
 | 
						inport = GET_IN_PORT(this, 0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	outio = outport->io;
 | 
						outio = outport->io;
 | 
				
			||||||
	spa_return_val_if_fail(outio != NULL, -EIO);
 | 
					 | 
				
			||||||
	inio = inport->io;
 | 
						inio = inport->io;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_log_trace_fp(this->log, NAME " %p: io %p %p", this, inio, outio);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_return_val_if_fail(outio != NULL, -EIO);
 | 
				
			||||||
	spa_return_val_if_fail(inio != NULL, -EIO);
 | 
						spa_return_val_if_fail(inio != NULL, -EIO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this,
 | 
						spa_log_trace_fp(this->log, NAME " %p: status %p %d %d -> %p %d %d", this,
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -820,6 +820,9 @@ impl_node_port_set_io(void *object,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
						spa_return_val_if_fail(this != NULL, -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_log_debug(this->log, NAME " %p: set io %d on port %d:%d",
 | 
				
			||||||
 | 
								this, id, direction, port_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
						spa_return_val_if_fail(CHECK_PORT(this, direction, port_id), -EINVAL);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	port = GET_PORT(this, direction, port_id);
 | 
						port = GET_PORT(this, direction, port_id);
 | 
				
			||||||
| 
						 | 
					@ -853,8 +856,12 @@ static inline int get_in_buffer(struct impl *this, struct port *port, struct buf
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct spa_io_buffers *io;
 | 
						struct spa_io_buffers *io;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((io = port->io) == NULL ||
 | 
						if ((io = port->io) == NULL) {
 | 
				
			||||||
	    io->status != SPA_STATUS_HAVE_BUFFER ||
 | 
							spa_log_trace_fp(this->log, NAME " %p: no io on port %d",
 | 
				
			||||||
 | 
									this, port->id);
 | 
				
			||||||
 | 
							return -EIO;
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
						if (io->status != SPA_STATUS_HAVE_BUFFER ||
 | 
				
			||||||
	    io->buffer_id >= port->n_buffers) {
 | 
						    io->buffer_id >= port->n_buffers) {
 | 
				
			||||||
		spa_log_trace_fp(this->log, NAME " %p: empty port %d %p %d %d %d",
 | 
							spa_log_trace_fp(this->log, NAME " %p: empty port %d %p %d %d %d",
 | 
				
			||||||
				this, port->id, io, io->status, io->buffer_id,
 | 
									this, port->id, io, io->status, io->buffer_id,
 | 
				
			||||||
| 
						 | 
					@ -926,7 +933,8 @@ static int impl_node_process(void *object)
 | 
				
			||||||
	spa_return_val_if_fail(outio != NULL, -EIO);
 | 
						spa_return_val_if_fail(outio != NULL, -EIO);
 | 
				
			||||||
	spa_return_val_if_fail(this->conv.process != NULL, -EIO);
 | 
						spa_return_val_if_fail(this->conv.process != NULL, -EIO);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	spa_log_trace_fp(this->log, NAME " %p: status %d %d", this, outio->status, outio->buffer_id);
 | 
						spa_log_trace_fp(this->log, NAME " %p: status %p %d %d", this,
 | 
				
			||||||
 | 
								outio, outio->status, outio->buffer_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = get_out_buffer(this, outport, &dbuf)) != 0)
 | 
						if ((res = get_out_buffer(this, outport, &dbuf)) != 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1565,7 +1565,7 @@ static void node_port_added(void *data, struct pw_port *port)
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct port *p = pw_port_get_user_data(port);
 | 
						struct port *p = pw_port_get_user_data(port);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_port_set_mix(port, (struct spa_node *)&p->mix_node,
 | 
						pw_port_set_mix(port, &p->mix_node,
 | 
				
			||||||
			PW_PORT_MIX_FLAG_MULTI |
 | 
								PW_PORT_MIX_FLAG_MULTI |
 | 
				
			||||||
			PW_PORT_MIX_FLAG_MIX_ONLY);
 | 
								PW_PORT_MIX_FLAG_MIX_ONLY);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -179,7 +179,8 @@ static int start_node(struct pw_node *this)
 | 
				
			||||||
				    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start));
 | 
									    &SPA_NODE_COMMAND_INIT(SPA_NODE_COMMAND_Start));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if (res < 0)
 | 
						if (res < 0)
 | 
				
			||||||
		pw_log_debug("node %p: start node error %s", this, spa_strerror(res));
 | 
							pw_log_error("node %p: start node error %d: %s",
 | 
				
			||||||
 | 
									this, res, spa_strerror(res));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -200,8 +200,8 @@ int pw_port_init_mix(struct pw_port *port, struct pw_port_mix *mix)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug("port %p: init mix %d.%d io %p", port,
 | 
						pw_log_debug("port %p: init mix %d.%d io %p: (%s)", port,
 | 
				
			||||||
			port->port_id, mix->port.port_id, mix->io);
 | 
								port->port_id, mix->port.port_id, mix->io, spa_strerror(res));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1061,9 +1061,12 @@ int pw_port_use_buffers(struct pw_port *port, uint32_t mix_id,
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (port->state == PW_PORT_STATE_READY) {
 | 
						if (port->state == PW_PORT_STATE_READY) {
 | 
				
			||||||
		if (!SPA_FLAG_CHECK(port->mix_flags, PW_PORT_MIX_FLAG_MIX_ONLY)) {
 | 
							if (!SPA_FLAG_CHECK(port->mix_flags, PW_PORT_MIX_FLAG_MIX_ONLY)) {
 | 
				
			||||||
 | 
								pw_log_debug("port %p: use buffers on node: %p", port,
 | 
				
			||||||
 | 
										node->node);
 | 
				
			||||||
			res = spa_node_port_use_buffers(node->node,
 | 
								res = spa_node_port_use_buffers(node->node,
 | 
				
			||||||
					port->direction, port->port_id, buffers, n_buffers);
 | 
										port->direction, port->port_id, buffers, n_buffers);
 | 
				
			||||||
			pw_log_debug("port %p: use buffers on node: %d (%s)",
 | 
								if (res < 0)
 | 
				
			||||||
 | 
									pw_log_error("port %p: use buffers on node: %d (%s)",
 | 
				
			||||||
					port, res, spa_strerror(res));
 | 
										port, res, spa_strerror(res));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		port->allocated = false;
 | 
							port->allocated = false;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue