fix OSS audioOutput plugin, so that when dropAudioBuffer is called and the oss device is closed, a subsequent call to playAudio will reopen the device

git-svn-id: https://svn.musicpd.org/mpd/trunk@3198 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Warren Dukes 2005-04-06 22:52:42 +00:00
parent 9968e9f80c
commit db20894b90

View File

@ -489,13 +489,15 @@ static int oss_openDevice(AudioOutput * audioOutput)
return ret;
}
static void oss_close(OssData * od) {
if(od->fd >= 0) close(od->fd);
od->fd = -1;
}
static void oss_closeDevice(AudioOutput * audioOutput) {
OssData * od = audioOutput->data;
if(od->fd >= 0) {
close(od->fd);
od->fd = -1;
}
oss_close(od);
audioOutput->open = 0;
}
@ -505,7 +507,7 @@ static void oss_dropBufferedAudio(AudioOutput * audioOutput) {
if(od->fd >= 0) {
ioctl(od->fd, SNDCTL_DSP_RESET, 0);
oss_closeDevice(audioOutput);
oss_close(od);
}
/*oss_open(audioOutput);*/
@ -517,6 +519,9 @@ static int oss_playAudio(AudioOutput * audioOutput, char * playChunk,
OssData * od = audioOutput->data;
int ret;
/* reopen the device since it was closed by dropBufferedAudio */
if(od->fd < 0) oss_open(audioOutput);
while (size > 0) {
ret = write(od->fd, playChunk, size);
if(errno == EINTR) continue;