Calculate jitter and delta in ms.

svn path=/trunk/; revision=28546
This commit is contained in:
Anders Broman 2009-05-31 17:06:04 +00:00
parent 3e0d2b2707
commit 5ed6a83dff
3 changed files with 15 additions and 15 deletions

View File

@ -592,8 +592,8 @@ static int rtp_packet_add_info(GtkWidget *list, user_data_t * user_data,
else {
add_to_list(list, user_data,
pinfo->fd->num, rtpinfo->info_seq_num,
statinfo->delta*1000,
statinfo->jitter*1000,
statinfo->delta,
statinfo->jitter,
statinfo->bandwidth,
status,
rtpinfo->info_marker_set,
@ -2826,21 +2826,21 @@ static void draw_stat(user_data_t *user_data)
r_perc = 0;
}
g_snprintf(label_max, sizeof(label_max), "Max delta = %f sec at packet no. %u \n"
g_snprintf(label_max, sizeof(label_max), "Max delta = %f ms at packet no. %u \n"
"Total RTP packets = %u (expected %u) Lost RTP packets = %d (%.2f%%)"
" Sequence errors = %u",
user_data->forward.statinfo.max_delta, user_data->forward.statinfo.max_nr,
user_data->forward.statinfo.total_nr,
f_expected, f_lost, f_perc, user_data->forward.statinfo.sequence);
user_data->forward.statinfo.total_nr, f_expected, f_lost, f_perc,
user_data->forward.statinfo.sequence);
gtk_label_set_text(GTK_LABEL(user_data->dlg.label_stats_fwd), label_max);
g_snprintf(label_max, sizeof(label_max), "Max delta = %f sec at packet no. %u \n"
g_snprintf(label_max, sizeof(label_max), "Max delta = %f ms at packet no. %u \n"
"Total RTP packets = %u (expected %u) Lost RTP packets = %d (%.2f%%)"
" Sequence errors = %u",
user_data->reversed.statinfo.max_delta, user_data->reversed.statinfo.max_nr,
user_data->reversed.statinfo.total_nr,
r_expected, r_lost, r_perc, user_data->reversed.statinfo.sequence);
user_data->reversed.statinfo.total_nr, r_expected, r_lost, r_perc,
user_data->reversed.statinfo.sequence);
gtk_label_set_text(GTK_LABEL(user_data->dlg.label_stats_rev), label_max);

View File

@ -465,9 +465,9 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
clock_rate = 1;
}
/* store the current time and calculate the current jitter */
current_time = nstime_to_sec(&pinfo->fd->rel_ts);
current_diff = fabs (current_time - (statinfo->time) - ((double)(rtpinfo->info_timestamp)-(double)(statinfo->timestamp))/clock_rate);
/* 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;
statinfo->delta = current_time-(statinfo->time);
statinfo->jitter = current_jitter;
@ -477,7 +477,7 @@ int rtp_packet_analyse(tap_rtp_stat_t *statinfo,
statinfo->bw_history[statinfo->bw_index].bytes = rtpinfo->info_data_len + 28;
statinfo->bw_history[statinfo->bw_index].time = current_time;
/* check if there are more than 1sec in the history buffer to calculate BW in bps. If so, remove those for the calculation */
while ((statinfo->bw_history[statinfo->bw_start_index].time+1)<current_time){
while ((statinfo->bw_history[statinfo->bw_start_index].time+1000/* ms */)<current_time){
statinfo->total_bytes -= statinfo->bw_history[statinfo->bw_start_index].bytes;
statinfo->bw_start_index++;
if (statinfo->bw_start_index == BUFF_BW) statinfo->bw_start_index=0;

View File

@ -120,9 +120,9 @@ rtp_streams_stat_draw(void *arg _U_)
payload_type,
strinfo->npackets,
lost, perc,
strinfo->rtp_stats.max_delta*1000,
strinfo->rtp_stats.max_jitter*1000,
strinfo->rtp_stats.mean_jitter*1000,
strinfo->rtp_stats.max_delta,
strinfo->rtp_stats.max_jitter,
strinfo->rtp_stats.mean_jitter,
(strinfo->problem)?"X":"");
list = g_list_next(list);