[PATCH] Free OSS device on pause (try2)

"Metathronius Galabant" <[email protected]> Fri, 13 Oct 2006 22:50:27 +0200
Newsgroups gmane.comp.multimedia.xmms.devel
Message-ID <[email protected]>
Okay, that's another try. I wasn't getting the point Peter was aiming at.
Please see the following. The double close() has gone. I think it's
quite safe now.


diff -ru xmms-1.2.10/Output/OSS/audio.c xmms-1.2.10-f/Output/OSS/audio.c
--- xmms-1.2.10/Output/OSS/audio.c      2003-05-19 23:22:06.000000000 +0200
+++ xmms-1.2.10-f/Output/OSS/audio.c    2006-10-13 22:48:13.000000000 +0200
@@ -562,13 +562,14 @@
                         * We lose some data here that is sent to the
                         * soundcard, but not yet played.  I don't
                         * think this is worth fixing.
+                         * Close to free the device for others.
                         */
                        ioctl(fd, SNDCTL_DSP_RESET, 0);
+                        close(fd);
                }
                else if (unpause && paused)
                {
                        unpause = FALSE;
-                       close(fd);
                        fd = open(device_name, O_WRONLY);
                        oss_set_audio_params();
                        paused = FALSE;