diff include/twjit.h @ 9:117fa99ff871

twjit: implement proper analytics
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 05 Jul 2024 23:49:37 +0000
parents 95f6c8ce33b0
children 4f82b9c07ddb
line wrap: on
line diff
--- a/include/twjit.h	Fri Jul 05 21:57:51 2024 +0000
+++ b/include/twjit.h	Fri Jul 05 23:49:37 2024 +0000
@@ -53,6 +53,18 @@
 };
 
 /*
+ * Info collected from the incoming RTP data stream
+ * for the purpose of generating RTCP reception report blocks.
+ */
+struct twrtp_jibuf_rr_info {
+	uint32_t rx_packets;
+	uint32_t base_seq;
+	uint32_t max_seq_ext;
+	uint32_t expected_pkt;
+	uint32_t jitter_accum;
+};
+
+/*
  * Each twjit instance has two sub-buffers; each subbuf is a queue of
  * received RTP packets that have the same SSRC and whose timestamps
  * increment in the expected cadence, with each ts delta being an
@@ -63,9 +75,7 @@
 	uint32_t head_ts;
 	struct llist_head queue;
 	uint32_t depth;
-	/* last packet arrival time, used only in starting state */
-	struct timeval last_arrival;
-	uint32_t delta_ms;
+	uint32_t delta_ms;		/* used only in starting state */
 	/* thinning mechanism */
 	uint16_t drop_int_count;
 	/* running config for this subbuf */
@@ -101,11 +111,15 @@
 	struct twrtp_jibuf_sub sb[2];
 	uint8_t read_sb;	/* 0 or 1 */
 	uint8_t write_sb;	/* ditto */
-	/* Rx packet stream analysis */
+	/* info about the most recent Rx packet */
 	uint32_t last_ssrc;
 	uint32_t last_ts;
 	uint16_t last_seq;
 	bool got_first_packet;
+	struct timespec last_arrival;
+	uint32_t last_arrival_delta;
+	/* analytics for RTCP RR */
+	struct twrtp_jibuf_rr_info rr_info;
 	/* stats over lifetime of this instance */
 	struct twrtp_jibuf_stats stats;
 };