summaryrefslogtreecommitdiffstats
path: root/gst/rtpmanager
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-08-31 13:02:16 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2009-08-31 13:02:16 +0200
commita26a2a9ff535895cb48ae788266e918c13788b81 (patch)
treec060c428a182fd40b85c552e546893ec9f67093d /gst/rtpmanager
parent4814d899c27df764e2e9ad15a0765235d59abc22 (diff)
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.
Diffstat (limited to 'gst/rtpmanager')
-rw-r--r--gst/rtpmanager/rtpjitterbuffer.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/gst/rtpmanager/rtpjitterbuffer.c b/gst/rtpmanager/rtpjitterbuffer.c
index 55e084f3..a38c2141 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. */