diff pcap/rtp-cont-check.c @ 171:75607bc26f57

rtp-cont-check design change: print time deltas instead of checking against arbitrary thresholds
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 26 Dec 2022 21:35:09 +0000
parents b9af126bfddb
children 693a0958a303
line wrap: on
line diff
--- a/pcap/rtp-cont-check.c	Mon Dec 26 21:24:00 2022 +0000
+++ b/pcap/rtp-cont-check.c	Mon Dec 26 21:35:09 2022 +0000
@@ -1,10 +1,12 @@
 /*
  * This program reads a pcap file, extracts packets belonging to a
  * particular RTP stream as identified by a source or destination
- * IP:port, and checks its continuity: verifies that all sequence
- * numbers and timestamps increase monotonously without breaks,
- * and that the time delta between each consecutive pair of packets
- * is within GSM TCH multiframe jitter bounds of 20 ms.
+ * IP:port, and checks its continuity: verifies that the sequence
+ * number always increments by 1 and that the timestamp always
+ * increments by 160 units.  Finally, this program prints out
+ * the Rx time delta of each stream packet (the capture time of
+ * the current packet minus the capture time of the previous packet)
+ * on stdout, allowing visual timing analysis.
  *
  * The codec can be anything, and this program can also be used to
  * check continuity of RTP streams coming from PSTN/SIP, but the
@@ -32,10 +34,6 @@
 static unsigned last_seq, last_tstamp, stream_ssrc;
 static struct timeval last_pkt_time;
 
-/* usec jitter thresholds around 20 ms ideal */
-#define	DELTAT_MIN	18450
-#define	DELTAT_MAX	23090
-
 static void
 check_dl_type()
 {
@@ -107,18 +105,8 @@
 				pkt_idx);
 			exit(1);
 		}
-		if (deltat.tv_usec > DELTAT_MAX) {
-			fprintf(stderr,
-"packet #%u timing error: Rx time delta of %u us is above max threshold\n",
-				pkt_idx, (unsigned) deltat.tv_usec);
-			exit(1);
-		}
-		if (deltat.tv_usec < DELTAT_MIN) {
-			fprintf(stderr,
-"packet #%u timing error: Rx time delta of %u us is below min threshold\n",
-				pkt_idx, (unsigned) deltat.tv_usec);
-			exit(1);
-		}
+		printf("Packet #%u: time delta %u us\n", pkt_idx,
+			(unsigned) deltat.tv_usec);
 	} else {
 		stream_init_flag = 1;
 		stream_ssrc = cur_ssrc;