summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2017-11-14 16:40:58 +0100
committerWim Taymans <wtaymans@redhat.com>2017-11-14 16:40:58 +0100
commit0534571f7dcf7610806d8b294cc74250e5ef35d5 (patch)
tree7e8dd924ca93e78126413f878604652c9e48f93b
parentc78fe6a3537b0c160413035d357ab6e186977fb4 (diff)
add some more debug
-rw-r--r--spa/include/spa/utils/defs.h8
-rw-r--r--src/pipewire/node.c12
-rw-r--r--src/pipewire/port.c8
3 files changed, 17 insertions, 11 deletions
diff --git a/spa/include/spa/utils/defs.h b/spa/include/spa/utils/defs.h
index ef64a69b..b1863105 100644
--- a/spa/include/spa/utils/defs.h
+++ b/spa/include/spa/utils/defs.h
@@ -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" */
diff --git a/src/pipewire/node.c b/src/pipewire/node.c
index be91438d..67d849af 100644
--- a/src/pipewire/node.c
+++ b/src/pipewire/node.c
@@ -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);
diff --git a/src/pipewire/port.c b/src/pipewire/port.c
index 905661fc..5304ad6c 100644
--- a/src/pipewire/port.c
+++ b/src/pipewire/port.c
@@ -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);