Commit 42ecafec authored by Thibault Saunier's avatar Thibault Saunier Committed by Thibault Saunier

streamsplitter: Keep still meaningfull pending events on FLUSH_STOP

Only EOS and segment should be deleted in that case.

https://bugzilla.gnome.org/show_bug.cgi?id=709868
parent 967d1fb9
......@@ -149,6 +149,25 @@ nopad:
return GST_FLOW_ERROR;
}
static GList *
_flush_events (GstPad * pad, GList * events)
{
GList *tmp;
for (tmp = events; tmp; tmp = tmp->next) {
if (GST_EVENT_TYPE (tmp->data) == GST_EVENT_EOS ||
GST_EVENT_TYPE (tmp->data) == GST_EVENT_SEGMENT ||
!GST_EVENT_IS_STICKY (tmp->data) || pad == NULL) {
gst_event_unref (tmp->data);
} else {
gst_pad_store_sticky_event (pad, GST_EVENT_CAST (tmp->data));
}
}
g_list_free (events);
return NULL;
}
static gboolean
gst_stream_splitter_sink_event (GstPad * pad, GstObject * parent,
GstEvent * event)
......@@ -157,8 +176,6 @@ gst_stream_splitter_sink_event (GstPad * pad, GstObject * parent,
gboolean res = TRUE;
gboolean toall = FALSE;
gboolean store = FALSE;
gboolean flushpending = FALSE;
/* FLUSH_START/STOP : forward to all
* INBAND events : store to send in chain function to selected chain
* OUT_OF_BAND events : send to all
......@@ -179,8 +196,11 @@ gst_stream_splitter_sink_event (GstPad * pad, GstObject * parent,
break;
}
case GST_EVENT_FLUSH_STOP:
flushpending = TRUE;
toall = TRUE;
STREAMS_LOCK (stream_splitter);
stream_splitter->pending_events = _flush_events (stream_splitter->current,
stream_splitter->pending_events);
STREAMS_UNLOCK (stream_splitter);
break;
case GST_EVENT_FLUSH_START:
toall = TRUE;
......@@ -208,13 +228,6 @@ gst_stream_splitter_sink_event (GstPad * pad, GstObject * parent,
store = TRUE;
}
if (flushpending) {
g_list_foreach (stream_splitter->pending_events, (GFunc) gst_event_unref,
NULL);
g_list_free (stream_splitter->pending_events);
stream_splitter->pending_events = NULL;
}
if (store) {
stream_splitter->pending_events =
g_list_append (stream_splitter->pending_events, event);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment