diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-20 12:05:16 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2007-05-20 12:05:16 +0000 |
commit | 31a82e6b0e1f3536aa3c6bd362b15281021c0f89 (patch) | |
tree | df89b8e74cf26b709c2e5d4d37ce4bff48ee6abf | |
parent | 3d8bc9fbc169c366d1e41c0842a0713ba287ab0d (diff) |
Implement flushing of audio data. Fixes bug #754.
Based on patch by Sergey Svishchev (svs ropnet ru).
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23352 b3059339-0415-0410-9bf9-f77b7e298cf2
-rw-r--r-- | libao2/ao_sun.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/libao2/ao_sun.c b/libao2/ao_sun.c index 75d5d383af..44c2bef7b1 100644 --- a/libao2/ao_sun.c +++ b/libao2/ao_sun.c @@ -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_available(char *dev) 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,int format,int flags){ // 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); } |