[MPlayer-dev-eng] [PATCH] ao_oss: keep audio fd closed during pause

Eric Lammerts eric at lammerts.org
Sat Jun 15 22:00:00 CEST 2002


Hi,
About the OSS audio driver: I noticed that when audio_pause() is called, it
closes the audio_fd and immediately reopens it. Then, it does nothing with
it until audio_resume() is called. Is there a point in this behavior? If
not, please apply this patch that moves the reopening to audio_resume().

Eric

Index: libao2/ao_oss.c
===================================================================
RCS file: /cvsroot/mplayer/main/libao2/ao_oss.c,v
retrieving revision 1.26
diff -u -r1.26 ao_oss.c
--- libao2/ao_oss.c	3 Jun 2002 23:23:03 -0000	1.26
+++ libao2/ao_oss.c	15 Jun 2002 19:53:38 -0000
@@ -219,10 +219,12 @@
 
 // close audio device
 static void uninit(){
+    if(audio_fd == -1) return;
 #ifdef SNDCTL_DSP_RESET
     ioctl(audio_fd, SNDCTL_DSP_RESET, NULL);
 #endif
     close(audio_fd);
+    audio_fd = -1;
 }
 
 // stop playing and empty buffers (for seeking/pause)
@@ -249,13 +251,13 @@
 // stop playing, keep buffers (for pause)
 static void audio_pause()
 {
-    // for now, just call reset();
-    reset();
+    uninit();
 }
 
 // resume playing, after audio_pause()
 static void audio_resume()
 {
+    reset();
 }
 
 



More information about the MPlayer-dev-eng mailing list