summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wtaymans@redhat.com>2019-07-17 15:29:18 +0200
committerWim Taymans <wtaymans@redhat.com>2019-07-17 15:29:18 +0200
commit53d3d5cb0cc3cd4eb16bc5885ea4be1bc812b05f (patch)
tree2d6d7a4002d6e9b5e1f4930d53feb125bf934804
parent22b67cc95d0d685d6b1c240f6cd9d68367f5328f (diff)
improve debug
-rw-r--r--src/modules/module-adapter/adapter.c2
-rw-r--r--src/modules/module-protocol-native.c30
-rw-r--r--src/modules/module-protocol-native/connection.c3
-rw-r--r--src/modules/module-protocol-native/protocol-native.c8
-rw-r--r--src/modules/spa/module-node-factory.c2
-rw-r--r--src/pipewire/link.c1
6 files changed, 28 insertions, 18 deletions
diff --git a/src/modules/module-adapter/adapter.c b/src/modules/module-adapter/adapter.c
index bc1a84dd..c339293d 100644
--- a/src/modules/module-adapter/adapter.c
+++ b/src/modules/module-adapter/adapter.c
@@ -130,7 +130,7 @@ static int port_use_buffers(void *data,
struct pw_node *node = port->node;
int res, i;
- pw_log_debug(NAME " %p: port %p", p->node->node, port);
+ pw_log_debug(NAME " %p: port %p %p %d", p->node->node, port, buffers, n_buffers);
if (n_buffers > 0) {
for (i = 0; i < PORT_BUFFERS; i++)
diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c
index 09479c5b..dfe98d97 100644
--- a/src/modules/module-protocol-native.c
+++ b/src/modules/module-protocol-native.c
@@ -116,6 +116,7 @@ process_messages(struct client_data *data)
struct pw_core *core = client->core;
const struct pw_protocol_native_message *msg;
struct pw_resource *resource;
+ int res;
core->current_client = client;
@@ -135,16 +136,17 @@ process_messages(struct client_data *data)
msg->opcode, msg->id);
if (debug_messages) {
- fprintf(stderr, "<<<<<<<<< in: id:%d op:%d size:%d\n", msg->id, msg->opcode, msg->size);
+ fprintf(stderr, "<<<<<<<<< in: id:%d op:%d size:%d seq:%d\n",
+ msg->id, msg->opcode, msg->size, msg->seq);
spa_debug_pod(0, NULL, (struct spa_pod *)msg->data);
}
resource = pw_client_find_resource(client, msg->id);
if (resource == NULL) {
- pw_log_error("protocol-native %p: unknown resource %u",
- client->protocol, msg->id);
+ pw_log_error("protocol-native %p: unknown resource %u op:%u",
+ client->protocol, msg->id, msg->opcode);
pw_resource_error(client->core_resource,
- -EINVAL, "unknown resource %u", msg->id);
+ -EINVAL, "unknown resource %u op:%u", msg->id, msg->opcode);
continue;
}
@@ -153,8 +155,10 @@ process_messages(struct client_data *data)
goto invalid_method;
demarshal = marshal->method_demarshal;
- if (!demarshal[msg->opcode].func)
+ if (!demarshal[msg->opcode].func) {
+ res = -ENOENT;
goto invalid_message;
+ }
permissions = pw_resource_get_permissions(resource);
required = demarshal[msg->opcode].permissions | PW_PERM_X;
@@ -167,7 +171,7 @@ process_messages(struct client_data *data)
continue;
}
- if (demarshal[msg->opcode].func(resource, msg) < 0)
+ if ((res = demarshal[msg->opcode].func(resource, msg)) < 0)
goto invalid_message;
}
done:
@@ -175,15 +179,17 @@ done:
return;
invalid_method:
- pw_log_error("protocol-native %p: invalid method %u on resource %u",
- client->protocol, msg->opcode, msg->id);
- pw_resource_error(resource, -EINVAL, "invalid method %u", msg->opcode);
+ pw_log_error("protocol-native %p: invalid method id:%u op:%u",
+ client->protocol, msg->id, msg->opcode);
+ pw_resource_error(resource, -EINVAL, "invalid method id:%u op:%u",
+ msg->id, msg->opcode);
pw_client_destroy(client);
goto done;
invalid_message:
- pw_log_error("protocol-native %p: invalid message received %u %u",
- client->protocol, msg->id, msg->opcode);
- pw_resource_error(resource, -EINVAL, "invalid message %u", msg->opcode);
+ pw_log_error("protocol-native %p: invalid message received id:%u op:%u (%s)",
+ client->protocol, msg->id, msg->opcode, spa_strerror(res));
+ pw_resource_error(resource, res, "invalid message received id:%u op:%u (%s)",
+ msg->id, msg->opcode, spa_strerror(res));
spa_debug_pod(0, NULL, (struct spa_pod *)msg->data);
pw_client_destroy(client);
goto done;
diff --git a/src/modules/module-protocol-native/connection.c b/src/modules/module-protocol-native/connection.c
index a709004b..5974c7ce 100644
--- a/src/modules/module-protocol-native/connection.c
+++ b/src/modules/module-protocol-native/connection.c
@@ -416,7 +416,8 @@ pw_protocol_native_connection_end(struct pw_protocol_native_connection *conn,
buf->n_fds += buf->msg.n_fds;
if (debug_messages) {
- fprintf(stderr, ">>>>>>>>> out: id:%d op:%d size:%d\n", buf->msg.id, buf->msg.opcode, size);
+ fprintf(stderr, ">>>>>>>>> out: id:%d op:%d size:%d seq:%d\n",
+ buf->msg.id, buf->msg.opcode, size, buf->msg.seq);
spa_debug_pod(0, NULL, SPA_MEMBER(p, HDR_SIZE, struct spa_pod));
}
diff --git a/src/modules/module-protocol-native/protocol-native.c b/src/modules/module-protocol-native/protocol-native.c
index 03f0c544..9df5d3b1 100644
--- a/src/modules/module-protocol-native/protocol-native.c
+++ b/src/modules/module-protocol-native/protocol-native.c
@@ -546,7 +546,7 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
SPA_POD_Int(&id)) < 0)
return -EINVAL;
- pw_log_debug("client %p: destroy resource %d", client, id);
+ pw_log_debug("client %p: destroy resource %u", client, id);
if ((r = pw_client_find_resource(client, id)) == NULL)
goto no_resource;
@@ -554,9 +554,9 @@ static int core_method_demarshal_destroy(void *object, const struct pw_protocol_
return pw_resource_notify(resource, struct pw_core_proxy_methods, destroy, 0, r);
no_resource:
- pw_log_error("client %p: can't find resouce %d", client, id);
- pw_resource_error(resource, -EINVAL, "unknown resource %d", id);
- return -EINVAL;
+ pw_log_error("client %p: unknown resouce %u op:%u", client, id, msg->opcode);
+ pw_resource_error(resource, -EINVAL, "unknown resource %d op:%u", id, msg->opcode);
+ return 0;
}
static int registry_method_marshal_add_listener(void *object,
diff --git a/src/modules/spa/module-node-factory.c b/src/modules/spa/module-node-factory.c
index e5d7b249..574edb22 100644
--- a/src/modules/spa/module-node-factory.c
+++ b/src/modules/spa/module-node-factory.c
@@ -64,6 +64,7 @@ struct node_data {
static void resource_destroy(void *data)
{
struct node_data *nd = data;
+ pw_log_debug("node %p", nd);
spa_hook_remove(&nd->resource_listener);
if (nd->node)
pw_node_destroy(nd->node);
@@ -77,6 +78,7 @@ static const struct pw_resource_events resource_events = {
static void node_destroy(void *data)
{
struct node_data *nd = data;
+ pw_log_debug("node %p", nd);
spa_list_remove(&nd->link);
spa_hook_remove(&nd->node_listener);
nd->node = NULL;
diff --git a/src/pipewire/link.c b/src/pipewire/link.c
index 8c0d3b37..463e90db 100644
--- a/src/pipewire/link.c
+++ b/src/pipewire/link.c
@@ -912,6 +912,7 @@ static void output_remove(struct pw_link *this, struct pw_port *port)
static void on_port_destroy(struct pw_link *this, struct pw_port *port)
{
+ pw_log_debug("link %p: port %p", this, port);
pw_link_emit_port_unlinked(this, port);
pw_link_update_state(this, PW_LINK_STATE_UNLINKED, NULL);