aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2008-10-11 12:47:20 +0200
committerMax Kellermann <max@duempel.org>2008-10-11 12:47:20 +0200
commitbcc443a8aa6899de79d2c5a01528afbe1fa52db8 (patch)
treeac77df45e7fac2f9866a48fe4473b0656f1afd74
parent215d8aa8f6e83d2dd89e185ce52a262413a7dfe0 (diff)
downloadmpd-bcc443a8aa6899de79d2c5a01528afbe1fa52db8.tar.gz
mpd-bcc443a8aa6899de79d2c5a01528afbe1fa52db8.tar.xz
mpd-bcc443a8aa6899de79d2c5a01528afbe1fa52db8.zip
alsa: re-enable blocking mode
Revert e4f5d6bd "re-enable-nonblocking, but sleep if busy". Non-blocking mode with manual sleeping doesn't help at all (by the way, the patch should have used snd_pcm_wait() instead of my_usleep()). ALSA knows much more about the hardware quirks, so we just let it do the job.
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_alsa.c17
1 files changed, 2 insertions, 15 deletions
diff --git a/src/audioOutputs/audioOutput_alsa.c b/src/audioOutputs/audioOutput_alsa.c
index 9d47ff244..52603cc62 100644
--- a/src/audioOutputs/audioOutput_alsa.c
+++ b/src/audioOutputs/audioOutput_alsa.c
@@ -46,7 +46,6 @@ typedef struct _AlsaData {
alsa_writei_t *writei;
unsigned int buffer_time;
unsigned int period_time;
- unsigned int period_sleep;
int sampleSize;
int useMmap;
} AlsaData;
@@ -157,17 +156,12 @@ static int alsa_openDevice(void *data, struct audio_format *audioFormat)
ad->device, audioFormat->bits);
err = snd_pcm_open(&ad->pcmHandle, ad->device,
- SND_PCM_STREAM_PLAYBACK, SND_PCM_NONBLOCK);
+ SND_PCM_STREAM_PLAYBACK, 0);
if (err < 0) {
ad->pcmHandle = NULL;
goto error;
}
- cmd = "snd_pcm_nonblock";
- err = snd_pcm_nonblock(ad->pcmHandle, 0);
- if (err < 0)
- goto error;
-
period_time_ro = period_time = ad->period_time;
configure_hw:
/* configure HW params */
@@ -249,8 +243,6 @@ configure_hw:
if (retry != MPD_ALSA_RETRY_NR)
DEBUG("ALSA period_time set to %d\n", period_time);
- ad->period_sleep = period_time >> 1;
-
cmd = "snd_pcm_hw_params_get_buffer_size";
err = snd_pcm_hw_params_get_buffer_size(hwparams, &alsa_buffer_size);
if (err < 0)
@@ -379,12 +371,7 @@ static int alsa_playAudio(void *data, const char *playChunk, size_t size)
while (size > 0) {
ret = ad->writei(ad->pcmHandle, playChunk, size);
- if (ret == -EAGAIN) {
- DEBUG("ALSA busy, sleeping %d\n", ad->period_sleep);
- my_usleep(ad->period_sleep);
- continue;
- }
- if (ret == -EINTR)
+ if (ret == -EAGAIN || ret == -EINTR)
continue;
if (ret < 0) {