summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent GENIEUX <vgenieux at free.fr>2010-01-27 12:08:48 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2010-01-27 12:10:32 +0100
commit39ab05e02462634807fc59d36c45234d6b3319f6 (patch)
tree3583098c11ecb4b6cff28ec68676e72062340fa3
parentf815c46f5bda6c98c99200e485f8bf6773f4b9ed (diff)
dvbsrc: fix element shutdown on bad reception
When we have a bad reception, avoid going into an infinite loop by setting a shutdown flag when shutting down. Fixes #607747
-rw-r--r--sys/dvb/gstdvbsrc.c22
-rw-r--r--sys/dvb/gstdvbsrc.h1
2 files changed, 22 insertions, 1 deletions
diff --git a/sys/dvb/gstdvbsrc.c b/sys/dvb/gstdvbsrc.c
index 9bb8a25a1..5a05b87cc 100644
--- a/sys/dvb/gstdvbsrc.c
+++ b/sys/dvb/gstdvbsrc.c
@@ -268,6 +268,7 @@ static GstStateChangeReturn gst_dvbsrc_change_state (GstElement * element,
GstStateChange transition);
static gboolean gst_dvbsrc_unlock (GstBaseSrc * bsrc);
+static gboolean gst_dvbsrc_unlock_stop (GstBaseSrc * bsrc);
static gboolean gst_dvbsrc_is_seekable (GstBaseSrc * bsrc);
static gboolean gst_dvbsrc_get_size (GstBaseSrc * src, guint64 * size);
@@ -330,6 +331,7 @@ gst_dvbsrc_class_init (GstDvbSrcClass * klass)
gstbasesrc_class->start = GST_DEBUG_FUNCPTR (gst_dvbsrc_start);
gstbasesrc_class->stop = GST_DEBUG_FUNCPTR (gst_dvbsrc_stop);
gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_dvbsrc_unlock);
+ gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_dvbsrc_unlock_stop);
gstbasesrc_class->is_seekable = GST_DEBUG_FUNCPTR (gst_dvbsrc_is_seekable);
gstbasesrc_class->get_size = GST_DEBUG_FUNCPTR (gst_dvbsrc_get_size);
@@ -887,7 +889,7 @@ read_device (int fd, int adapter_number, int frontend_number, int size,
pfd[0].fd = fd;
pfd[0].events = POLLIN;
- while (count < size) {
+ while (count < size && !object->need_unlock) {
ret_val = poll (pfd, 1, TIMEOUT);
if (ret_val > 0) {
if (pfd[0].revents & POLLIN) {
@@ -933,6 +935,11 @@ read_device (int fd, int adapter_number, int frontend_number, int size,
}
+ if (!count) {
+ gst_buffer_unref (buf);
+ return NULL;
+ }
+
GST_BUFFER_SIZE (buf) = count;
GST_BUFFER_TIMESTAMP (buf) = GST_CLOCK_TIME_NONE;
return buf;
@@ -1036,6 +1043,7 @@ gst_dvbsrc_start (GstBaseSrc * bsrc)
close (src->fd_frontend);
return FALSE;
}
+ src->need_unlock = FALSE;
return TRUE;
}
@@ -1052,6 +1060,18 @@ gst_dvbsrc_stop (GstBaseSrc * bsrc)
static gboolean
gst_dvbsrc_unlock (GstBaseSrc * bsrc)
{
+ GstDvbSrc *src = GST_DVBSRC (bsrc);
+
+ src->need_unlock = TRUE;
+ return TRUE;
+}
+
+static gboolean
+gst_dvbsrc_unlock_stop (GstBaseSrc * bsrc)
+{
+ GstDvbSrc *src = GST_DVBSRC (bsrc);
+
+ src->need_unlock = FALSE;
return TRUE;
}
diff --git a/sys/dvb/gstdvbsrc.h b/sys/dvb/gstdvbsrc.h
index 8e6640ede..273aa2afb 100644
--- a/sys/dvb/gstdvbsrc.h
+++ b/sys/dvb/gstdvbsrc.h
@@ -78,6 +78,7 @@ G_BEGIN_DECLS
GstDvbSrcPol pol;
guint stats_interval;
guint stats_counter;
+ gboolean need_unlock;
};
struct _GstDvbSrcClass