aboutsummaryrefslogtreecommitdiffstats
path: root/tap-rtp-common.c
diff options
context:
space:
mode:
authorAnders Broman <anders.broman@ericsson.com>2009-06-01 16:44:05 +0000
committerAnders Broman <anders.broman@ericsson.com>2009-06-01 16:44:05 +0000
commitae260ddd2b29450ef9cee2466c0dc47ad81606cd (patch)
tree18e397e6bca4237c1ef314b211c3f14febcf4c53 /tap-rtp-common.c
parent0b12155a9ad5661a72eaaebf1a82974f5d477db1 (diff)
Show max and mean Jitter.
svn path=/trunk/; revision=28560
Diffstat (limited to 'tap-rtp-common.c')
-rw-r--r--tap-rtp-common.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/tap-rtp-common.c b/tap-rtp-common.c
index 76db0e1cda..b8d8a60825 100644
--- a/tap-rtp-common.c
+++ b/tap-rtp-common.c
@@ -438,9 +438,11 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
double current_time;
double current_jitter;
double current_diff;
+ double expected_time;
guint32 clock_rate;
statinfo->flags = 0;
+
/* check payload type */
if (rtpinfo->info_payload_type == PT_CN
|| rtpinfo->info_payload_type == PT_CN_OLD)
@@ -467,8 +469,11 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
/* Store the current time and calculate the current jitter(in ms) */
current_time = nstime_to_msec(&pinfo->fd->rel_ts);
- current_diff = fabs (current_time - (statinfo->time) - ((double)(rtpinfo->info_timestamp)-(double)(statinfo->timestamp))/(clock_rate*1000));
- current_jitter = statinfo->jitter + ( current_diff - statinfo->jitter)/16;
+ /* Expected time is last arrival time + the timestamp difference divided by the sampling clock( /1000 to get ms) */
+ expected_time = statinfo->time + ((double)(rtpinfo->info_timestamp)-(double)(statinfo->timestamp))/(clock_rate/1000);
+ current_diff = fabs(current_time - expected_time);
+ current_jitter = (15 * statinfo->jitter + current_diff) / 16;
+
statinfo->delta = current_time-(statinfo->time);
statinfo->jitter = current_jitter;
statinfo->diff = current_diff;