mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-17 08:56:49 -05:00
improve debug and error reporting
This commit is contained in:
parent
9aadc753c0
commit
9d842fb5eb
7 changed files with 45 additions and 22 deletions
|
|
@ -134,16 +134,16 @@ spa_debug_pod_value(int indent, const struct spa_type_info *info,
|
||||||
ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
|
ii = ti ? spa_debug_type_find(ti->values, 0) : NULL;
|
||||||
ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
|
ii = ii ? spa_debug_type_find(ii->values, b->id) : NULL;
|
||||||
|
|
||||||
spa_debug("%*s" "Object: size %d, type %s, id %s", indent, "", size,
|
spa_debug("%*s" "Object: size %d, type %s (%d), id %s (%d)", indent, "", size,
|
||||||
ti ? ti->name : "unknown", ii ? ii->name : "unknown");
|
ti ? ti->name : "unknown", b->type, ii ? ii->name : "unknown", b->id);
|
||||||
|
|
||||||
info = ti ? ti->values : info;
|
info = ti ? ti->values : info;
|
||||||
|
|
||||||
SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
|
SPA_POD_OBJECT_BODY_FOREACH(b, size, p) {
|
||||||
ii = spa_debug_type_find(info, p->key);
|
ii = spa_debug_type_find(info, p->key);
|
||||||
|
|
||||||
spa_debug("%*s" "Prop: key %s, context %d", indent+2, "",
|
spa_debug("%*s" "Prop: key %s (%d), context %d", indent+2, "",
|
||||||
ii ? ii->name : "unknown", p->context);
|
ii ? ii->name : "unknown", p->key, p->context);
|
||||||
|
|
||||||
spa_debug_pod_value(indent + 4, ii ? ii->values : NULL,
|
spa_debug_pod_value(indent + 4, ii ? ii->values : NULL,
|
||||||
p->value.type,
|
p->value.type,
|
||||||
|
|
|
||||||
|
|
@ -1420,6 +1420,7 @@ mmap_init(struct impl *this,
|
||||||
d[0].fd = expbuf.fd;
|
d[0].fd = expbuf.fd;
|
||||||
d[0].data = NULL;
|
d[0].data = NULL;
|
||||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_ALLOCATED);
|
SPA_FLAG_SET(b->flags, BUFFER_FLAG_ALLOCATED);
|
||||||
|
spa_log_debug(this->log, "v4l2: EXPBUF fd:%d", expbuf.fd);
|
||||||
} else {
|
} else {
|
||||||
d[0].type = SPA_DATA_MemPtr;
|
d[0].type = SPA_DATA_MemPtr;
|
||||||
d[0].flags = SPA_DATA_FLAG_READABLE;
|
d[0].flags = SPA_DATA_FLAG_READABLE;
|
||||||
|
|
@ -1435,6 +1436,7 @@ mmap_init(struct impl *this,
|
||||||
}
|
}
|
||||||
b->ptr = d[0].data;
|
b->ptr = d[0].data;
|
||||||
SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED);
|
SPA_FLAG_SET(b->flags, BUFFER_FLAG_MAPPED);
|
||||||
|
spa_log_debug(this->log, "v4l2: mmap ptr:%p", d[0].data);
|
||||||
}
|
}
|
||||||
spa_v4l2_buffer_recycle(this, i);
|
spa_v4l2_buffer_recycle(this, i);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -940,7 +940,10 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
output->direction, output->port_id,
|
output->direction, output->port_id,
|
||||||
SPA_PARAM_Format, &oidx,
|
SPA_PARAM_Format, &oidx,
|
||||||
NULL, &filter, &fb)) != 1) {
|
NULL, &filter, &fb)) != 1) {
|
||||||
asprintf(error, "error get output format: %d", res);
|
if (res < 0)
|
||||||
|
asprintf(error, "error get output format: %s", spa_strerror(res));
|
||||||
|
else
|
||||||
|
asprintf(error, "no output formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: Got output format:", core);
|
pw_log_debug(NAME" %p: Got output format:", core);
|
||||||
|
|
@ -951,7 +954,10 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
input->direction, input->port_id,
|
input->direction, input->port_id,
|
||||||
SPA_PARAM_EnumFormat, &iidx,
|
SPA_PARAM_EnumFormat, &iidx,
|
||||||
filter, format, builder)) <= 0) {
|
filter, format, builder)) <= 0) {
|
||||||
asprintf(error, "error input enum formats: %d", res);
|
if (res < 0)
|
||||||
|
asprintf(error, "error input enum formats: %s", spa_strerror(res));
|
||||||
|
else
|
||||||
|
asprintf(error, "no input formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (out_state >= PW_PORT_STATE_CONFIGURE && in_state > PW_PORT_STATE_CONFIGURE) {
|
} else if (out_state >= PW_PORT_STATE_CONFIGURE && in_state > PW_PORT_STATE_CONFIGURE) {
|
||||||
|
|
@ -961,7 +967,10 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
input->direction, input->port_id,
|
input->direction, input->port_id,
|
||||||
SPA_PARAM_Format, &iidx,
|
SPA_PARAM_Format, &iidx,
|
||||||
NULL, &filter, &fb)) != 1) {
|
NULL, &filter, &fb)) != 1) {
|
||||||
asprintf(error, "error get input format: %d", res);
|
if (res < 0)
|
||||||
|
asprintf(error, "error get input format: %s", spa_strerror(res));
|
||||||
|
else
|
||||||
|
asprintf(error, "no input format");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: Got input format:", core);
|
pw_log_debug(NAME" %p: Got input format:", core);
|
||||||
|
|
@ -972,7 +981,10 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
output->direction, output->port_id,
|
output->direction, output->port_id,
|
||||||
SPA_PARAM_EnumFormat, &oidx,
|
SPA_PARAM_EnumFormat, &oidx,
|
||||||
filter, format, builder)) <= 0) {
|
filter, format, builder)) <= 0) {
|
||||||
asprintf(error, "error output enum formats: %d", res);
|
if (res < 0)
|
||||||
|
asprintf(error, "error output enum formats: %s", spa_strerror(res));
|
||||||
|
else
|
||||||
|
asprintf(error, "no output format");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
} else if (in_state == PW_PORT_STATE_CONFIGURE && out_state == PW_PORT_STATE_CONFIGURE) {
|
||||||
|
|
@ -985,10 +997,13 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
SPA_PARAM_EnumFormat, &iidx,
|
SPA_PARAM_EnumFormat, &iidx,
|
||||||
NULL, &filter, &fb)) != 1) {
|
NULL, &filter, &fb)) != 1) {
|
||||||
if (res == 0 && iidx == 0) {
|
if (res == 0 && iidx == 0) {
|
||||||
asprintf(error, "error input enum formats: %s", spa_strerror(res));
|
asprintf(error, "no compatible formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
asprintf(error, "no more input formats");
|
if (res < 0)
|
||||||
|
asprintf(error, "error input enum formats: %s", spa_strerror(res));
|
||||||
|
else
|
||||||
|
asprintf(error, "no more input formats");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
pw_log_debug(NAME" %p: enum output %d with filter: %p", core, oidx, filter);
|
pw_log_debug(NAME" %p: enum output %d with filter: %p", core, oidx, filter);
|
||||||
|
|
@ -1003,7 +1018,7 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
oidx = 0;
|
oidx = 0;
|
||||||
goto again;
|
goto again;
|
||||||
}
|
}
|
||||||
asprintf(error, "error output enum formats: %d", res);
|
asprintf(error, "error output enum formats: %s", spa_strerror(res));
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1012,14 +1027,14 @@ int pw_core_find_format(struct pw_core *core,
|
||||||
spa_debug_format(2, NULL, *format);
|
spa_debug_format(2, NULL, *format);
|
||||||
} else {
|
} else {
|
||||||
res = -EBADF;
|
res = -EBADF;
|
||||||
asprintf(error, "error node state");
|
asprintf(error, "error bad node state");
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
if (res == 0)
|
if (res == 0)
|
||||||
res = -EBADF;
|
res = -ENOENT;
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -259,20 +259,24 @@ pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t perm
|
||||||
|
|
||||||
error_version:
|
error_version:
|
||||||
res = -EPROTO;
|
res = -EPROTO;
|
||||||
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
if (client->core_resource)
|
||||||
res, "id %d: interface version %d < %d",
|
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
||||||
id, global->version, version);
|
res, "id %d: interface version %d < %d",
|
||||||
|
id, global->version, version);
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
error_bind:
|
error_bind:
|
||||||
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
if (client->core_resource)
|
||||||
res, "can't bind global %u/%u: %d (%s)", id, version, res, spa_strerror(res));
|
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
||||||
|
res, "can't bind global %u/%u: %d (%s)", id, version,
|
||||||
|
res, spa_strerror(res));
|
||||||
goto error_exit;
|
goto error_exit;
|
||||||
|
|
||||||
error_exit:
|
error_exit:
|
||||||
pw_log_error(NAME" %p: can't bind global %u/%u: %d (%s)", global, id,
|
pw_log_error(NAME" %p: can't bind global %u/%u: %d (%s)", global, id,
|
||||||
version, res, spa_strerror(res));
|
version, res, spa_strerror(res));
|
||||||
pw_map_insert_at(&client->objects, id, NULL);
|
pw_map_insert_at(&client->objects, id, NULL);
|
||||||
pw_core_resource_remove_id(client->core_resource, id);
|
if (client->core_resource)
|
||||||
|
pw_core_resource_remove_id(client->core_resource, id);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -844,7 +844,7 @@ static void port_state_changed(struct pw_link *this, struct pw_port *port, struc
|
||||||
{
|
{
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case PW_PORT_STATE_ERROR:
|
case PW_PORT_STATE_ERROR:
|
||||||
pw_link_update_state(this, PW_LINK_STATE_ERROR, strdup(error));
|
pw_link_update_state(this, PW_LINK_STATE_ERROR, error ? strdup(error) : NULL);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
|
|
@ -1695,7 +1695,7 @@ static void on_state_complete(void *obj, void *data, int res, uint32_t seq)
|
||||||
|
|
||||||
pw_log_debug(NAME" %p: state complete %d", node, res);
|
pw_log_debug(NAME" %p: state complete %d", node, res);
|
||||||
if (SPA_RESULT_IS_ERROR(res)) {
|
if (SPA_RESULT_IS_ERROR(res)) {
|
||||||
asprintf(&error, "error changing node state: %d", res);
|
asprintf(&error, "error changing node state: %s", spa_strerror(res));
|
||||||
state = PW_NODE_STATE_ERROR;
|
state = PW_NODE_STATE_ERROR;
|
||||||
}
|
}
|
||||||
node_update_state(node, state, error);
|
node_update_state(node, state, error);
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,9 @@ struct pw_resource *pw_resource_new(struct pw_client *client,
|
||||||
|
|
||||||
this->marshal = pw_protocol_get_marshal(client->protocol, type);
|
this->marshal = pw_protocol_get_marshal(client->protocol, type);
|
||||||
if (this->marshal == NULL) {
|
if (this->marshal == NULL) {
|
||||||
pw_log_error(NAME" %p: no marshal for type %d", this, type);
|
pw_log_error(NAME" %p: no marshal for type %s/%d", this,
|
||||||
|
spa_debug_type_find_name(pw_type_info(), type),
|
||||||
|
version);
|
||||||
res = -EPROTO;
|
res = -EPROTO;
|
||||||
goto error_clean;
|
goto error_clean;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue