From b53cc6feb8a270e90864f4267fb682ef34996b10 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Fri, 8 May 2020 12:13:59 +0200 Subject: [PATCH] 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. --- spa/plugins/alsa/alsa-pcm.c | 8 +++++--- src/pipewire/impl-node.c | 13 ++++++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/spa/plugins/alsa/alsa-pcm.c b/spa/plugins/alsa/alsa-pcm.c index e122cd4ff..c3c170abe 100644 --- a/spa/plugins/alsa/alsa-pcm.c +++ b/spa/plugins/alsa/alsa-pcm.c @@ -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, diff --git a/src/pipewire/impl-node.c b/src/pipewire/impl-node.c index 98ab10bb5..2482c0c6c 100644 --- a/src/pipewire/impl-node.c +++ b/src/pipewire/impl-node.c @@ -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);