diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpbin.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpbin.c index f534682b66..b139f44304 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpbin.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpbin.c @@ -1791,6 +1791,18 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s, GST_DEBUG_OBJECT (bin, "handle sync from RTCP SR information"); + /* get RTCP SR ntpnstime if available */ + if (gst_structure_get_uint64 (s, "sr-ntpnstime", &ntpnstime) && cname) { + GST_RTP_BIN_LOCK (bin); + /* associate the stream to CNAME */ + gst_rtp_bin_associate (bin, stream, strlen (cname), + (const guint8 *) cname, ntpnstime, extrtptime, base_rtptime, + base_time, clock_rate, clock_base); + GST_RTP_BIN_UNLOCK (bin); + return; + } + + /* otherwise parse the RTCP packet */ buffer = gst_value_get_buffer (gst_structure_get_value (s, "sr-buffer")); have_sr = FALSE; diff --git a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpjitterbuffer.c b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpjitterbuffer.c index 6b5aa3a40c..0a090e486f 100644 --- a/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpjitterbuffer.c +++ b/subprojects/gst-plugins-good/gst/rtpmanager/gstrtpjitterbuffer.c @@ -410,6 +410,7 @@ struct _GstRtpJitterBufferPrivate guint64 ext_rtptime; GstBuffer *last_sr; guint32 last_sr_ssrc; + GstClockTime last_sr_ntpnstime; /* some accounting */ guint64 num_pushed; @@ -4569,10 +4570,12 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer) clock_base = priv->clock_base; ext_rtptime = priv->ext_rtptime; - GST_DEBUG_OBJECT (jitterbuffer, "ext SR %" G_GUINT64_FORMAT ", base %" - G_GUINT64_FORMAT ", clock-rate %" G_GUINT32_FORMAT - ", clock-base %" G_GUINT64_FORMAT ", last-rtptime %" G_GUINT64_FORMAT, - ext_rtptime, base_rtptime, clock_rate, clock_base, last_rtptime); + GST_DEBUG_OBJECT (jitterbuffer, + "ext SR %" G_GUINT64_FORMAT ", NTP %" G_GUINT64_FORMAT ", base %" + G_GUINT64_FORMAT ", clock-rate %" G_GUINT32_FORMAT ", clock-base %" + G_GUINT64_FORMAT ", last-rtptime %" G_GUINT64_FORMAT, ext_rtptime, + priv->last_sr_ntpnstime, base_rtptime, clock_rate, clock_base, + last_rtptime); if (base_rtptime == -1 || clock_rate == -1 || base_time == -1) { /* we keep this SR packet for later. When we get a valid RTP packet the @@ -4621,6 +4624,7 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer) "clock-base", G_TYPE_UINT64, clock_base, "ssrc", G_TYPE_UINT, priv->last_sr_ssrc, "sr-ext-rtptime", G_TYPE_UINT64, ext_rtptime, + "sr-ntpnstime", G_TYPE_UINT64, priv->last_sr_ntpnstime, "sr-buffer", GST_TYPE_BUFFER, priv->last_sr, NULL); for (l = priv->cname_ssrc_mappings; l; l = l->next) { @@ -4748,6 +4752,7 @@ gst_rtp_jitter_buffer_chain_rtcp (GstPad * pad, GstObject * parent, priv->ext_rtptime = ext_rtptime; priv->last_sr_ssrc = ssrc; + priv->last_sr_ntpnstime = ntpnstime; if (priv->last_ntpnstime != GST_CLOCK_TIME_NONE && ntpnstime - priv->last_ntpnstime < priv->sync_interval * GST_MSECOND) {