From 1d20eee27741502ac03073bd66ad3d3792127295 Mon Sep 17 00:00:00 2001 From: Zaheer Abbas Merali Date: Wed, 23 Jan 2008 14:59:47 +0000 Subject: sys/dvb/gstdvbsrc.c: Do not go on forever if problem with reading from dvr, rather return NULL. Original commit message from CVS: * sys/dvb/gstdvbsrc.c: Do not go on forever if problem with reading from dvr, rather return NULL. Handle some cleanup issues of closing filedescriptors when failing to tune or similar. --- sys/dvb/gstdvbsrc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'sys/dvb') diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c index 7b40c0ba..003e2299 100644 --- a/sys/dvb/gstdvbsrc.c +++ b/sys/dvb/gstdvbsrc.c @@ -877,6 +877,9 @@ read_device (int fd, int adapter_number, int frontend_number, int size) ("Unable to read after %u attempts from device: /dev/dvb/adapter%d/dvr%d (%d)", attempts, adapter_number, frontend_number, errno); } + if (attempts % 100 == 0) { + return NULL; + } } else if (errno == -EINTR) { // poll interrupted ; } @@ -942,13 +945,20 @@ gst_dvbsrc_start (GstBaseSrc * bsrc) gst_dvbsrc_open_frontend (src); if (!gst_dvbsrc_tune (src)) { GST_ERROR_OBJECT (src, "Not able to lock on to the dvb channel"); + close (src->fd_frontend); return FALSE; } if (!gst_dvbsrc_frontend_status (src)) { + /* unset filters also */ + gst_dvbsrc_unset_pes_filters (src); + close (src->fd_frontend); return FALSE; } if (!gst_dvbsrc_open_dvr (src)) { GST_ERROR_OBJECT (src, "Not able to open dvr_device"); + /* unset filters also */ + gst_dvbsrc_unset_pes_filters (src); + close (src->fd_frontend); return FALSE; } -- cgit v1.2.1