aboutsummaryrefslogtreecommitdiffstats
path: root/src/audioOutputs/audioOutput_oss.c
diff options
context:
space:
mode:
authorWarren Dukes <warren.dukes@gmail.com>2005-04-06 22:52:42 +0000
committerWarren Dukes <warren.dukes@gmail.com>2005-04-06 22:52:42 +0000
commitdb20894b905de864470e7242bcafc1ee90ae3d98 (patch)
tree3c43d0a49d5c8c59c2480b52c16ef5a4ebe72a63 /src/audioOutputs/audioOutput_oss.c
parent9968e9f80c69aa1ebd761cecd302fc70a76ee9e3 (diff)
downloadmpd-db20894b905de864470e7242bcafc1ee90ae3d98.tar.gz
mpd-db20894b905de864470e7242bcafc1ee90ae3d98.tar.xz
mpd-db20894b905de864470e7242bcafc1ee90ae3d98.zip
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
Diffstat (limited to '')
-rw-r--r--src/audioOutputs/audioOutput_oss.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/audioOutputs/audioOutput_oss.c b/src/audioOutputs/audioOutput_oss.c
index 8fd2e3c9f..8681238a2 100644
--- a/src/audioOutputs/audioOutput_oss.c
+++ b/src/audioOutputs/audioOutput_oss.c
@@ -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;