impl-port: improve debug

Debug the mix port id as well.
This commit is contained in:
Wim Taymans 2023-06-20 19:00:23 +02:00
parent 9fa46af488
commit 6806af954e
3 changed files with 18 additions and 10 deletions

View file

@ -157,12 +157,16 @@ static void link_update_state(struct pw_impl_link *link, enum pw_link_state stat
pw_link_state_as_string(state), error); pw_link_state_as_string(state), error);
if (state == PW_LINK_STATE_ERROR) { if (state == PW_LINK_STATE_ERROR) {
pw_log_error("(%s) %s -> error (%s)", link->name, pw_log_error("(%s) %s -> error (%s) (%s-%s)", link->name,
pw_link_state_as_string(old), error); pw_link_state_as_string(old), error,
pw_impl_port_state_as_string(link->output->state),
pw_impl_port_state_as_string(link->input->state));
} else { } else {
pw_log_info("(%s) %s -> %s", link->name, pw_log_info("(%s) %s -> %s (%s-%s)", link->name,
pw_link_state_as_string(old), pw_link_state_as_string(old),
pw_link_state_as_string(state)); pw_link_state_as_string(state),
pw_impl_port_state_as_string(link->output->state),
pw_impl_port_state_as_string(link->input->state));
} }
pw_impl_link_emit_state_changed(link, old, state, error); pw_impl_link_emit_state_changed(link, old, state, error);
@ -1287,9 +1291,9 @@ struct pw_impl_link *pw_context_create_link(struct pw_context *context,
output_node, output->port_id, this->rt.out_mix.port.port_id, output_node, output->port_id, this->rt.out_mix.port.port_id,
input_node, input->port_id, this->rt.in_mix.port.port_id); input_node, input->port_id, this->rt.in_mix.port.port_id);
this->name = spa_aprintf("%d.%d -> %d.%d", this->name = spa_aprintf("%d.%d.%d -> %d.%d.%d",
output_node->info.id, output->port_id, output_node->info.id, output->port_id, this->rt.out_mix.port.port_id,
input_node->info.id, input->port_id); input_node->info.id, input->port_id, this->rt.in_mix.port.port_id);
pw_log_info("(%s) (%s) -> (%s)", this->name, output_node->name, input_node->name); pw_log_info("(%s) (%s) -> (%s)", this->name, output_node->name, input_node->name);
pw_impl_port_emit_link_added(output, this); pw_impl_port_emit_link_added(output, this);

View file

@ -70,7 +70,7 @@ static void emit_info_changed(struct pw_impl_port *port)
port->info.change_mask = 0; port->info.change_mask = 0;
} }
static const char *port_state_as_string(enum pw_impl_port_state state) const char *pw_impl_port_state_as_string(enum pw_impl_port_state state)
{ {
switch (state) { switch (state) {
case PW_IMPL_PORT_STATE_ERROR: case PW_IMPL_PORT_STATE_ERROR:
@ -101,7 +101,8 @@ void pw_impl_port_update_state(struct pw_impl_port *port, enum pw_impl_port_stat
pw_log(state == PW_IMPL_PORT_STATE_ERROR ? pw_log(state == PW_IMPL_PORT_STATE_ERROR ?
SPA_LOG_LEVEL_ERROR : SPA_LOG_LEVEL_DEBUG, SPA_LOG_LEVEL_ERROR : SPA_LOG_LEVEL_DEBUG,
"%p: state %s -> %s (%s)", port, "%p: state %s -> %s (%s)", port,
port_state_as_string(old), port_state_as_string(state), error); pw_impl_port_state_as_string(old),
pw_impl_port_state_as_string(state), error);
pw_impl_port_emit_state_changed(port, old, state, error); pw_impl_port_emit_state_changed(port, old, state, error);
@ -1705,7 +1706,7 @@ int pw_impl_port_use_buffers(struct pw_impl_port *port, struct pw_impl_port_mix
int res = 0, res2; int res = 0, res2;
pw_log_debug("%p: %d:%d.%d: %d buffers flags:%d state:%d n_mix:%d", port, pw_log_debug("%p: %d:%d.%d: %d buffers flags:%d state:%d n_mix:%d", port,
port->direction, port->port_id, mix->id, port->direction, port->port_id, mix->port.port_id,
n_buffers, flags, port->state, port->n_mix); n_buffers, flags, port->state, port->n_mix);
if (n_buffers == 0 && port->state <= PW_IMPL_PORT_STATE_READY) if (n_buffers == 0 && port->state <= PW_IMPL_PORT_STATE_READY)

View file

@ -98,6 +98,9 @@ const struct pw_port_info *pw_impl_port_get_info(struct pw_impl_port *port);
/** Get the port id */ /** Get the port id */
uint32_t pw_impl_port_get_id(struct pw_impl_port *port); uint32_t pw_impl_port_get_id(struct pw_impl_port *port);
/** Get the port state as a string */
const char *pw_impl_port_state_as_string(enum pw_impl_port_state state);
/** Get the port parent node or NULL when not yet set */ /** Get the port parent node or NULL when not yet set */
struct pw_impl_node *pw_impl_port_get_node(struct pw_impl_port *port); struct pw_impl_node *pw_impl_port_get_node(struct pw_impl_port *port);