From 92451cbdf0cbfd8c27daf3792e1a1cb68def91fc Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 8 Sep 2008 03:40:29 -0700 Subject: alsa: show more debugging information Print out {buffer,period}_{size,time}. Not sure if this is going to help. I've been searching everywhere looking for a possible clue as to what's causing the high CPU usage problems... Also, add device information to some messages I missed earlier. --- src/audioOutputs/audioOutput_alsa.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) (limited to 'src') diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c index 831721080..1f6d75d9d 100644 --- a/src/audioOutputs/audioOutput_alsa.c +++ b/src/audioOutputs/audioOutput_alsa.c @@ -159,8 +159,8 @@ static int alsa_openDevice(AudioOutput * audioOutput) snd_pcm_sw_params_t *swparams; unsigned int sampleRate = audioFormat->sampleRate; unsigned int channels = audioFormat->channels; - snd_pcm_uframes_t alsa_buffer_size; - snd_pcm_uframes_t alsa_period_size; + snd_pcm_uframes_t buffer_size; + snd_pcm_uframes_t period_size; int err; const char *err_cmd = NULL; int retry = MPD_ALSA_RETRY_NR; @@ -245,14 +245,17 @@ configure_hw: } else if (err < 0) goto error; - DEBUG("ALSA period_time set to %d\n", period_time); + DEBUG("ALSA(%s) period_time: %u, buffer_time: %u\n", + ad->device, period_time, buffer_time); if ((err = E(snd_pcm_hw_params_get_buffer_size, hwparams, - &alsa_buffer_size)) < 0) + &buffer_size)) < 0) goto error; if ((err = E(snd_pcm_hw_params_get_period_size, hwparams, - &alsa_period_size, NULL)) < 0) + &period_size, NULL)) < 0) goto error; + DEBUG("ALSA(%s) period_size: %lu buffer_size: %lu\n", + ad->device, period_size, buffer_size); /* configure SW params */ snd_pcm_sw_params_alloca(&swparams); @@ -260,10 +263,10 @@ configure_hw: if ((err = E(snd_pcm_sw_params_current, ad->pcmHandle, swparams)) < 0) goto error; if ((err = E(snd_pcm_sw_params_set_start_threshold, ad->pcmHandle, - swparams, alsa_buffer_size - alsa_period_size)) < 0) + swparams, buffer_size - period_size)) < 0) goto error; if ((err = E(snd_pcm_sw_params_set_avail_min, ad->pcmHandle, - swparams, alsa_period_size)) < 0) + swparams, period_size)) < 0) goto error; if ((err = E(snd_pcm_sw_params, ad->pcmHandle, swparams)) < 0) goto error; @@ -319,13 +322,14 @@ static int alsa_errorRecovery(AlsaData * ad, int err) /* this is no error, so just keep running */ case SND_PCM_STATE_RUNNING: if (mpd_unlikely(err)) { - DEBUG("ALSA: ignoring possible error: %s\n", - snd_strerror(-err)); + DEBUG("ALSA(%s) ignoring possible error: %s\n", + ad->device, snd_strerror(-err)); err = 0; } break; default: - DEBUG("ALSA in unknown state: %s\n", snd_pcm_state_name(state)); + DEBUG("ALSA device \"%s\" in unknown state: %s\n", + ad->device, snd_pcm_state_name(state)); break; } if (err && err_cmd) -- cgit v1.2.3