improve debug

Log device name and stream direction
Don't log xrun errors in alsa, we signal the xrun signal, which should
take care of logging if any.
Log quantum in xrun.
ratelimit xrun messages.
This commit is contained in:
Wim Taymans 2020-05-08 12:13:59 +02:00
parent be8263208d
commit b53cc6feb8
2 changed files with 13 additions and 8 deletions

View file

@ -470,9 +470,11 @@ 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: format:%s rate:%d channels:%d "
spa_log_info(state->log, NAME" %s (%s): 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->props.device,
state->stream == SND_PCM_STREAM_CAPTURE ? "capture" : "playback",
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 */
@ -566,7 +568,7 @@ static int alsa_recover(struct state *state, int err)
delay = SPA_TIMEVAL_TO_USEC(&diff);
missing = delay * state->rate / SPA_USEC_PER_SEC;
spa_log_error(state->log, NAME" %p: xrun of %"PRIu64" usec %"PRIu64" %f",
spa_log_trace(state->log, NAME" %p: xrun of %"PRIu64" usec %"PRIu64" %f",
state, delay, missing, state->safety);
spa_node_call_xrun(&state->callbacks,

View file

@ -1363,9 +1363,10 @@ static int node_ready(void *data, int status)
if (SPA_UNLIKELY(state->pending > 0)) {
pw_context_driver_emit_incomplete(node->context, node);
if (ratelimit_test(&node->rt.rate_limit, a->signal_time)) {
pw_log_warn("(%s-%u) graph not finished: state:%p pending %d/%d",
node->name, node->info.id, state, state->pending,
state->required);
pw_log_warn("(%s-%u) graph not finished: state:%p quantum:%"PRIu64
" pending %d/%d", node->name, node->info.id,
state, a->position.clock.duration,
state->pending, state->required);
dump_states(node);
}
node->rt.target.signal(node->rt.target.data);
@ -1449,8 +1450,10 @@ static int node_xrun(void *data, uint64_t trigger, uint64_t delay, struct spa_po
a->xrun_delay = delay;
a->max_delay = SPA_MAX(a->max_delay, delay);
pw_log_debug(NAME" %p: XRun! count:%u time:%"PRIu64" delay:%"PRIu64" max:%"PRIu64,
this, a->xrun_count, trigger, delay, a->max_delay);
if (ratelimit_test(&this->rt.rate_limit, a->signal_time)) {
pw_log_error(NAME" %p: XRun! count:%u time:%"PRIu64" delay:%"PRIu64" max:%"PRIu64,
this, a->xrun_count, trigger, delay, a->max_delay);
}
pw_context_driver_emit_xrun(this->context, this);