diff options
author | Eric Wong <normalperson@yhbt.net> | 2008-09-08 03:40:29 -0700 |
---|---|---|
committer | Eric Wong <normalperson@yhbt.net> | 2008-09-08 04:11:17 -0700 |
commit | 92451cbdf0cbfd8c27daf3792e1a1cb68def91fc (patch) | |
tree | e441dc62db881adb74a53013fb5241a3fa05ecda | |
parent | a50361f768f82480e608c3e56e2c47a7030bb705 (diff) | |
download | mpd-92451cbdf0cbfd8c27daf3792e1a1cb68def91fc.tar.gz mpd-92451cbdf0cbfd8c27daf3792e1a1cb68def91fc.tar.xz mpd-92451cbdf0cbfd8c27daf3792e1a1cb68def91fc.zip |
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.
-rw-r--r-- | src/audioOutputs/audioOutput_alsa.c | 24 |
1 files changed, 14 insertions, 10 deletions
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) |