mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
rtpjitterbuffer: Ensure to not take caps with the wrong pt for getting the clock-rate
Especially the caps on the pad might be out of date, and the new caps would be provided for the current pt via the request-pt-map signal. https://bugzilla.gnome.org/show_bug.cgi?id=765689
This commit is contained in:
parent
d24e68719b
commit
608b4ee53c
1 changed files with 18 additions and 5 deletions
|
@ -1258,11 +1258,12 @@ gst_rtp_jitter_buffer_getcaps (GstPad * pad, GstCaps * filter)
|
|||
|
||||
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;
|
||||
|
||||
|
@ -1271,7 +1272,19 @@ gst_jitter_buffer_sink_parse_caps (GstRtpJitterBuffer * jitterbuffer,
|
|||
/* 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 */
|
||||
|
@ -1643,7 +1656,7 @@ queue_event (GstRtpJitterBuffer * jitterbuffer, GstEvent * event)
|
|||
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:
|
||||
|
@ -1815,7 +1828,7 @@ gst_rtp_jitter_buffer_get_clock_rate (GstRtpJitterBuffer * jitterbuffer,
|
|||
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))
|
||||
|
@ -2582,7 +2595,7 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
|
|||
/* 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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue