rtpptdemux: Wait after the caps to forward the other events
authorOlivier Crête <olivier.crete@collabora.com>
Fri, 21 Jun 2013 03:16:17 +0000 (23:16 -0400)
committerOlivier Crête <olivier.crete@collabora.com>
Fri, 21 Jun 2013 03:16:59 +0000 (23:16 -0400)
First forward the stream-start, then the caps, then the rest

gst/rtpmanager/gstrtpptdemux.c

index e0ae78b..fb3559a 100644 (file)
@@ -337,7 +337,9 @@ forward_sticky_events (GstPad * pad, GstEvent ** event, gpointer user_data)
 {
   GstPad *srcpad = GST_PAD_CAST (user_data);
 
-  gst_pad_push_event (srcpad, gst_event_ref (*event));
+  /* Stream start and caps have already been pushed */
+  if (GST_EVENT_TYPE (*event) >= GST_EVENT_SEGMENT)
+    gst_pad_push_event (srcpad, gst_event_ref (*event));
 
   return TRUE;
 }
@@ -394,9 +396,10 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
 
     gst_pad_set_active (srcpad, TRUE);
 
-    /* First sticky events on sink pad are forwarded to the new src pad */
-    gst_pad_sticky_events_foreach (rtpdemux->sink, forward_sticky_events,
-        srcpad);
+
+    /* First push the stream-start event, it must always come first */
+    gst_pad_push_event (srcpad,
+        gst_pad_get_sticky_event (rtpdemux->sink, GST_EVENT_STREAM_START, 0));
 
     /* Then caps event is sent */
     caps = gst_caps_make_writable (caps);
@@ -404,6 +407,10 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
     gst_pad_set_caps (srcpad, caps);
     gst_caps_unref (caps);
 
+    /* First sticky events on sink pad are forwarded to the new src pad */
+    gst_pad_sticky_events_foreach (rtpdemux->sink, forward_sticky_events,
+        srcpad);
+
     gst_element_add_pad (GST_ELEMENT_CAST (rtpdemux), srcpad);
 
     GST_DEBUG ("emitting new-payload-type for pt %d", pt);