mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-11 13:30:07 -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
|
|
@ -940,7 +940,10 @@ int pw_core_find_format(struct pw_core *core,
|
|||
output->direction, output->port_id,
|
||||
SPA_PARAM_Format, &oidx,
|
||||
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;
|
||||
}
|
||||
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,
|
||||
SPA_PARAM_EnumFormat, &iidx,
|
||||
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;
|
||||
}
|
||||
} 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,
|
||||
SPA_PARAM_Format, &iidx,
|
||||
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;
|
||||
}
|
||||
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,
|
||||
SPA_PARAM_EnumFormat, &oidx,
|
||||
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;
|
||||
}
|
||||
} 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,
|
||||
NULL, &filter, &fb)) != 1) {
|
||||
if (res == 0 && iidx == 0) {
|
||||
asprintf(error, "error input enum formats: %s", spa_strerror(res));
|
||||
asprintf(error, "no compatible formats");
|
||||
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;
|
||||
}
|
||||
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;
|
||||
goto again;
|
||||
}
|
||||
asprintf(error, "error output enum formats: %d", res);
|
||||
asprintf(error, "error output enum formats: %s", spa_strerror(res));
|
||||
goto error;
|
||||
}
|
||||
|
||||
|
|
@ -1012,14 +1027,14 @@ int pw_core_find_format(struct pw_core *core,
|
|||
spa_debug_format(2, NULL, *format);
|
||||
} else {
|
||||
res = -EBADF;
|
||||
asprintf(error, "error node state");
|
||||
asprintf(error, "error bad node state");
|
||||
goto error;
|
||||
}
|
||||
return res;
|
||||
|
||||
error:
|
||||
if (res == 0)
|
||||
res = -EBADF;
|
||||
res = -ENOENT;
|
||||
return res;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -259,20 +259,24 @@ pw_global_bind(struct pw_global *global, struct pw_client *client, uint32_t perm
|
|||
|
||||
error_version:
|
||||
res = -EPROTO;
|
||||
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
||||
res, "id %d: interface version %d < %d",
|
||||
id, global->version, version);
|
||||
if (client->core_resource)
|
||||
pw_core_resource_errorf(client->core_resource, id, client->recv_seq,
|
||||
res, "id %d: interface version %d < %d",
|
||||
id, global->version, version);
|
||||
goto error_exit;
|
||||
error_bind:
|
||||
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));
|
||||
if (client->core_resource)
|
||||
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;
|
||||
|
||||
error_exit:
|
||||
pw_log_error(NAME" %p: can't bind global %u/%u: %d (%s)", global, id,
|
||||
version, res, spa_strerror(res));
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -844,7 +844,7 @@ static void port_state_changed(struct pw_link *this, struct pw_port *port, struc
|
|||
{
|
||||
switch (state) {
|
||||
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;
|
||||
default:
|
||||
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);
|
||||
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;
|
||||
}
|
||||
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);
|
||||
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;
|
||||
goto error_clean;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue