aboutsummaryrefslogtreecommitdiffstats
path: root/ui/tap-rtp-analysis.c
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-07-10 21:19:15 -0400
committerJohn Thacker <johnthacker@gmail.com>2023-07-14 18:02:25 +0000
commit1c386645df044c7c12cbf9982423665884de13da (patch)
tree9e1a68b7b3ae074edeed8660daa3925d9b624405 /ui/tap-rtp-analysis.c
parent61ef5f756464b79b04c051ebc6ded91c16530c18 (diff)
RTP Analysis: Fix jitter for packets before the previous one
After 15013ab13626d86b6fa3559eff49a768092f1b7f, the expected time of arrival is compared to the previous packet, in an effort to handle clock changes better. If we're doing so, then there's some chance that the expected time arrival moves backwards. That's not a problem for the calculation, so long as we cast to signed integers at some point.
Diffstat (limited to 'ui/tap-rtp-analysis.c')
-rw-r--r--ui/tap-rtp-analysis.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/ui/tap-rtp-analysis.c b/ui/tap-rtp-analysis.c
index 11f37b2da5..4a1c3d5875 100644
--- a/ui/tap-rtp-analysis.c
+++ b/ui/tap-rtp-analysis.c
@@ -27,7 +27,6 @@
#include <epan/addr_resolv.h>
#include <epan/proto_data.h>
#include <epan/dissectors/packet-rtp.h>
-#include <wsutil/pint.h>
#include "rtp_stream.h"
#include "tap-rtp-common.h"
#include "tap-rtp-analysis.h"
@@ -363,8 +362,18 @@ rtppacket_analyse(tap_rtp_stat_t *statinfo,
}
/* diff/jitter/skew calculations are done just for in sequence packets */
- if ( in_time_sequence ) {
- nominaltime_diff = (double)(guint32_wraparound_diff(rtpinfo->info_timestamp, statinfo->seq_timestamp));
+ /* Note, "in_time_sequence" just means relative to the first packet in
+ * stream (within 0x80000000), excluding packets that are before the first
+ * packet in timestamp (or implausibly far away.)
+ * XXX: Do we really need to exclude those? The underlying problem in
+ * #16330 was not allowing the time difference to be negative.
+ */
+ if ( in_time_sequence || TRUE ) {
+ /* XXX: We try to handle clock rate changes, but if the clock rate
+ * changed during a dropped packet (or if we go backwards because
+ * a packet is reorderd), it won't be quite right.
+ */
+ nominaltime_diff = (double)(TIMESTAMP_DIFFERENCE(statinfo->seq_timestamp, rtpinfo->info_timestamp));
/* Can only analyze defined sampling rates */
if (clock_rate != 0) {