mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-12-21 08:56:56 -05: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)
|
static int impl_node_send_command(void *object, const struct spa_command *command)
|
||||||
{
|
{
|
||||||
struct node *this = object;
|
struct node *this = object;
|
||||||
|
uint32_t id;
|
||||||
|
|
||||||
spa_return_val_if_fail(this != NULL, -EINVAL);
|
spa_return_val_if_fail(this != NULL, -EINVAL);
|
||||||
spa_return_val_if_fail(command != 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)
|
if (this->resource == NULL)
|
||||||
return -EIO;
|
return -EIO;
|
||||||
|
|
|
||||||
|
|
@ -495,7 +495,9 @@ exit:
|
||||||
|
|
||||||
static int client_node_event(void *data, const struct spa_event *event)
|
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;
|
return -ENOTSUP;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -504,11 +506,13 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
||||||
struct node_data *data = _data;
|
struct node_data *data = _data;
|
||||||
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
|
struct pw_proxy *proxy = (struct pw_proxy*)data->client_node;
|
||||||
int res;
|
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:
|
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) {
|
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_IDLE)) < 0) {
|
||||||
pw_log_warn("node %p: pause failed", proxy);
|
pw_log_warn("node %p: pause failed", proxy);
|
||||||
pw_proxy_error(proxy, res, "pause failed");
|
pw_proxy_error(proxy, res, "pause failed");
|
||||||
|
|
@ -516,8 +520,6 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case SPA_NODE_COMMAND_Start:
|
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) {
|
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_RUNNING)) < 0) {
|
||||||
pw_log_warn("node %p: start failed", proxy);
|
pw_log_warn("node %p: start failed", proxy);
|
||||||
pw_proxy_error(proxy, res, "start failed");
|
pw_proxy_error(proxy, res, "start failed");
|
||||||
|
|
@ -525,7 +527,6 @@ static int client_node_command(void *_data, const struct spa_command *command)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SPA_NODE_COMMAND_Suspend:
|
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) {
|
if ((res = pw_impl_node_set_state(data->node, PW_NODE_STATE_SUSPENDED)) < 0) {
|
||||||
pw_log_warn("node %p: suspend failed", proxy);
|
pw_log_warn("node %p: suspend failed", proxy);
|
||||||
pw_proxy_error(proxy, res, "suspend failed");
|
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);
|
res = pw_impl_node_send_command(data->node, command);
|
||||||
break;
|
break;
|
||||||
default:
|
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;
|
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;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -578,8 +578,12 @@ static int node_send_command(void *object, const struct spa_command *command)
|
||||||
{
|
{
|
||||||
struct resource_data *data = object;
|
struct resource_data *data = object;
|
||||||
struct pw_impl_node *node = data->node;
|
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:
|
case SPA_NODE_COMMAND_Suspend:
|
||||||
suspend_node(node);
|
suspend_node(node);
|
||||||
break;
|
break;
|
||||||
|
|
@ -1551,10 +1555,12 @@ static void node_event(void *data, const struct spa_event *event)
|
||||||
{
|
{
|
||||||
struct pw_impl_node *node = data;
|
struct pw_impl_node *node = data;
|
||||||
struct impl *impl = SPA_CONTAINER_OF(node, struct impl, this);
|
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:
|
case SPA_NODE_EVENT_Error:
|
||||||
impl->last_error = -EFAULT;
|
impl->last_error = -EFAULT;
|
||||||
node_update_state(node, PW_NODE_STATE_ERROR,
|
node_update_state(node, PW_NODE_STATE_ERROR,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue