From e2f8dc0aeff50de64e568831966b4df831d1fa1c Mon Sep 17 00:00:00 2001 From: Edward Hervey Date: Wed, 9 Aug 2017 10:51:39 +0200 Subject: [PATCH] plugins: *queue* elements: Handle STREAM_START in EOS situation When queue-like elements are in "EOS" situation (received GST_FLOW_EOS from downstream or EOS was pushed), they drain buffers/events that wouldn't be processed anyway and let through events that might modify the EOS situation. Previously only GST_EVENT_EOS and GST_EVENT_SEGMENT events were let through, but we also need to allow GST_EVENT_STREAM_START to go through since it resets the EOS state of pads since 1.6 https://bugzilla.gnome.org/show_bug.cgi?id=786034 --- plugins/elements/gstmultiqueue.c | 5 +++++ plugins/elements/gstqueue.c | 3 ++- plugins/elements/gstqueue2.c | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/plugins/elements/gstmultiqueue.c b/plugins/elements/gstmultiqueue.c index 64cc07b..09b67a6 100644 --- a/plugins/elements/gstmultiqueue.c +++ b/plugins/elements/gstmultiqueue.c @@ -1631,6 +1631,11 @@ gst_single_queue_push_one (GstMultiQueue * mq, GstSingleQueue * sq, if (G_UNLIKELY (*allow_drop)) *allow_drop = FALSE; break; + case GST_EVENT_STREAM_START: + result = GST_FLOW_OK; + if (G_UNLIKELY (*allow_drop)) + *allow_drop = FALSE; + break; case GST_EVENT_SEGMENT: apply_segment (mq, sq, event, &sq->src_segment); /* Applying the segment may have made the queue non-full again, unblock it if needed */ diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index db02e20..37a4438 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -1400,7 +1400,8 @@ next: GstEvent *event = GST_EVENT_CAST (data); GstEventType type = GST_EVENT_TYPE (event); - if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) { + if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT + || type == GST_EVENT_STREAM_START) { /* we found a pushable item in the queue, push it out */ GST_CAT_LOG_OBJECT (queue_dataflow, queue, "pushing pushable event %s after EOS", diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c index fab1402..838b6d6 100644 --- a/plugins/elements/gstqueue2.c +++ b/plugins/elements/gstqueue2.c @@ -2859,7 +2859,8 @@ gst_queue2_dequeue_on_eos (GstQueue2 * queue, GstQueue2ItemType * item_type) GstEvent *event = GST_EVENT_CAST (data); GstEventType type = GST_EVENT_TYPE (event); - if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT) { + if (type == GST_EVENT_EOS || type == GST_EVENT_SEGMENT + || type == GST_EVENT_STREAM_START) { /* we found a pushable item in the queue, push it out */ GST_CAT_LOG_OBJECT (queue_dataflow, queue, "pushing pushable event %s after EOS", GST_EVENT_TYPE_NAME (event)); -- 2.7.4