After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 94429 - gst_osssink_open_audio fails to open when blocked
gst_osssink_open_audio fails to open when blocked
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
0.4.1
Other Linux
: Normal major
: 0.4.0
Assigned To: Wim Taymans
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2002-09-28 17:35 UTC by Mark Humphreys
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Mark Humphreys 2002-09-28 17:35:09 UTC
Actually found this when testing 'rhythmbox'. The osssink fails to open
with the error "osssink: unable to open the sound device (in use ?)".
Looked at the code for 'gst_osssink_open_audio' in
'gst-plugins/sys/oss/gstosssink.c'. When the call to open the device with
O_NONBLOCK fails, the function returns false. Should it not try and open
the device in blocking mode? If the device has already been opened, which
it always has on my installation, this call with always fail. So the code ..

sink->fd = open (sink->device, O_WRONLY | O_NONBLOCK);
  if (errno == EBUSY) {
    g_warning ("osssink: unable to open the sound device (in use ?)\n");
    return FALSE;
  }

... could be replaced with ...

sink->fd = open (sink->device, O_WRONLY | O_NONBLOCK);
  if (errno == EBUSY) {
    g_warning ("osssink: unable to open the sound device (in use ?)\n");
  }

... and the rest of the function will be executed. I've tested it and it
works for me!
Comment 1 Thomas Vander Stichele 2002-09-30 07:43:03 UTC
patch looks good.  Wim, any reason not to commit this fix ?
Comment 2 Christian Fredrik Kalager Schaller 2002-10-07 21:14:40 UTC
Mark,
Wim is a bit unsure what this patch is meant to do. Could you please
explain what problem it solved. It seems to ignore the return code, but
we are not sure why you think it is a good idea to ignore errors.
Comment 3 Mark Humphreys 2002-10-07 22:26:57 UTC
This is from my testing of rhytmbox. 
The function as is ALWAYS fails to open the device with O_NONBLOCK
(with EBUSY as it is already open), and then simply returns failure. 
The patch is to try to open O_NONBLOCK, and then open without it (if
it fails),  rather than simply returning failure after the first open.
The error is not ignored, but the rest of the code in the function
actually gets called.
My installation of rhythmbox (which uses osssink via monkey-media)
simply doesn't make a sound without this change.
Comment 4 Wim Taymans 2002-10-07 22:33:15 UTC
ok, that makes perfect sense, will patch soon.
Comment 5 Christian Fredrik Kalager Schaller 2002-11-21 14:42:20 UTC
Is this applied now? Can I close this bug?
Comment 6 Mark Humphreys 2002-11-21 17:18:37 UTC
It wasn't applied in the latest stable version, and I cannot see the
change in CVS, so I'm guessing its fallen by the way side. Change is
still required to get OSS to work with mm/rb.

Comment 7 Christian Fredrik Kalager Schaller 2002-11-24 12:31:27 UTC
Patch should now be applied to cvs. closing. thanks a lot