alsa: do the right log level checks

spa_log_level_enabled does not work when a custom log level has
been set. Use spa_log_level_topic_enabled instead.
This commit is contained in:
Wim Taymans 2022-08-05 14:09:07 +02:00
parent 73073eb33f
commit 54b499b1cf
2 changed files with 4 additions and 4 deletions

View file

@ -954,7 +954,7 @@ skip_channels:
static void debug_hw_params(struct state *state, const char *prefix, snd_pcm_hw_params_t *params)
{
if (SPA_UNLIKELY(spa_log_level_enabled(state->log, SPA_LOG_LEVEL_DEBUG))) {
if (SPA_UNLIKELY(spa_log_level_topic_enabled(state->log, SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_DEBUG))) {
spa_log_debug(state->log, "%s:", prefix);
snd_pcm_hw_params_dump(params, state->output);
fflush(state->log_file);
@ -1620,7 +1620,7 @@ static int set_swparams(struct state *state)
/* write the parameters to the playback device */
CHECK(snd_pcm_sw_params(hndl, params), "sw_params");
if (SPA_UNLIKELY(spa_log_level_enabled(state->log, SPA_LOG_LEVEL_DEBUG))) {
if (SPA_UNLIKELY(spa_log_level_topic_enabled(state->log, SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_DEBUG))) {
spa_log_debug(state->log, "state after sw_params:");
snd_pcm_dump(hndl, state->output);
fflush(state->log_file);
@ -2413,7 +2413,7 @@ static void alsa_on_timeout_event(struct spa_source *source)
}
#ifndef FASTPATH
if (SPA_UNLIKELY(spa_log_level_enabled(state->log, SPA_LOG_LEVEL_TRACE))) {
if (SPA_UNLIKELY(spa_log_level_topic_enabled(state->log, SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_TRACE))) {
struct timespec now;
uint64_t nsec;
if (spa_system_clock_gettime(state->data_system, CLOCK_MONOTONIC, &now) < 0)

View file

@ -186,7 +186,7 @@ static void init_ports(struct seq_state *state)
static void debug_event(struct seq_state *state, snd_seq_event_t *ev)
{
if (SPA_LIKELY(!spa_log_level_enabled(state->log, SPA_LOG_LEVEL_TRACE)))
if (SPA_LIKELY(!spa_log_level_topic_enabled(state->log, SPA_LOG_TOPIC_DEFAULT, SPA_LOG_LEVEL_TRACE)))
return;
spa_log_trace(state->log, "event type:%d flags:0x%x", ev->type, ev->flags);