static gboolean
gst_jitter_buffer_sink_parse_caps (GstRtpJitterBuffer * jitterbuffer,
- GstCaps * caps)
+ GstCaps * caps, gint pt)
{
GstRtpJitterBufferPrivate *priv;
GstStructure *caps_struct;
guint val;
+ gint payload = -1;
GstClockTime tval;
const gchar *ts_refclk, *mediaclk;
/* first parse the caps */
caps_struct = gst_caps_get_structure (caps, 0);
- GST_DEBUG_OBJECT (jitterbuffer, "got caps");
+ GST_DEBUG_OBJECT (jitterbuffer, "got caps %" GST_PTR_FORMAT, caps);
+
+ if (gst_structure_get_int (caps_struct, "payload", &payload) && pt != -1
+ && payload != pt) {
+ GST_ERROR_OBJECT (jitterbuffer,
+ "Got caps with wrong payload type (got %d, expected %d)", payload, pt);
+ return FALSE;
+ }
+
+ if (payload != -1) {
+ GST_DEBUG_OBJECT (jitterbuffer, "Got payload type %d", payload);
+ priv->last_pt = payload;
+ }
/* we need a clock-rate to convert the rtp timestamps to GStreamer time and to
* measure the amount of data in the buffer */
GstCaps *caps;
gst_event_parse_caps (event, &caps);
- gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
+ gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps, -1);
break;
}
case GST_EVENT_SEGMENT:
if (!caps)
goto no_caps;
- res = gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
+ res = gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps, pt);
gst_caps_unref (caps);
if (G_UNLIKELY (!res))
/* Try to get the clock-rate from the caps first if we can. If there are no
* caps we must fire the signal to get the clock-rate. */
if ((caps = gst_pad_get_current_caps (pad))) {
- gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps);
+ gst_jitter_buffer_sink_parse_caps (jitterbuffer, caps, pt);
gst_caps_unref (caps);
}
}