mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-11-03 09:01:54 -05:00
pulse-server: add debug level to message_dump
This commit is contained in:
parent
f818da96fc
commit
11a57c9302
2 changed files with 27 additions and 27 deletions
|
|
@ -650,12 +650,12 @@ static int message_put(struct message *m, ...)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int message_dump(struct message *m)
|
||||
static int message_dump(enum spa_log_level level, struct message *m)
|
||||
{
|
||||
int res;
|
||||
uint32_t i, offset = m->offset, o;
|
||||
|
||||
pw_log_debug("message: len:%d alloc:%u", m->length, m->allocated);
|
||||
pw_log(level, "message: len:%d alloc:%u", m->length, m->allocated);
|
||||
while (true) {
|
||||
uint8_t tag;
|
||||
|
||||
|
|
@ -669,18 +669,18 @@ static int message_dump(struct message *m)
|
|||
char *val;
|
||||
if ((res = read_string(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: string: '%s'", o, val);
|
||||
pw_log(level, "%u: string: '%s'", o, val);
|
||||
break;
|
||||
}
|
||||
case TAG_STRING_NULL:
|
||||
pw_log_debug("%u: string: NULL", o);
|
||||
pw_log(level, "%u: string: NULL", o);
|
||||
break;
|
||||
case TAG_U8:
|
||||
{
|
||||
uint8_t val;
|
||||
if ((res = read_u8(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: u8: %u", o, val);
|
||||
pw_log(level, "%u: u8: %u", o, val);
|
||||
break;
|
||||
}
|
||||
case TAG_U32:
|
||||
|
|
@ -688,7 +688,7 @@ static int message_dump(struct message *m)
|
|||
uint32_t val;
|
||||
if ((res = read_u32(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: u32: %u", o, val);
|
||||
pw_log(level, "%u: u32: %u", o, val);
|
||||
break;
|
||||
}
|
||||
case TAG_S64:
|
||||
|
|
@ -696,7 +696,7 @@ static int message_dump(struct message *m)
|
|||
uint64_t val;
|
||||
if ((res = read_u64(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: s64: %"PRIi64"", o, (int64_t)val);
|
||||
pw_log(level, "%u: s64: %"PRIi64"", o, (int64_t)val);
|
||||
break;
|
||||
}
|
||||
case TAG_U64:
|
||||
|
|
@ -704,7 +704,7 @@ static int message_dump(struct message *m)
|
|||
uint64_t val;
|
||||
if ((res = read_u64(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: u64: %"PRIu64"", o, val);
|
||||
pw_log(level, "%u: u64: %"PRIu64"", o, val);
|
||||
break;
|
||||
}
|
||||
case TAG_USEC:
|
||||
|
|
@ -712,7 +712,7 @@ static int message_dump(struct message *m)
|
|||
uint64_t val;
|
||||
if ((res = read_u64(m, &val)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: u64: %"PRIu64"", o, val);
|
||||
pw_log(level, "%u: u64: %"PRIu64"", o, val);
|
||||
break;
|
||||
}
|
||||
case TAG_SAMPLE_SPEC:
|
||||
|
|
@ -720,7 +720,7 @@ static int message_dump(struct message *m)
|
|||
struct sample_spec ss;
|
||||
if ((res = read_sample_spec(m, &ss)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: ss: format:%s rate:%d channels:%u", o,
|
||||
pw_log(level, "%u: ss: format:%s rate:%d channels:%u", o,
|
||||
format_pa2name(ss.format), ss.rate,
|
||||
ss.channels);
|
||||
break;
|
||||
|
|
@ -735,17 +735,17 @@ static int message_dump(struct message *m)
|
|||
break;
|
||||
}
|
||||
case TAG_BOOLEAN_TRUE:
|
||||
pw_log_debug("%u: bool: true", o);
|
||||
pw_log(level, "%u: bool: true", o);
|
||||
break;
|
||||
case TAG_BOOLEAN_FALSE:
|
||||
pw_log_debug("%u: bool: false", o);
|
||||
pw_log(level, "%u: bool: false", o);
|
||||
break;
|
||||
case TAG_TIMEVAL:
|
||||
{
|
||||
struct timeval tv;
|
||||
if ((res = read_timeval(m, &tv)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: timeval: %lu:%lu", o, tv.tv_sec, tv.tv_usec);
|
||||
pw_log(level, "%u: timeval: %lu:%lu", o, tv.tv_sec, tv.tv_usec);
|
||||
break;
|
||||
}
|
||||
case TAG_CHANNEL_MAP:
|
||||
|
|
@ -753,9 +753,9 @@ static int message_dump(struct message *m)
|
|||
struct channel_map map;
|
||||
if ((res = read_channel_map(m, &map)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: channelmap: channels:%u", o, map.channels);
|
||||
pw_log(level, "%u: channelmap: channels:%u", o, map.channels);
|
||||
for (i = 0; i < map.channels; i++)
|
||||
pw_log_debug(" %d: %s", i, channel_pa2name(map.map[i]));
|
||||
pw_log(level, " %d: %s", i, channel_pa2name(map.map[i]));
|
||||
break;
|
||||
}
|
||||
case TAG_CVOLUME:
|
||||
|
|
@ -763,9 +763,9 @@ static int message_dump(struct message *m)
|
|||
struct volume vol;
|
||||
if ((res = read_cvolume(m, &vol)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: cvolume: channels:%u", o, vol.channels);
|
||||
pw_log(level, "%u: cvolume: channels:%u", o, vol.channels);
|
||||
for (i = 0; i < vol.channels; i++)
|
||||
pw_log_debug(" %d: %f", i, vol.values[i]);
|
||||
pw_log(level, " %d: %f", i, vol.values[i]);
|
||||
break;
|
||||
}
|
||||
case TAG_PROPLIST:
|
||||
|
|
@ -774,9 +774,9 @@ static int message_dump(struct message *m)
|
|||
const struct spa_dict_item *it;
|
||||
if ((res = read_props(m, props)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: props: n_items:%u", o, props->dict.n_items);
|
||||
pw_log(level, "%u: props: n_items:%u", o, props->dict.n_items);
|
||||
spa_dict_for_each(it, &props->dict)
|
||||
pw_log_debug(" '%s': '%s'", it->key, it->value);
|
||||
pw_log(level, " '%s': '%s'", it->key, it->value);
|
||||
pw_properties_free(props);
|
||||
break;
|
||||
}
|
||||
|
|
@ -785,7 +785,7 @@ static int message_dump(struct message *m)
|
|||
float vol;
|
||||
if ((res = read_volume(m, &vol)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: volume: %f", o, vol);
|
||||
pw_log(level, "%u: volume: %f", o, vol);
|
||||
break;
|
||||
}
|
||||
case TAG_FORMAT_INFO:
|
||||
|
|
@ -794,9 +794,9 @@ static int message_dump(struct message *m)
|
|||
const struct spa_dict_item *it;
|
||||
if ((res = read_format_info(m, &info)) < 0)
|
||||
return res;
|
||||
pw_log_debug("%u: format-info: n_items:%u", o, info.props->dict.n_items);
|
||||
pw_log(level, "%u: format-info: n_items:%u", o, info.props->dict.n_items);
|
||||
spa_dict_for_each(it, &info.props->dict)
|
||||
pw_log_debug(" '%s': '%s'", it->key, it->value);
|
||||
pw_log(level, " '%s': '%s'", it->key, it->value);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -326,7 +326,7 @@ static int flush_messages(struct client *client)
|
|||
size = m->length - idx;
|
||||
} else {
|
||||
if (debug_messages)
|
||||
message_dump(m);
|
||||
message_dump(SPA_LOG_LEVEL_INFO, m);
|
||||
message_free(client, m, true, false);
|
||||
client->out_index = 0;
|
||||
continue;
|
||||
|
|
@ -4005,7 +4005,7 @@ static int do_update_stream_sample_rate(struct client *client, uint32_t command,
|
|||
TAG_INVALID)) < 0)
|
||||
return -EPROTO;
|
||||
|
||||
pw_log_info(NAME" %p: [%s %s tag:%u channel:%u rate:%u", impl, client->name,
|
||||
pw_log_info(NAME" %p: [%s] %s tag:%u channel:%u rate:%u", impl, client->name,
|
||||
commands[command].name, tag, channel, rate);
|
||||
|
||||
stream = pw_map_lookup(&client->streams, channel);
|
||||
|
|
@ -4038,7 +4038,7 @@ static int do_set_profile(struct client *client, uint32_t command, uint32_t tag,
|
|||
TAG_INVALID)) < 0)
|
||||
return -EPROTO;
|
||||
|
||||
pw_log_info(NAME" %p: [%s %s tag:%u id:%u name:%s profile:%s", impl, client->name,
|
||||
pw_log_info(NAME" %p: [%s] %s tag:%u id:%u name:%s profile:%s", impl, client->name,
|
||||
commands[command].name, tag, sel.id, sel.value, profile_name);
|
||||
|
||||
if ((sel.id == SPA_ID_INVALID && sel.value == NULL) ||
|
||||
|
|
@ -4082,7 +4082,7 @@ static int do_set_default(struct client *client, uint32_t command, uint32_t tag,
|
|||
if (name == NULL)
|
||||
return -EINVAL;
|
||||
|
||||
pw_log_info(NAME" %p: [%s ] %s tag:%u name:%s", impl, client->name,
|
||||
pw_log_info(NAME" %p: [%s] %s tag:%u name:%s", impl, client->name,
|
||||
commands[command].name, tag, name);
|
||||
|
||||
if ((o = find_device(client, SPA_ID_INVALID, name, sink)) == NULL)
|
||||
|
|
@ -4534,7 +4534,7 @@ static int handle_packet(struct client *client, struct message *msg)
|
|||
|
||||
if (debug_messages) {
|
||||
pw_log_debug(NAME" %p: command %s", impl, commands[command].name);
|
||||
message_dump(msg);
|
||||
message_dump(SPA_LOG_LEVEL_INFO, msg);
|
||||
}
|
||||
|
||||
if (commands[command].run == NULL) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue