add some more debug

This commit is contained in:
Wim Taymans 2017-11-14 16:40:58 +01:00
parent c78fe6a353
commit 0534571f7d
3 changed files with 17 additions and 11 deletions

View file

@ -143,7 +143,13 @@ struct spa_fraction {
#define spa_memzero(x,l) (memset((x), 0, (l)))
#define spa_zero(x) (spa_memzero(&(x), sizeof(x)))
#define spa_strerror(err) strerror(-(err))
#define spa_strerror(err) \
({ \
int __err = -err; \
if (SPA_RESULT_IS_ASYNC(err)) \
__err = EINPROGRESS; \
strerror(__err); \
})
#ifdef __cplusplus
} /* extern "C" */

View file

@ -57,7 +57,7 @@ static int pause_node(struct pw_node *this)
res = spa_node_send_command(this->node,
&SPA_COMMAND_INIT(this->core->type.command_node.Pause));
if (res < 0)
pw_log_debug("node %p: send command error %d", this, res);
pw_log_debug("node %p: pause node error %s", this, spa_strerror(res));
return res;
}
@ -70,7 +70,7 @@ static int start_node(struct pw_node *this)
res = spa_node_send_command(this->node,
&SPA_COMMAND_INIT(this->core->type.command_node.Start));
if (res < 0)
pw_log_debug("node %p: send command error %d", this, res);
pw_log_debug("node %p: start node error %s", this, spa_strerror(res));
return res;
}
@ -84,14 +84,14 @@ static int suspend_node(struct pw_node *this)
spa_list_for_each(p, &this->input_ports, link) {
if ((res = pw_port_set_param(p, this->core->type.param.idFormat, 0, NULL)) < 0)
pw_log_warn("error unset format input: %d", res);
pw_log_warn("error unset format input: %s", spa_strerror(res));
/* force CONFIGURE in case of async */
p->state = PW_PORT_STATE_CONFIGURE;
}
spa_list_for_each(p, &this->output_ports, link) {
if ((res = pw_port_set_param(p, this->core->type.param.idFormat, 0, NULL)) < 0)
pw_log_warn("error unset format output: %d", res);
pw_log_warn("error unset format output: %s", spa_strerror(res));
/* force CONFIGURE in case of async */
p->state = PW_PORT_STATE_CONFIGURE;
}
@ -125,7 +125,7 @@ static void send_clock_update(struct pw_node *this)
}
res = spa_node_send_command(this->node, (struct spa_command *) &cu);
if (res < 0)
pw_log_debug("node %p: send clock update error %d", this, res);
pw_log_debug("node %p: send clock update error %s", this, spa_strerror(res));
}
static void node_unbind_func(void *data)
@ -707,7 +707,7 @@ struct pw_port *pw_node_get_free_port(struct pw_node *node, enum pw_direction di
pw_log_debug("node %p: creating port direction %d %u", node, direction, port_id);
if ((res = spa_node_add_port(node->node, direction, port_id)) < 0) {
pw_log_error("node %p: could not add port %d %d", node, port_id, res);
pw_log_error("node %p: could not add port %d %s", node, port_id, spa_strerror(res));
goto no_mem;
}
port = pw_port_new(direction, port_id, NULL, 0);

View file

@ -385,7 +385,7 @@ int pw_port_set_param(struct pw_port *port, uint32_t id, uint32_t flags,
int res;
res = spa_node_port_set_param(port->node->node, port->direction, port->port_id, id, flags, param);
pw_log_debug("port %p: set param %d %d", port, id, res);
pw_log_debug("port %p: set param %d: %d (%s)", port, id, res, spa_strerror(res));
if (!SPA_RESULT_IS_ASYNC(res) && id == port->node->core->type.param.idFormat) {
if (param == NULL || res < 0) {
@ -418,8 +418,8 @@ int pw_port_use_buffers(struct pw_port *port, struct spa_buffer **buffers, uint3
pw_port_pause(port);
pw_log_debug("port %p: use %d buffers", port, n_buffers);
res = spa_node_port_use_buffers(node->node, port->direction, port->port_id, buffers, n_buffers);
pw_log_debug("port %p: use %d buffers: %d (%s)", port, n_buffers, res, spa_strerror(res));
if (port->allocated) {
free(port->buffers);
@ -449,11 +449,11 @@ int pw_port_alloc_buffers(struct pw_port *port,
pw_port_pause(port);
pw_log_debug("port %p: alloc %d buffers", port, *n_buffers);
res = spa_node_port_alloc_buffers(node->node, port->direction, port->port_id,
params, n_params,
buffers, n_buffers);
pw_log_debug("port %p: alloc %d buffers: %d (%s)", port, *n_buffers, res, spa_strerror(res));
if (port->allocated) {
free(port->buffers);
pw_memblock_free(&port->buffer_mem);