From 5cce960baa723164c2314b0b065643ab642b593d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Wed, 7 Mar 2012 14:55:08 +0100 Subject: [PATCH] ptdemux: set caps after activating the pad Set the caps after we activated the pad or else it will just fail. --- gst/rtpmanager/gstrtpptdemux.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/gst/rtpmanager/gstrtpptdemux.c b/gst/rtpmanager/gstrtpptdemux.c index 06a28c58fc..bef52d0905 100644 --- a/gst/rtpmanager/gstrtpptdemux.c +++ b/gst/rtpmanager/gstrtpptdemux.c @@ -383,11 +383,6 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) g_free (padname); gst_pad_set_event_function (srcpad, gst_rtp_pt_demux_src_event); - caps = gst_caps_make_writable (caps); - gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL); - gst_pad_set_caps (srcpad, caps); - gst_caps_unref (caps); - GST_DEBUG ("Adding pt=%d to the list.", pt); rtpdemuxpad = g_slice_new0 (GstRtpPtDemuxPad); rtpdemuxpad->pt = pt; @@ -399,6 +394,12 @@ gst_rtp_pt_demux_chain (GstPad * pad, GstObject * parent, GstBuffer * buf) GST_OBJECT_UNLOCK (rtpdemux); gst_pad_set_active (srcpad, TRUE); + + caps = gst_caps_make_writable (caps); + gst_caps_set_simple (caps, "payload", G_TYPE_INT, pt, NULL); + gst_pad_set_caps (srcpad, caps); + gst_caps_unref (caps); + gst_pad_sticky_events_foreach (rtpdemux->sink, forward_sticky_events, srcpad); gst_element_add_pad (GST_ELEMENT_CAST (rtpdemux), srcpad); @@ -491,6 +492,8 @@ gst_rtp_pt_demux_sink_event (GstPad * pad, GstObject * parent, GstEvent * event) case GST_EVENT_CAPS: { gst_rtp_pt_demux_clear_pt_map (rtpdemux); + /* don't forward the event, we cleared the ptmap and on the next buffer we + * will add the pt to the caps and push a new caps event */ gst_event_unref (event); res = TRUE; break;