Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 May 2004 17:38:29 +0300 (EEST)
From:      Andriy Gapon <avg@icyb.net.ua>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/67179: multimedia/mplayer: dsp device is owned by xscreensaver after pausing mplayer
Message-ID:  <200405251438.i4PEcTPA006458@oddity.topspin.kiev.ua>
Resent-Message-ID: <200405251440.i4PEePwe019181@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         67179
>Category:       ports
>Synopsis:       multimedia/mplayer: dsp device is owned by xscreensaver after pausing mplayer
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue May 25 07:40:25 PDT 2004
>Closed-Date:
>Last-Modified:
>Originator:     Andriy Gapon
>Release:        FreeBSD 5.2.1-RELEASE-p4 i386
>Organization:
>Environment:
System: FreeBSD 5.2.1-RELEASE-p4 Fri Apr 2 20:05:58 EEST 2004 i386


	
>Description:
if mplayer uses OSS (/dev/dsp*) for audio output and is run with -stop_xscreensaver option
and user pauses playback, then after mplayer exits the audio device used ends up being
owned by xscreensaver process, thus preventing it from being iactually used.
This happens because mplayer closes dsp device when it is paused and re-opens dsp when it is
unpaused, but it fails to set FD_CLOEXEC flag on re-open. So, when mplayer quits it restarts
xscreensaver and it inherets dsp device among other open descriptors.
I have submitted the patch attached to mplayer development mailing list quite a while ago,
but it seems to have been overlooked for some reason.

>How-To-Repeat:
1. run xscreensaver
2. run mplayer with -ao oss and -stop_xscreensaver
3. pause mplayer
4. unpause mplayer and exit from it
5. run mplayer again
6. there will be no audio output and mplayer woould complain that dsp device is already
in use

>Fix:

--- dsp-patch begins here ---
--- libao2/ao_oss.c.orig	Sun Jul 27 13:41:36 2003
+++ libao2/ao_oss.c	Sun Jul 27 13:49:37 2003
@@ -247,7 +247,11 @@
 	mp_msg(MSGT_AO,MSGL_ERR,"\nFatal error: *** CANNOT RE-OPEN / RESET AUDIO DEVICE *** %s\n", strerror(errno));
 	return;
     }
-
+    
+#if defined(FD_CLOEXEC) && defined(F_SETFD)
+  fcntl(audio_fd, F_SETFD, FD_CLOEXEC);
+#endif
+  
   ioctl (audio_fd, SNDCTL_DSP_SETFMT, &ao_data.format);
   if(ao_data.format != AFMT_AC3) {
     if (ao_data.channels > 2)
--- dsp-patch ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200405251438.i4PEcTPA006458>