plugins: *queue* elements: Handle STREAM_START in EOS situation
authorEdward Hervey <edward@centricular.com>
Wed, 9 Aug 2017 08:51:39 +0000 (10:51 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Wed, 9 Aug 2017 08:54:17 +0000 (10:54 +0200)
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
plugins/elements/gstqueue.c
plugins/elements/gstqueue2.c

index 64cc07b..09b67a6 100644 (file)
@@ -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 */
index db02e20..37a4438 100644 (file)
@@ -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",
index fab1402..838b6d6 100644 (file)
@@ -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));