rtpmux: Reject wrong caps

This commit is contained in:
Olivier Crête 2009-04-28 16:10:21 -04:00 committed by Tim-Philipp Müller
parent 0111bafb3a
commit 4be63c9add

View file

@ -364,28 +364,26 @@ gst_rtp_mux_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstRTPMux *rtp_mux; GstRTPMux *rtp_mux;
GstStructure *structure; GstStructure *structure;
gboolean ret = TRUE; gboolean ret = FALSE;
GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad); GstRTPMuxPadPrivate *padpriv = gst_pad_get_element_private (pad);
rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad)); rtp_mux = GST_RTP_MUX (gst_pad_get_parent (pad));
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
if (!ret) if (!structure)
goto out; goto out;
if (gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) { if (gst_structure_get_uint (structure, "clock-base", &padpriv->clock_base)) {
padpriv->have_clock_base = TRUE; padpriv->have_clock_base = TRUE;
} }
caps = gst_caps_make_writable (caps); caps = gst_caps_copy (caps);
gst_caps_set_simple (caps, gst_caps_set_simple (caps,
"clock-base", G_TYPE_UINT, rtp_mux->ts_base, "clock-base", G_TYPE_UINT, rtp_mux->ts_base,
"seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL); "seqnum-base", G_TYPE_UINT, rtp_mux->seqnum_base, NULL);
gst_caps_ref (caps);
GST_DEBUG_OBJECT (rtp_mux, GST_DEBUG_OBJECT (rtp_mux,
"setting caps %" GST_PTR_FORMAT " on src pad..", caps); "setting caps %" GST_PTR_FORMAT " on src pad..", caps);
ret = gst_pad_set_caps (rtp_mux->srcpad, caps); ret = gst_pad_set_caps (rtp_mux->srcpad, caps);