mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 09:55:36 +00:00
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
This commit is contained in:
parent
f815c46f5b
commit
39ab05e024
2 changed files with 22 additions and 1 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -78,6 +78,7 @@ G_BEGIN_DECLS
|
|||
GstDvbSrcPol pol;
|
||||
guint stats_interval;
|
||||
guint stats_counter;
|
||||
gboolean need_unlock;
|
||||
};
|
||||
|
||||
struct _GstDvbSrcClass
|
||||
|
|
Loading…
Reference in a new issue