appsrc: Clear is_eos flag when receiving the flush-stop event

The EOS event can be propagated to the downstream elements when
is_eos flag remains set even after leaving the flushing state.
This fix allows this element to normally restart the streaming
after receiving the flush event by clearing the is_eos flag.

https://bugzilla.gnome.org/show_bug.cgi?id=759110
This commit is contained in:
Kazunori Kobayashi 2015-12-03 11:53:05 +09:00 committed by Sebastian Dröge
parent 8b05f682b0
commit d43f1b2a5a

View file

@ -237,6 +237,7 @@ static gboolean gst_app_src_do_seek (GstBaseSrc * src, GstSegment * segment);
static gboolean gst_app_src_is_seekable (GstBaseSrc * src);
static gboolean gst_app_src_do_get_size (GstBaseSrc * src, guint64 * size);
static gboolean gst_app_src_query (GstBaseSrc * src, GstQuery * query);
static gboolean gst_app_src_event (GstBaseSrc * src, GstEvent * event);
static GstFlowReturn gst_app_src_push_buffer_action (GstAppSrc * appsrc,
GstBuffer * buffer);
@ -528,6 +529,7 @@ gst_app_src_class_init (GstAppSrcClass * klass)
basesrc_class->is_seekable = gst_app_src_is_seekable;
basesrc_class->get_size = gst_app_src_do_get_size;
basesrc_class->query = gst_app_src_query;
basesrc_class->event = gst_app_src_event;
klass->push_buffer = gst_app_src_push_buffer_action;
klass->push_sample = gst_app_src_push_sample_action;
@ -1916,3 +1918,22 @@ gst_app_src_uri_handler_init (gpointer g_iface, gpointer iface_data)
iface->get_uri = gst_app_src_uri_get_uri;
iface->set_uri = gst_app_src_uri_set_uri;
}
static gboolean
gst_app_src_event (GstBaseSrc * src, GstEvent * event)
{
GstAppSrc *appsrc = GST_APP_SRC_CAST (src);
GstAppSrcPrivate *priv = appsrc->priv;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_FLUSH_STOP:
g_mutex_lock (&priv->mutex);
priv->is_eos = FALSE;
g_mutex_unlock (&priv->mutex);
break;
default:
break;
}
return GST_BASE_SRC_CLASS (parent_class)->event (src, event);
}