mirror of
				https://gitlab.freedesktop.org/pipewire/pipewire.git
				synced 2025-11-03 09:01:54 -05:00 
			
		
		
		
	Improve some debug
This commit is contained in:
		
							parent
							
								
									6e0ffb0c47
								
							
						
					
					
						commit
						e04d58ee3a
					
				
					 12 changed files with 24 additions and 21 deletions
				
			
		| 
						 | 
					@ -47,6 +47,7 @@ if cc.get_id() == 'gcc'
 | 
				
			||||||
			'-Wimplicit-fallthrough',
 | 
								'-Wimplicit-fallthrough',
 | 
				
			||||||
			'-Wpointer-arith',
 | 
								'-Wpointer-arith',
 | 
				
			||||||
			'-Wformat-security',
 | 
								'-Wformat-security',
 | 
				
			||||||
 | 
					#			'-DSPA_DEBUG_MEMCPY',
 | 
				
			||||||
#			'-DFASTPATH',
 | 
					#			'-DFASTPATH',
 | 
				
			||||||
			language : 'c')
 | 
								language : 'c')
 | 
				
			||||||
endif
 | 
					endif
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -36,7 +36,7 @@ extern "C" {
 | 
				
			||||||
#define spa_debug(...)	({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
 | 
					#define spa_debug(...)	({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
int spa_debug_port_info(int indent, const struct spa_port_info *info)
 | 
					static inline int spa_debug_port_info(int indent, const struct spa_port_info *info)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
        spa_debug("%*s" "struct spa_port_info %p:", indent, "", info);
 | 
					        spa_debug("%*s" "struct spa_port_info %p:", indent, "", info);
 | 
				
			||||||
        spa_debug("%*s" " flags: \t%08" PRIx64, indent, "", info->flags);
 | 
					        spa_debug("%*s" " flags: \t%08" PRIx64, indent, "", info->flags);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -251,8 +251,15 @@ struct spa_param_info {
 | 
				
			||||||
		__FILE__, __LINE__, __func__, (d), (s), (size_t)(n));	\
 | 
							__FILE__, __LINE__, __func__, (d), (s), (size_t)(n));	\
 | 
				
			||||||
	memcpy(d,s,n);							\
 | 
						memcpy(d,s,n);							\
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					#define spa_memmove(d,s,n)						\
 | 
				
			||||||
 | 
					({									\
 | 
				
			||||||
 | 
						fprintf(stderr, "%s:%u %s() memmove(%p, %p, %zd)\n",		\
 | 
				
			||||||
 | 
							__FILE__, __LINE__, __func__, (d), (s), (size_t)(n));	\
 | 
				
			||||||
 | 
						memmove(d,s,n);							\
 | 
				
			||||||
 | 
					})
 | 
				
			||||||
#else
 | 
					#else
 | 
				
			||||||
#define spa_memcpy(d,s,n)	memcpy(d,s,n)
 | 
					#define spa_memcpy(d,s,n)	memcpy(d,s,n)
 | 
				
			||||||
 | 
					#define spa_memmove(d,s,n)	memmove(d,s,n)
 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#ifdef __cplusplus
 | 
					#ifdef __cplusplus
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -804,14 +804,13 @@ impl_node_port_use_buffers(void *object,
 | 
				
			||||||
	if (direction != this->direction)
 | 
						if (direction != this->direction)
 | 
				
			||||||
		port_id++;
 | 
							port_id++;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						spa_log_debug(this->log, NAME" %p: %d %d:%d", this,
 | 
				
			||||||
 | 
								n_buffers, direction, port_id);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	if ((res = spa_node_port_use_buffers(this->target,
 | 
						if ((res = spa_node_port_use_buffers(this->target,
 | 
				
			||||||
					direction, port_id, flags, buffers, n_buffers)) < 0)
 | 
										direction, port_id, flags, buffers, n_buffers)) < 0)
 | 
				
			||||||
		return res;
 | 
							return res;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
	spa_log_debug(this->log, NAME" %p: %d %d:%d", this,
 | 
					 | 
				
			||||||
			n_buffers, direction, port_id);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if (n_buffers > 0 && this->use_converter) {
 | 
						if (n_buffers > 0 && this->use_converter) {
 | 
				
			||||||
		if (port_id == 0)
 | 
							if (port_id == 0)
 | 
				
			||||||
			res = negotiate_buffers(this);
 | 
								res = negotiate_buffers(this);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -918,7 +918,7 @@ static inline int handle_monitor(struct impl *this, const void *data, int n_samp
 | 
				
			||||||
	if (SPA_FLAG_IS_SET(dd->flags, SPA_DATA_FLAG_DYNAMIC))
 | 
						if (SPA_FLAG_IS_SET(dd->flags, SPA_DATA_FLAG_DYNAMIC))
 | 
				
			||||||
		dd->data = (void*)data;
 | 
							dd->data = (void*)data;
 | 
				
			||||||
	else
 | 
						else
 | 
				
			||||||
		memcpy(dd->data, data, size);
 | 
							spa_memcpy(dd->data, data, size);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -72,7 +72,7 @@ DEFINE_RESAMPLER(copy,arch)							\
 | 
				
			||||||
		for (c = 0; c < r->channels; c++) {				\
 | 
							for (c = 0; c < r->channels; c++) {				\
 | 
				
			||||||
			const float *s = src[c];				\
 | 
								const float *s = src[c];				\
 | 
				
			||||||
			float *d = dst[c];					\
 | 
								float *d = dst[c];					\
 | 
				
			||||||
			memcpy(&d[offs], &s[index + n_taps2],			\
 | 
								spa_memcpy(&d[offs], &s[index + n_taps2],		\
 | 
				
			||||||
					to_copy * sizeof(float));		\
 | 
										to_copy * sizeof(float));		\
 | 
				
			||||||
		}								\
 | 
							}								\
 | 
				
			||||||
		index += to_copy;						\
 | 
							index += to_copy;						\
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -171,7 +171,7 @@ static void impl_native_process(struct resample *r,
 | 
				
			||||||
			 * we have less, refill the history. */
 | 
								 * we have less, refill the history. */
 | 
				
			||||||
			refill = SPA_MIN(*in_len, n_taps-1);
 | 
								refill = SPA_MIN(*in_len, n_taps-1);
 | 
				
			||||||
			for (c = 0; c < r->channels; c++)
 | 
								for (c = 0; c < r->channels; c++)
 | 
				
			||||||
				memcpy(&history[c][hist], s[c], refill * sizeof(float));
 | 
									spa_memcpy(&history[c][hist], s[c], refill * sizeof(float));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
			if (hist + refill < n_taps) {
 | 
								if (hist + refill < n_taps) {
 | 
				
			||||||
				/* not enough in the history, keep the input in
 | 
									/* not enough in the history, keep the input in
 | 
				
			||||||
| 
						 | 
					@ -206,7 +206,7 @@ static void impl_native_process(struct resample *r,
 | 
				
			||||||
			/* not enough input data remaining for more output,
 | 
								/* not enough input data remaining for more output,
 | 
				
			||||||
			 * copy to history */
 | 
								 * copy to history */
 | 
				
			||||||
			for (c = 0; c < r->channels; c++)
 | 
								for (c = 0; c < r->channels; c++)
 | 
				
			||||||
				memcpy(history[c], &s[c][in], remain * sizeof(float));
 | 
									spa_memcpy(history[c], &s[c][in], remain * sizeof(float));
 | 
				
			||||||
		} else {
 | 
							} else {
 | 
				
			||||||
			/* we have enough input data remaining to produce
 | 
								/* we have enough input data remaining to produce
 | 
				
			||||||
			 * more output ask to resubmit. */
 | 
								 * more output ask to resubmit. */
 | 
				
			||||||
| 
						 | 
					@ -230,7 +230,7 @@ static void impl_native_process(struct resample *r,
 | 
				
			||||||
		if (remain) {
 | 
							if (remain) {
 | 
				
			||||||
			/* move history */
 | 
								/* move history */
 | 
				
			||||||
			for (c = 0; c < r->channels; c++)
 | 
								for (c = 0; c < r->channels; c++)
 | 
				
			||||||
				memmove(history[c], &history[c][in], remain * sizeof(float));
 | 
									spa_memmove(history[c], &history[c][in], remain * sizeof(float));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		spa_log_trace_fp(r->log, "native %p: in:%d remain:%d", r, in, remain);
 | 
							spa_log_trace_fp(r->log, "native %p: in:%d remain:%d", r, in, remain);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -740,7 +740,7 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		b = &port->buffers[io->buffer_id];
 | 
							b = &port->buffers[io->buffer_id];
 | 
				
			||||||
		src = &b->outbuf->datas[0];
 | 
							src = &b->outbuf->datas[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		memcpy(dst, src->data, n_frames * port->stride);
 | 
							spa_memcpy(dst, src->data, n_frames * port->stride);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		io->status = SPA_STATUS_NEED_DATA;
 | 
							io->status = SPA_STATUS_NEED_DATA;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -758,7 +758,7 @@ static int impl_node_process(void *object)
 | 
				
			||||||
		src = jack_port_get_buffer(port->jack_port, n_frames);
 | 
							src = jack_port_get_buffer(port->jack_port, n_frames);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		d = &b->outbuf->datas[0];
 | 
							d = &b->outbuf->datas[0];
 | 
				
			||||||
		memcpy(d->data, src, n_frames * port->stride);
 | 
							spa_memcpy(d->data, src, n_frames * port->stride);
 | 
				
			||||||
		d->chunk->offset = 0;
 | 
							d->chunk->offset = 0;
 | 
				
			||||||
		d->chunk->size = n_frames * port->stride;
 | 
							d->chunk->size = n_frames * port->stride;
 | 
				
			||||||
		d->chunk->stride = port->stride;
 | 
							d->chunk->stride = port->stride;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1100,7 +1100,7 @@ static void input_node_result(void *data, int seq, int res, uint32_t type, const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct pw_port *port = impl->this.input;
 | 
						struct pw_port *port = impl->this.input;
 | 
				
			||||||
	pw_log_debug(NAME" %p: input port %p result seq:%d res:%d type:%u",
 | 
						pw_log_trace(NAME" %p: input port %p result seq:%d res:%d type:%u",
 | 
				
			||||||
			impl, port, seq, res, type);
 | 
								impl, port, seq, res, type);
 | 
				
			||||||
	node_result(impl, port, seq, res, type, result);
 | 
						node_result(impl, port, seq, res, type, result);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -1109,7 +1109,7 @@ static void output_node_result(void *data, int seq, int res, uint32_t type, cons
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	struct impl *impl = data;
 | 
						struct impl *impl = data;
 | 
				
			||||||
	struct pw_port *port = impl->this.output;
 | 
						struct pw_port *port = impl->this.output;
 | 
				
			||||||
	pw_log_debug(NAME" %p: output port %p result seq:%d res:%d type:%u",
 | 
						pw_log_trace(NAME" %p: output port %p result seq:%d res:%d type:%u",
 | 
				
			||||||
			impl, port, seq, res, type);
 | 
								impl, port, seq, res, type);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	node_result(impl, port, seq, res, type, result);
 | 
						node_result(impl, port, seq, res, type, result);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1252,11 +1252,6 @@ static void do_reposition(struct pw_node *driver, struct pw_node *node)
 | 
				
			||||||
	pw_log_debug(NAME" %p: update position:%lu", node, src->position);
 | 
						pw_log_debug(NAME" %p: update position:%lu", node, src->position);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	memcpy(dst, src, sizeof(struct spa_io_segment));
 | 
						memcpy(dst, src, sizeof(struct spa_io_segment));
 | 
				
			||||||
	dst->flags = src->flags;
 | 
					 | 
				
			||||||
	dst->start = src->start;
 | 
					 | 
				
			||||||
	dst->duration = src->duration;
 | 
					 | 
				
			||||||
	dst->rate = src->rate;
 | 
					 | 
				
			||||||
	dst->position = src->position;
 | 
					 | 
				
			||||||
	if (dst->start == 0)
 | 
						if (dst->start == 0)
 | 
				
			||||||
		dst->start = a->position.clock.position - a->position.offset;
 | 
							dst->start = a->position.clock.position - a->position.offset;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -225,8 +225,9 @@ int pw_port_init_mix(struct pw_port *port, struct pw_port_mix *mix)
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	pw_log_debug(NAME" %p: init mix %d %d.%d io %p: (%s)", port,
 | 
						pw_log_debug(NAME" %p: init mix n_mix:%d %d.%d io:%p: (%s)", port,
 | 
				
			||||||
			port->n_mix, port->port_id, mix->port.port_id, mix->io, spa_strerror(res));
 | 
								port->n_mix, port->port_id, mix->port.port_id,
 | 
				
			||||||
 | 
								mix->io, spa_strerror(res));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	return res;
 | 
						return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue