mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
the 'OSS hangs when opening the device when in use' bug.
Original commit message from CVS: Applied the patch from Sepp Wijnands <mrrazz@garbage-coderz.net> that solves the 'OSS hangs when opening the device when in use' bug.
This commit is contained in:
parent
c824d8eaf9
commit
8c54486378
2 changed files with 36 additions and 18 deletions
|
@ -27,6 +27,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
//#define DEBUG_ENABLED
|
||||
|
||||
|
@ -354,6 +355,14 @@ gst_audiosink_open_audio (GstAudioSink *sink)
|
|||
g_print ("audiosink: attempting to open sound device\n");
|
||||
|
||||
/* first try to open the sound card */
|
||||
sink->fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
|
||||
if (errno == EBUSY) {
|
||||
g_print ("audiosink: unable to open the sound device (in use ?)\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* re-open the sound device in blocking mode */
|
||||
close(sink->fd);
|
||||
sink->fd = open("/dev/dsp", O_WRONLY);
|
||||
|
||||
/* if we have it, set the default parameters and go have fun */
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <sys/soundcard.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
|
||||
//#define DEBUG_ENABLED
|
||||
|
||||
|
@ -354,6 +355,14 @@ gst_audiosink_open_audio (GstAudioSink *sink)
|
|||
g_print ("audiosink: attempting to open sound device\n");
|
||||
|
||||
/* first try to open the sound card */
|
||||
sink->fd = open("/dev/dsp", O_WRONLY | O_NONBLOCK);
|
||||
if (errno == EBUSY) {
|
||||
g_print ("audiosink: unable to open the sound device (in use ?)\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* re-open the sound device in blocking mode */
|
||||
close(sink->fd);
|
||||
sink->fd = open("/dev/dsp", O_WRONLY);
|
||||
|
||||
/* if we have it, set the default parameters and go have fun */
|
||||
|
|
Loading…
Reference in a new issue