Improve some debug

This commit is contained in:
Wim Taymans 2019-10-02 18:02:07 +02:00
parent 6e0ffb0c47
commit e04d58ee3a
12 changed files with 24 additions and 21 deletions

View file

@ -47,6 +47,7 @@ if cc.get_id() == 'gcc'
'-Wimplicit-fallthrough',
'-Wpointer-arith',
'-Wformat-security',
# '-DSPA_DEBUG_MEMCPY',
# '-DFASTPATH',
language : 'c')
endif

View file

@ -36,7 +36,7 @@ extern "C" {
#define spa_debug(...) ({ fprintf(stderr, __VA_ARGS__);fputc('\n', stderr); })
#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" " flags: \t%08" PRIx64, indent, "", info->flags);

View file

@ -251,8 +251,15 @@ struct spa_param_info {
__FILE__, __LINE__, __func__, (d), (s), (size_t)(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
#define spa_memcpy(d,s,n) memcpy(d,s,n)
#define spa_memmove(d,s,n) memmove(d,s,n)
#endif
#ifdef __cplusplus

View file

@ -804,14 +804,13 @@ impl_node_port_use_buffers(void *object,
if (direction != this->direction)
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,
direction, port_id, flags, buffers, n_buffers)) < 0)
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 (port_id == 0)
res = negotiate_buffers(this);

View file

@ -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))
dd->data = (void*)data;
else
memcpy(dd->data, data, size);
spa_memcpy(dd->data, data, size);
return res;
}

View file

@ -72,7 +72,7 @@ DEFINE_RESAMPLER(copy,arch) \
for (c = 0; c < r->channels; c++) { \
const float *s = src[c]; \
float *d = dst[c]; \
memcpy(&d[offs], &s[index + n_taps2], \
spa_memcpy(&d[offs], &s[index + n_taps2], \
to_copy * sizeof(float)); \
} \
index += to_copy; \

View file

@ -171,7 +171,7 @@ static void impl_native_process(struct resample *r,
* we have less, refill the history. */
refill = SPA_MIN(*in_len, n_taps-1);
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) {
/* 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,
* copy to history */
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 {
/* we have enough input data remaining to produce
* more output ask to resubmit. */
@ -230,7 +230,7 @@ static void impl_native_process(struct resample *r,
if (remain) {
/* move history */
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);

View file

@ -740,7 +740,7 @@ static int impl_node_process(void *object)
b = &port->buffers[io->buffer_id];
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;

View file

@ -758,7 +758,7 @@ static int impl_node_process(void *object)
src = jack_port_get_buffer(port->jack_port, n_frames);
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->size = n_frames * port->stride;
d->chunk->stride = port->stride;

View file

@ -1100,7 +1100,7 @@ static void input_node_result(void *data, int seq, int res, uint32_t type, const
{
struct impl *impl = data;
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);
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 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);
node_result(impl, port, seq, res, type, result);

View file

@ -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);
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)
dst->start = a->position.clock.position - a->position.offset;

View file

@ -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,
port->n_mix, port->port_id, mix->port.port_id, mix->io, spa_strerror(res));
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));
return res;
}