rtpptdemux: Wait after the caps to forward the other events

First forward the stream-start, then the caps, then the rest
This commit is contained in:
Olivier Crête 2013-06-20 23:16:17 -04:00
parent c03efd3894
commit 2cd6f53e24

View 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);