[MPlayer-cvslog] r23352 - trunk/libao2/ao_sun.c

reimar subversion at mplayerhq.hu
Sun May 20 14:05:16 CEST 2007


Author: reimar
Date: Sun May 20 14:05:16 2007
New Revision: 23352

Log:
Implement flushing of audio data. Fixes bug #754.
Based on patch by Sergey Svishchev (svs ropnet ru).


Modified:
   trunk/libao2/ao_sun.c

Modified: trunk/libao2/ao_sun.c
==============================================================================
--- trunk/libao2/ao_sun.c	(original)
+++ trunk/libao2/ao_sun.c	Sun May 20 14:05:16 2007
@@ -65,6 +65,13 @@ static enum {
 } enable_sample_timing;
 
 
+static void flush_audio(int fd) {
+#ifdef AUDIO_FLUSH
+  ioctl(fd, AUDIO_FLUSH, 0);
+#elif defined(__svr4__)
+  ioctl(fd, I_FLUSH, FLUSHW);
+#endif
+}
 
 // convert an OSS audio format specification into a sun audio encoding
 static int af2sunfmt(int format)
@@ -203,12 +210,9 @@ static int realtime_samplecounter_availa
 error:
     if (silence != NULL) free(silence);
     if (fd >= 0) {
-#ifdef	__svr4__
 	// remove the 0 bytes from the above measurement from the
 	// audio driver's STREAMS queue
-	ioctl(fd, I_FLUSH, FLUSHW);
-#endif
-	//ioctl(fd, AUDIO_DRAIN, 0);
+        flush_audio(fd);
 	close(fd);
     }
 
@@ -576,11 +580,9 @@ static int init(int rate,int channels,in
 
 // close audio device
 static void uninit(int immed){
-#ifdef	__svr4__
     // throw away buffered data in the audio driver's STREAMS queue
     if (immed)
-	ioctl(audio_fd, I_FLUSH, FLUSHW);
-#endif
+	flush_audio(audio_fd);
     close(audio_fd);
 }
 



More information about the MPlayer-cvslog mailing list