mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
rtpbin/rtpjitterbuffer: Don't parse RTCP SRs twice unless needed
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/2132>
This commit is contained in:
parent
82169aa140
commit
c7e12974ba
2 changed files with 21 additions and 4 deletions
|
@ -1791,6 +1791,18 @@ gst_rtp_bin_handle_sync (GstElement * jitterbuffer, GstStructure * s,
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (bin, "handle sync from RTCP SR information");
|
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"));
|
buffer = gst_value_get_buffer (gst_structure_get_value (s, "sr-buffer"));
|
||||||
|
|
||||||
have_sr = FALSE;
|
have_sr = FALSE;
|
||||||
|
|
|
@ -410,6 +410,7 @@ struct _GstRtpJitterBufferPrivate
|
||||||
guint64 ext_rtptime;
|
guint64 ext_rtptime;
|
||||||
GstBuffer *last_sr;
|
GstBuffer *last_sr;
|
||||||
guint32 last_sr_ssrc;
|
guint32 last_sr_ssrc;
|
||||||
|
GstClockTime last_sr_ntpnstime;
|
||||||
|
|
||||||
/* some accounting */
|
/* some accounting */
|
||||||
guint64 num_pushed;
|
guint64 num_pushed;
|
||||||
|
@ -4569,10 +4570,12 @@ do_handle_sync (GstRtpJitterBuffer * jitterbuffer)
|
||||||
clock_base = priv->clock_base;
|
clock_base = priv->clock_base;
|
||||||
ext_rtptime = priv->ext_rtptime;
|
ext_rtptime = priv->ext_rtptime;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (jitterbuffer, "ext SR %" G_GUINT64_FORMAT ", base %"
|
GST_DEBUG_OBJECT (jitterbuffer,
|
||||||
G_GUINT64_FORMAT ", clock-rate %" G_GUINT32_FORMAT
|
"ext SR %" G_GUINT64_FORMAT ", NTP %" G_GUINT64_FORMAT ", base %"
|
||||||
", clock-base %" G_GUINT64_FORMAT ", last-rtptime %" G_GUINT64_FORMAT,
|
G_GUINT64_FORMAT ", clock-rate %" G_GUINT32_FORMAT ", clock-base %"
|
||||||
ext_rtptime, base_rtptime, clock_rate, clock_base, last_rtptime);
|
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) {
|
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
|
/* 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,
|
"clock-base", G_TYPE_UINT64, clock_base,
|
||||||
"ssrc", G_TYPE_UINT, priv->last_sr_ssrc,
|
"ssrc", G_TYPE_UINT, priv->last_sr_ssrc,
|
||||||
"sr-ext-rtptime", G_TYPE_UINT64, ext_rtptime,
|
"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);
|
"sr-buffer", GST_TYPE_BUFFER, priv->last_sr, NULL);
|
||||||
|
|
||||||
for (l = priv->cname_ssrc_mappings; l; l = l->next) {
|
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->ext_rtptime = ext_rtptime;
|
||||||
priv->last_sr_ssrc = ssrc;
|
priv->last_sr_ssrc = ssrc;
|
||||||
|
priv->last_sr_ntpnstime = ntpnstime;
|
||||||
|
|
||||||
if (priv->last_ntpnstime != GST_CLOCK_TIME_NONE
|
if (priv->last_ntpnstime != GST_CLOCK_TIME_NONE
|
||||||
&& ntpnstime - priv->last_ntpnstime < priv->sync_interval * GST_MSECOND) {
|
&& ntpnstime - priv->last_ntpnstime < priv->sync_interval * GST_MSECOND) {
|
||||||
|
|
Loading…
Reference in a new issue