From f516cf141fee24a98bfed082c438d07585c4f478 Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Thu, 2 Dec 2004 08:38:59 +0000 Subject: From Francisco Alcoba: handle inverted time stamps without hanging. svn path=/trunk/; revision=12656 --- gtk/rtp_analysis.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gtk/rtp_analysis.c b/gtk/rtp_analysis.c index eaa9e98d4d..bce23cd2c4 100644 --- a/gtk/rtp_analysis.c +++ b/gtk/rtp_analysis.c @@ -299,6 +299,7 @@ typedef struct _tap_rtp_stat_t { #define STAT_FLAG_PT_CN 0x10 #define STAT_FLAG_FOLLOW_PT_CN 0x20 #define STAT_FLAG_REG_PT_CHANGE 0x40 +#define STAT_FLAG_WRONG_TIMESTAMP 0x80 typedef struct _tap_rtp_save_info_t { FILE *fp; @@ -652,13 +653,19 @@ static int rtp_packet_analyse(tap_rtp_stat_t *statinfo, } /* is it a packet with the mark bit set? */ if (rtpinfo->info_marker_set) { - statinfo->delta_timestamp = rtpinfo->info_timestamp - statinfo->timestamp; - statinfo->flags |= STAT_FLAG_MARKER; + if (rtpinfo->info_timestamp > statinfo->timestamp){ + statinfo->delta_timestamp = rtpinfo->info_timestamp - statinfo->timestamp; + statinfo->flags |= STAT_FLAG_MARKER; + } + else{ + statinfo->flags |= STAT_FLAG_WRONG_TIMESTAMP; + } } /* is it a regular packet? */ if (!(statinfo->flags & STAT_FLAG_FIRST) && !(statinfo->flags & STAT_FLAG_MARKER) && !(statinfo->flags & STAT_FLAG_PT_CN) + && !(statinfo->flags & STAT_FLAG_WRONG_TIMESTAMP) && !(statinfo->flags & STAT_FLAG_FOLLOW_PT_CN)) { /* include it in maximum delta calculation */ if (statinfo->delta > statinfo->max_delta) { @@ -788,6 +795,10 @@ static int rtp_packet_add_info(GtkCList *clist, g_snprintf(status,sizeof(status),"Payload changed to PT=%u", statinfo->pt); color = COLOR_WARNING; } + else if (statinfo->flags & STAT_FLAG_WRONG_TIMESTAMP) { + g_snprintf(status,sizeof(status),"Incorrect timestamp"); + color = COLOR_WARNING; + } else if ((statinfo->flags & STAT_FLAG_PT_CHANGE) && !(statinfo->flags & STAT_FLAG_FIRST) && !(statinfo->flags & STAT_FLAG_PT_CN) -- cgit v1.2.3