mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-31 22:25:38 -04:00
improve debug of commands and events
Add the type name in the log.
This commit is contained in:
parent
0b3a06192e
commit
11c478d0fa
3 changed files with 25 additions and 13 deletions
|
|
@ -396,11 +396,14 @@ static int impl_node_set_io(void *object, uint32_t id, void *data, size_t size)
|
|||
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||
{
|
||||
struct node *this = object;
|
||||
uint32_t id;
|
||||
|
||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||
spa_return_val_if_fail(command != NULL, -EINVAL);
|
||||
|
||||
pw_log_debug("%p: send command %d", this, SPA_COMMAND_TYPE(command));
|
||||
id = SPA_NODE_COMMAND_ID(command);
|
||||
pw_log_debug("%p: send command %d (%s)", this, id,
|
||||
spa_debug_type_find_name(spa_type_node_command_id, id));
|
||||
|
||||
if (this->resource == NULL)
|
||||
return -EIO;
|
||||
|
|
|
|||
|
|
@ -495,7 +495,9 @@ exit:
|
|||
|
||||
static int client_node_event(void *data, const struct spa_event *event)
|
||||
{
|
||||
pw_log_warn("unhandled node event %d", SPA_EVENT_TYPE(event));
|
||||
uint32_t id = SPA_NODE_EVENT_ID(event);
|
||||
pw_log_warn("unhandled node event %d (%s)", id,
|
||||
spa_debug_type_find_name(spa_type_node_event_id, id));
|
||||
return -ENOTSUP;
|
||||
}
|
||||
|
||||
|
|
@ -504,11 +506,13 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
|||
struct node_data *data = _data;
|
||||
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
|
||||
int res;
|
||||
uint32_t id = SPA_NODE_COMMAND_ID(command);
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
pw_log_debug("%p: got command %d (%s)", proxy, id,
|
||||
spa_debug_type_find_name(spa_type_node_command_id, id));
|
||||
|
||||
switch (id) {
|
||||
case SPA_NODE_COMMAND_Pause:
|
||||
pw_log_debug("node %p: pause", proxy);
|
||||
|
||||
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_IDLE)) < 0) {
|
||||
pw_log_warn("node %p: pause failed", proxy);
|
||||
pw_proxy_error(proxy, res, "pause failed");
|
||||
|
|
@ -516,8 +520,6 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
|||
|
||||
break;
|
||||
case SPA_NODE_COMMAND_Start:
|
||||
pw_log_debug("node %p: start", proxy);
|
||||
|
||||
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_RUNNING)) < 0) {
|
||||
pw_log_warn("node %p: start failed", proxy);
|
||||
pw_proxy_error(proxy, res, "start failed");
|
||||
|
|
@ -525,7 +527,6 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
|||
break;
|
||||
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
pw_log_debug("node %p: suspend", proxy);
|
||||
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_SUSPENDED)) < 0) {
|
||||
pw_log_warn("node %p: suspend failed", proxy);
|
||||
pw_proxy_error(proxy, res, "suspend failed");
|
||||
|
|
@ -535,9 +536,11 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
|||
res = pw_impl_node_send_command(data->node, command);
|
||||
break;
|
||||
default:
|
||||
pw_log_warn("unhandled node command %d", SPA_NODE_COMMAND_ID(command));
|
||||
pw_log_warn("unhandled node command %d (%s)", id,
|
||||
spa_debug_type_find_name(spa_type_node_command_id, id));
|
||||
res = -ENOTSUP;
|
||||
pw_proxy_errorf(proxy, res, "command %d not supported", SPA_NODE_COMMAND_ID(command));
|
||||
pw_proxy_errorf(proxy, res, "command %d (%s) not supported", id,
|
||||
spa_debug_type_find_name(spa_type_node_command_id, id));
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -578,8 +578,12 @@ static int node_send_command(void *object, const struct spa_command *command)
|
|||
{
|
||||
struct resource_data *data = object;
|
||||
struct pw_impl_node *node = data->node;
|
||||
uint32_t id = SPA_NODE_COMMAND_ID(command);
|
||||
|
||||
switch (SPA_NODE_COMMAND_ID(command)) {
|
||||
pw_log_debug("%p: got command %d (%s)", node, id,
|
||||
spa_debug_type_find_name(spa_type_node_command_id, id));
|
||||
|
||||
switch (id) {
|
||||
case SPA_NODE_COMMAND_Suspend:
|
||||
suspend_node(node);
|
||||
break;
|
||||
|
|
@ -1551,10 +1555,12 @@ static void node_event(void *data, const struct spa_event *event)
|
|||
{
|
||||
struct pw_impl_node *node = data;
|
||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
||||
uint32_t id = SPA_NODE_EVENT_ID(event);
|
||||
|
||||
pw_log_trace("%p: event %d", node, SPA_EVENT_TYPE(event));
|
||||
pw_log_debug("%p: event %d (%s)", node, id,
|
||||
spa_debug_type_find_name(spa_type_node_event_id, id));
|
||||
|
||||
switch (SPA_NODE_EVENT_ID(event)) {
|
||||
switch (id) {
|
||||
case SPA_NODE_EVENT_Error:
|
||||
impl->last_error = -EFAULT;
|
||||
node_update_state(node, PW_NODE_STATE_ERROR,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue