GNOME Bugzilla – Bug 687845
filesrc: leaks file descriptor if activation in pull mode fails
Last modified: 2012-12-14 14:39:39 UTC
Using the following pipeline filesrc fails to open file: filesrc location=/dev/dvb/adapter0/dvr0 ! tsdemux ! h264parser ! avdec_h264 ! xvimagesink The output from the log is the following: 0:00:00.221212462 4545 0x9527460 ERROR basesrc gstbasesrc.c:3278:gst_base_src_start_complete:<file-source> Cannot operate in pull mode, stopping 0:00:00.221289531 4545 0x9527460 WARN filesrc gstfilesrc.c:513:gst_file_src_start:<file-source> error: No se pudo abrir el archivo «/dev/dvb/adapter0/dvr0» para leer. 0:00:00.221306784 4545 0x9527460 WARN filesrc gstfilesrc.c:513:gst_file_src_start:<file-source> error: system error: Dispositivo o recurso ocupado 0:00:00.221336008 4545 0x9527460 WARN basesrc gstbasesrc.c:3509:gst_base_src_activate_push:<file-source> Failed to start in push mode 0:00:00.221349720 4545 0x9527460 WARN GST_PADS gstpad.c:974:gst_pad_set_active:<file-source:src> Failed to activate pad I read the code in gstfilesrc.c and realized that if pull mode fails it doesn't close the file before triying to re-open it in push-mode.
When using DVB, you should use the dvbsrc element. gst-launch-1.0 dvbsrc ! tsdemux ! ...
/dev/dvb/adapter0/dvr0 is a pipe created by myself. I don't need all the things that dvbsrc takes care of. If i debug filesrc i can see that first it tries to open the file in pull-mode, it fails. While trying to open in push-mode, in the function gst_file_src_start I can see that before opening it src->fd isn't 0. Therefore i presume the file is still opened and that's why the log says the device is busy.
Re-opening, if there's a logic error / bug in the open sequence, it probably applies regardless of the file.
Confirmed. I'm not entirely sure what the right place to fix it is though. This async start/complete/wait stuff is a bit confusing.
commit 6e6fc159a7c22eecbf04086c72cb182bad4ed7d3 Author: Wim Taymans <wim.taymans@collabora.co.uk> Date: Thu Dec 13 14:48:35 2012 +0100 basesrc: call _stop when start failed When we failed to complete the start, call stop again. This makes sure that all successfull calls to _start are paired with a _stop. Fixes https://bugzilla.gnome.org/show_bug.cgi?id=687845