multipartdemux: Ensure caps before pad added.
authorJason Litzinger <jlitzinger@control4.com>
Thu, 28 Aug 2014 19:48:50 +0000 (13:48 -0600)
committerSebastian Dröge <sebastian@centricular.com>
Fri, 29 Aug 2014 08:38:19 +0000 (11:38 +0300)
This stores the stream-start, sets caps, and then adds the pad,
which ensures that the caps are set for the "pad-added" callback.

https://bugzilla.gnome.org/show_bug.cgi?id=735626

gst/multipart/multipartdemux.c

index a62c2a0..8cc0f64 100644 (file)
@@ -322,7 +322,6 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime,
 
     gst_pad_use_fixed_caps (pad);
     gst_pad_set_active (pad, TRUE);
-    gst_element_add_pad (GST_ELEMENT_CAST (demux), pad);
 
     /* prepare and send stream-start */
     if (!demux->have_group_id) {
@@ -346,7 +345,7 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime,
     if (demux->have_group_id)
       gst_event_set_group_id (event, demux->group_id);
 
-    gst_pad_push_event (pad, event);
+    gst_pad_store_sticky_event (pad, event);
     g_free (stream_id);
 
     /* take the mime type, convert it to the caps name */
@@ -354,6 +353,7 @@ gst_multipart_find_pad_by_mime (GstMultipartDemux * demux, gchar * mime,
     caps = gst_caps_from_string (capsname);
     GST_DEBUG_OBJECT (demux, "caps for pad: %s", capsname);
     gst_pad_set_caps (pad, caps);
+    gst_element_add_pad (GST_ELEMENT_CAST (demux), pad);
     gst_caps_unref (caps);
 
     if (created) {