[0.11] gstreamer: queue2: Fix handling of the new stream-start event

Sebastian Dröge slomo at kemper.freedesktop.org
Fri Jan 27 03:34:02 PST 2012


Module: gstreamer
Branch: 0.11
Commit: eba7fed1d30185d3d8eb496587b0f98ac84db9cb
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=eba7fed1d30185d3d8eb496587b0f98ac84db9cb

Author: Sebastian Dröge <sebastian.droege at collabora.co.uk>
Date:   Fri Jan 27 12:33:32 2012 +0100

queue2: Fix handling of the new stream-start event

---

 plugins/elements/gstqueue2.c |   15 ++++++++++++++-
 plugins/elements/gstqueue2.h |    2 ++
 2 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/plugins/elements/gstqueue2.c b/plugins/elements/gstqueue2.c
index 7b51950..524c6ed 100644
--- a/plugins/elements/gstqueue2.c
+++ b/plugins/elements/gstqueue2.c
@@ -1312,7 +1312,10 @@ gst_queue2_read_item_from_file (GstQueue2 * queue)
 {
   GstMiniObject *item;
 
-  if (queue->starting_segment != NULL) {
+  if (queue->stream_start_event != NULL) {
+    item = GST_MINI_OBJECT_CAST (queue->stream_start_event);
+    queue->stream_start_event = NULL;
+  } else if (queue->starting_segment != NULL) {
     item = GST_MINI_OBJECT_CAST (queue->starting_segment);
     queue->starting_segment = NULL;
   } else {
@@ -1483,6 +1486,7 @@ gst_queue2_locked_flush (GstQueue2 * queue)
     gst_event_unref (queue->starting_segment);
   queue->starting_segment = NULL;
   queue->segment_event_received = FALSE;
+  gst_event_replace (&queue->stream_start_event, NULL);
 
   /* we deleted a lot of something */
   GST_QUEUE2_SIGNAL_DEL (queue);
@@ -1913,6 +1917,13 @@ gst_queue2_locked_enqueue (GstQueue2 * queue, gpointer item,
          * from downstream */
         queue->unexpected = FALSE;
         break;
+      case GST_EVENT_STREAM_START:
+        if (!QUEUE_IS_USING_QUEUE (queue)) {
+          gst_event_replace (&queue->stream_start_event, event);
+          gst_event_unref (event);
+          item = NULL;
+        }
+        break;
       default:
         if (!QUEUE_IS_USING_QUEUE (queue))
           goto unexpected_event;
@@ -3051,6 +3062,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
       }
       queue->segment_event_received = FALSE;
       queue->starting_segment = NULL;
+      gst_event_replace (&queue->stream_start_event, NULL);
       GST_QUEUE2_MUTEX_UNLOCK (queue);
       break;
     case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
@@ -3085,6 +3097,7 @@ gst_queue2_change_state (GstElement * element, GstStateChange transition)
         gst_event_unref (queue->starting_segment);
         queue->starting_segment = NULL;
       }
+      gst_event_replace (&queue->stream_start_event, NULL);
       GST_QUEUE2_MUTEX_UNLOCK (queue);
       break;
     case GST_STATE_CHANGE_READY_TO_NULL:
diff --git a/plugins/elements/gstqueue2.h b/plugins/elements/gstqueue2.h
index 66947a7..5041f14 100644
--- a/plugins/elements/gstqueue2.h
+++ b/plugins/elements/gstqueue2.h
@@ -144,6 +144,8 @@ struct _GstQueue2
   gboolean segment_event_received;
   GstEvent *starting_segment;
 
+  GstEvent *stream_start_event;
+
   guint64 ring_buffer_max_size;
   guint8 * ring_buffer;
 };



More information about the gstreamer-commits mailing list