mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-28 20:51:13 +00:00
streamsplitter: push pending events before eos
Push any pending events downstream before pushing eos
This commit is contained in:
parent
1ae733fd4e
commit
2fbc04e7bc
1 changed files with 32 additions and 11 deletions
|
@ -105,6 +105,21 @@ gst_stream_splitter_finalize (GObject * object)
|
||||||
G_OBJECT_CLASS (gst_stream_splitter_parent_class)->finalize (object);
|
G_OBJECT_CLASS (gst_stream_splitter_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_stream_splitter_push_pending_events (GstStreamSplitter * splitter,
|
||||||
|
GstPad * srcpad)
|
||||||
|
{
|
||||||
|
GList *tmp;
|
||||||
|
GST_DEBUG_OBJECT (srcpad, "Pushing out pending events");
|
||||||
|
|
||||||
|
for (tmp = splitter->pending_events; tmp; tmp = tmp->next) {
|
||||||
|
GstEvent *event = (GstEvent *) tmp->data;
|
||||||
|
gst_pad_push_event (srcpad, event);
|
||||||
|
}
|
||||||
|
g_list_free (splitter->pending_events);
|
||||||
|
splitter->pending_events = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static GstFlowReturn
|
static GstFlowReturn
|
||||||
gst_stream_splitter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
gst_stream_splitter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
|
@ -120,17 +135,8 @@ gst_stream_splitter_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
|
||||||
if (G_UNLIKELY (srcpad == NULL))
|
if (G_UNLIKELY (srcpad == NULL))
|
||||||
goto nopad;
|
goto nopad;
|
||||||
|
|
||||||
if (G_UNLIKELY (stream_splitter->pending_events)) {
|
if (G_UNLIKELY (stream_splitter->pending_events))
|
||||||
GList *tmp;
|
gst_stream_splitter_push_pending_events (stream_splitter, srcpad);
|
||||||
GST_DEBUG_OBJECT (srcpad, "Pushing out pending events");
|
|
||||||
|
|
||||||
for (tmp = stream_splitter->pending_events; tmp; tmp = tmp->next) {
|
|
||||||
GstEvent *event = (GstEvent *) tmp->data;
|
|
||||||
gst_pad_push_event (srcpad, event);
|
|
||||||
}
|
|
||||||
g_list_free (stream_splitter->pending_events);
|
|
||||||
stream_splitter->pending_events = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Forward to currently activated stream */
|
/* Forward to currently activated stream */
|
||||||
res = gst_pad_push (srcpad, buf);
|
res = gst_pad_push (srcpad, buf);
|
||||||
|
@ -180,6 +186,21 @@ gst_stream_splitter_sink_event (GstPad * pad, GstObject * parent,
|
||||||
toall = TRUE;
|
toall = TRUE;
|
||||||
break;
|
break;
|
||||||
case GST_EVENT_EOS:
|
case GST_EVENT_EOS:
|
||||||
|
|
||||||
|
if (G_UNLIKELY (stream_splitter->pending_events)) {
|
||||||
|
GstPad *srcpad = NULL;
|
||||||
|
|
||||||
|
STREAMS_LOCK (stream_splitter);
|
||||||
|
if (stream_splitter->current)
|
||||||
|
srcpad = gst_object_ref (stream_splitter->current);
|
||||||
|
STREAMS_UNLOCK (stream_splitter);
|
||||||
|
|
||||||
|
if (srcpad) {
|
||||||
|
gst_stream_splitter_push_pending_events (stream_splitter, srcpad);
|
||||||
|
gst_object_unref (srcpad);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
toall = TRUE;
|
toall = TRUE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
Loading…
Reference in a new issue