Commit db20894b authored by Warren Dukes's avatar Warren Dukes

fix OSS audioOutput plugin, so that when dropAudioBuffer is called and the oss…

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
parent 9968e9f8
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment