[MPlayer-dev-eng] FD_CLOEXEC patch for libao2/ao_oss.c
Andriy Gapon
agapon at cv-nj.com
Mon Aug 11 19:33:43 CEST 2003
It seems that in ao_oss.c init() and reset() are a little bit out of sync with
respect to the way of open()-ing dsp device. Probably this functionality
should be put in a separate function called from the both places.
Meanwile, here's a tiny patch for setting FD_CLOEXEC flag on dsp fd. This
should help with a problem observed on FreeBSD at least, when xscreensaver
ends up owning dsp device if -stop_xscreensaver option is used and a user
seeked through or paused a playback.
--- 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)
--
Andriy Gapon
More information about the MPlayer-dev-eng
mailing list