summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorThomas Bluemel <tbluemel@control4.com>2016-08-10 11:45:13 -0600
committerSebastian Dröge <sebastian@centricular.com>2016-08-10 19:49:27 +0200
commit4dff74358eccd248ea8f54cb8ccc3c411b3dbf99 (patch)
treee8eb1459a7374b29d1aad25dcaa0a39dcfaf1e62 /gst
parente7d4ad7ac70b086c1c20c7482b64ea3a6bb3e4e7 (diff)
rtpjitterbuffer: Actually calculate the packet rate for max-dropout and max-misorder calculations.
https://bugzilla.gnome.org/show_bug.cgi?id=751311
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmanager/gstrtpjitterbuffer.c4
-rw-r--r--gst/rtpmanager/rtpstats.c9
2 files changed, 10 insertions, 3 deletions
diff --git a/gst/rtpmanager/gstrtpjitterbuffer.c b/gst/rtpmanager/gstrtpjitterbuffer.c
index 7b72deb4c..1fc313b0f 100644
--- a/gst/rtpmanager/gstrtpjitterbuffer.c
+++ b/gst/rtpmanager/gstrtpjitterbuffer.c
@@ -1299,6 +1299,8 @@ gst_jitter_buffer_sink_parse_caps (GstRtpJitterBuffer * jitterbuffer,
rtp_jitter_buffer_set_clock_rate (priv->jbuf, priv->clock_rate);
+ gst_rtp_packet_rate_ctx_reset (&priv->packet_rate_ctx, priv->clock_rate);
+
/* The clock base is the RTP timestamp corrsponding to the npt-start value. We
* can use this to track the amount of time elapsed on the sender. */
if (gst_structure_get_uint (caps_struct, "clock-base", &val))
@@ -2632,6 +2634,8 @@ gst_rtp_jitter_buffer_chain (GstPad * pad, GstObject * parent,
if (G_UNLIKELY (priv->clock_rate == -1))
goto no_clock_rate;
+
+ gst_rtp_packet_rate_ctx_reset (&priv->packet_rate_ctx, priv->clock_rate);
}
/* don't accept more data on EOS */
diff --git a/gst/rtpmanager/rtpstats.c b/gst/rtpmanager/rtpstats.c
index 984bc9f76..cc25dbf64 100644
--- a/gst/rtpmanager/rtpstats.c
+++ b/gst/rtpmanager/rtpstats.c
@@ -27,6 +27,7 @@ gst_rtp_packet_rate_ctx_reset (RTPPacketRateCtx * ctx, guint32 clock_rate)
ctx->clock_rate = clock_rate;
ctx->probed = FALSE;
ctx->avg_packet_rate = -1;
+ ctx->last_ts = -1;
}
guint32
@@ -41,15 +42,16 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum,
return ctx->avg_packet_rate;
}
+ new_ts = ctx->last_ts;
+ gst_rtp_buffer_ext_timestamp (&new_ts, ts);
+
if (!ctx->probed) {
ctx->last_seqnum = seqnum;
- ctx->last_ts = ts;
+ ctx->last_ts = new_ts;
ctx->probed = TRUE;
return ctx->avg_packet_rate;
}
- new_ts = ctx->last_ts;
- gst_rtp_buffer_ext_timestamp (&new_ts, ts);
diff_seqnum = gst_rtp_buffer_compare_seqnum (ctx->last_seqnum, seqnum);
if (diff_seqnum <= 0 || new_ts <= ctx->last_ts) {
return ctx->avg_packet_rate;
@@ -64,6 +66,7 @@ gst_rtp_packet_rate_ctx_update (RTPPacketRateCtx * ctx, guint16 seqnum,
* but it will go down again slowly.
* This is useful for bursty cases, where a lot of packets are close
* to each other and should allow a higher reorder/dropout there.
+ * Round up the new average.
*/
if (ctx->avg_packet_rate > new_packet_rate) {
ctx->avg_packet_rate = (7 * ctx->avg_packet_rate + new_packet_rate + 7) / 8;