improve debug

Improve log so that debug level 3 gives a reasonably readable overview
of what is going on.
This commit is contained in:
Wim Taymans 2020-04-22 12:47:18 +02:00
parent 8ab67c5fa0
commit aafd1e7298
33 changed files with 141 additions and 125 deletions

View file

@ -28,7 +28,7 @@ static int spa_alsa_open(struct state *state)
CHECK(snd_output_stdio_attach(&state->output, stderr, 0), "attach failed");
spa_log_info(state->log, NAME" %p: ALSA device open '%s' %s", state, props->device,
spa_log_debug(state->log, NAME" %p: ALSA device open '%s' %s", state, props->device,
state->stream == SND_PCM_STREAM_CAPTURE ? "capture" : "playback");
CHECK(snd_pcm_open(&state->hndl,
props->device,
@ -71,7 +71,7 @@ int spa_alsa_close(struct state *state)
if (!state->opened)
return 0;
spa_log_info(state->log, NAME" %p: Device '%s' closing", state, state->props.device);
spa_log_debug(state->log, NAME" %p: Device '%s' closing", state, state->props.device);
CHECK(snd_pcm_close(state->hndl), "close failed");
spa_system_close(state->data_system, state->timerfd);
@ -429,7 +429,7 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
return -EINVAL;
}
spa_log_info(state->log, NAME" %p: Stream parameters are %iHz, %s, %i channels",
spa_log_debug(state->log, NAME" %p: Stream parameters are %iHz, %s, %i channels",
state, info->rate, snd_pcm_format_name(format), info->channels);
CHECK(snd_pcm_hw_params_set_format(hndl, params, format), "set_format");
@ -470,9 +470,10 @@ int spa_alsa_set_format(struct state *state, struct spa_audio_info *fmt, uint32_
state->period_frames = period_size;
periods = state->buffer_frames / state->period_frames;
spa_log_info(state->log, NAME" %p: buffer frames %lu, period frames %lu, periods %u, frame_size %zd",
state, state->buffer_frames, state->period_frames,
periods, state->frame_size);
spa_log_info(state->log, NAME" %p: format:%s rate:%d channels:%d "
"buffer frames %lu, period frames %lu, periods %u, frame_size %zd",
state, snd_pcm_format_name(state->format), state->rate, state->channels,
state->buffer_frames, state->period_frames, periods, state->frame_size);
/* write the parameters to device */
CHECK(snd_pcm_hw_params(hndl, params), "set_hw_params");