mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2026-03-19 05:33:49 -04:00
channelmix: improve debug
Instead of printing lines and lines of numbers, format everything as a matrix. Only do the work when debug is enabled.
This commit is contained in:
parent
a2df282086
commit
494d727108
1 changed files with 25 additions and 2 deletions
|
|
@ -825,7 +825,6 @@ static void impl_channelmix_set_volume(struct channelmix *mix, float volume, boo
|
|||
for (i = 0; i < dst_chan; i++) {
|
||||
for (j = 0; j < src_chan; j++) {
|
||||
float v = mix->matrix[i][j];
|
||||
spa_log_debug(mix->log, "%d %d: %f", i, j, v);
|
||||
if (i == 0 && j == 0)
|
||||
t = v;
|
||||
else if (t != v)
|
||||
|
|
@ -840,7 +839,31 @@ static void impl_channelmix_set_volume(struct channelmix *mix, float volume, boo
|
|||
SPA_FLAG_UPDATE(mix->flags, CHANNELMIX_FLAG_IDENTITY,
|
||||
dst_chan == src_chan && SPA_FLAG_IS_SET(mix->flags, CHANNELMIX_FLAG_COPY));
|
||||
|
||||
spa_log_debug(mix->log, "flags:%08x", mix->flags);
|
||||
if (SPA_UNLIKELY(spa_log_level_topic_enabled(mix->log,
|
||||
SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_DEBUG))) {
|
||||
char str1[1024], str2[1024];
|
||||
struct spa_strbuf sb1, sb2;
|
||||
spa_strbuf_init(&sb2, str2, sizeof(str2));
|
||||
for (i = 0; i < dst_chan; i++) {
|
||||
spa_strbuf_init(&sb1, str1, sizeof(str1));
|
||||
for (j = 0; j < src_chan; j++) {
|
||||
float v = mix->matrix[i][j];
|
||||
if (i == 0)
|
||||
spa_strbuf_append(&sb2, " %03d ", j);
|
||||
if (v == 0.0f)
|
||||
spa_strbuf_append(&sb1, " ");
|
||||
else
|
||||
spa_strbuf_append(&sb1, "%1.3f ", v);
|
||||
}
|
||||
if (i == 0 && sb2.pos > 0)
|
||||
spa_log_debug(mix->log, " %s", str2);
|
||||
if (sb1.pos > 0)
|
||||
spa_log_debug(mix->log, "%03d %s %03d", i, str1, i);
|
||||
}
|
||||
if (sb2.pos > 0)
|
||||
spa_log_debug(mix->log, " %s", str2);
|
||||
spa_log_debug(mix->log, "flags:%08x", mix->flags);
|
||||
}
|
||||
}
|
||||
|
||||
static void impl_channelmix_free(struct channelmix *mix)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue