[gst-cvs] gst-plugins-good: jitterbuffer: add slope estimation code and debug
Wim Taymans
wtay at kemper.freedesktop.org
Mon Aug 31 04:03:34 PDT 2009
Module: gst-plugins-good
Branch: master
Commit: a26a2a9ff535895cb48ae788266e918c13788b81
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-good/commit/?id=a26a2a9ff535895cb48ae788266e918c13788b81
Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date: Mon Aug 31 13:02:16 2009 +0200
jitterbuffer: add slope estimation code and debug
Add some code to measure the sender speed vs the receiver speed. This can be
used to detect bursts.
---
gst/rtpmanager/rtpjitterbuffer.c | 17 +++++++++++++----
1 files changed, 13 insertions(+), 4 deletions(-)
diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c
index 55e084f..a38c214 100644
--- a/gst/rtpmanager/rtpjitterbuffer.c
+++ b/gst/rtpmanager/rtpjitterbuffer.c
@@ -203,6 +203,7 @@ calculate_skew (RTPJitterBuffer * jbuf, guint32 rtptime, GstClockTime time,
gint64 old;
gint pos, i;
GstClockTime gstrtptime, out_time;
+ guint64 slope;
ext_rtptime = gst_rtp_buffer_ext_timestamp (&jbuf->ext_rtptime, rtptime);
@@ -258,13 +259,21 @@ calculate_skew (RTPJitterBuffer * jbuf, guint32 rtptime, GstClockTime time,
/* elapsed time at receiver, includes the jitter */
recv_diff = time - jbuf->base_time;
- GST_DEBUG ("time %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT ", recv_diff %"
- GST_TIME_FORMAT, GST_TIME_ARGS (time), GST_TIME_ARGS (jbuf->base_time),
- GST_TIME_ARGS (recv_diff));
-
/* measure the diff */
delta = ((gint64) recv_diff) - ((gint64) send_diff);
+ /* measure the slope, this gives a rought estimate between the sender speed
+ * and the receiver speed. This should be approximately 8, higher values
+ * indicate a burst (especially when the connection starts) */
+ if (recv_diff > 0)
+ slope = (send_diff * 8) / recv_diff;
+ else
+ slope = 8;
+
+ GST_DEBUG ("time %" GST_TIME_FORMAT ", base %" GST_TIME_FORMAT ", recv_diff %"
+ GST_TIME_FORMAT ", slope %" G_GUINT64_FORMAT, GST_TIME_ARGS (time),
+ GST_TIME_ARGS (jbuf->base_time), GST_TIME_ARGS (recv_diff), slope);
+
/* if the difference between the sender timeline and the receiver timeline
* changed too quickly we have to resync because the server likely restarted
* its timestamps. */
More information about the Gstreamer-commits
mailing list