Commit 108bf82a authored by Wim Taymans's avatar Wim Taymans
Browse files

context: improve param debug

Make it possible to log more info in the param debug functions
parent 6495199a
......@@ -257,11 +257,11 @@ int pw_buffers_negotiate(struct pw_context *context, uint32_t flags,
res = param_filter(result, &input, &output, SPA_PARAM_Buffers, &b);
if (res < 0) {
pw_context_debug_port_params(context, input.node, input.direction,
input.port_id, SPA_PARAM_Buffers,
"input param", res);
input.port_id, SPA_PARAM_Buffers, res,
"input param");
pw_context_debug_port_params(context, output.node, output.direction,
output.port_id, SPA_PARAM_Buffers,
"output param", res);
output.port_id, SPA_PARAM_Buffers, res,
"output param");
return res;
}
n_params = res;
......
......@@ -592,19 +592,25 @@ struct pw_impl_port *pw_context_find_port(struct pw_context *context,
return best;
}
int pw_context_debug_port_params(struct pw_context *this,
SPA_PRINTF_FUNC(7, 8) int pw_context_debug_port_params(struct pw_context *this,
struct spa_node *node, enum spa_direction direction,
uint32_t port_id, uint32_t id, const char *debug, int err)
uint32_t port_id, uint32_t id, int err, const char *debug, ...)
{
struct spa_pod_builder b = { 0 };
uint8_t buffer[4096];
uint32_t state;
struct spa_pod *param;
int res;
va_list args;
pw_log_error("params %s: %d:%d (%s) %s",
va_start(args, debug);
vsnprintf(buffer, sizeof(buffer), debug, args);
va_end(args);
pw_log_error("params %s: %d:%d %s (%s)",
spa_debug_type_find_name(spa_type_param, id),
direction, port_id, debug, spa_strerror(err));
direction, port_id, spa_strerror(err), buffer);
if (err == -EBUSY)
return 0;
......
......@@ -330,11 +330,11 @@ static int do_negotiate(struct pw_impl_link *this)
error:
pw_context_debug_port_params(context, input->node->node, input->direction,
input->port_id, SPA_PARAM_EnumFormat,
"input format", res);
input->port_id, SPA_PARAM_EnumFormat, res,
"input format (%s)", error);
pw_context_debug_port_params(context, output->node->node, output->direction,
output->port_id, SPA_PARAM_EnumFormat,
"output format", res);
output->port_id, SPA_PARAM_EnumFormat, res,
"output format (%s)", error);
pw_impl_link_update_state(this, PW_LINK_STATE_ERROR, error);
free(format);
return res;
......
......@@ -988,7 +988,7 @@ pw_context_find_port(struct pw_context *context,
int pw_context_debug_port_params(struct pw_context *context,
struct spa_node *node, enum spa_direction direction,
uint32_t port_id, uint32_t id, const char *debug, int err);
uint32_t port_id, uint32_t id, int err, const char *debug, ...);
const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment