comparison 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
comparison
equal deleted inserted replaced
8:95f6c8ce33b0 9:117fa99ff871
51 uint32_t intentional_gaps; 51 uint32_t intentional_gaps;
52 uint32_t ts_resets; 52 uint32_t ts_resets;
53 }; 53 };
54 54
55 /* 55 /*
56 * Info collected from the incoming RTP data stream
57 * for the purpose of generating RTCP reception report blocks.
58 */
59 struct twrtp_jibuf_rr_info {
60 uint32_t rx_packets;
61 uint32_t base_seq;
62 uint32_t max_seq_ext;
63 uint32_t expected_pkt;
64 uint32_t jitter_accum;
65 };
66
67 /*
56 * Each twjit instance has two sub-buffers; each subbuf is a queue of 68 * Each twjit instance has two sub-buffers; each subbuf is a queue of
57 * received RTP packets that have the same SSRC and whose timestamps 69 * received RTP packets that have the same SSRC and whose timestamps
58 * increment in the expected cadence, with each ts delta being an 70 * increment in the expected cadence, with each ts delta being an
59 * integral multiple of the samples-per-quantum constant. 71 * integral multiple of the samples-per-quantum constant.
60 */ 72 */
61 struct twrtp_jibuf_sub { 73 struct twrtp_jibuf_sub {
62 uint32_t ssrc; 74 uint32_t ssrc;
63 uint32_t head_ts; 75 uint32_t head_ts;
64 struct llist_head queue; 76 struct llist_head queue;
65 uint32_t depth; 77 uint32_t depth;
66 /* last packet arrival time, used only in starting state */ 78 uint32_t delta_ms; /* used only in starting state */
67 struct timeval last_arrival;
68 uint32_t delta_ms;
69 /* thinning mechanism */ 79 /* thinning mechanism */
70 uint16_t drop_int_count; 80 uint16_t drop_int_count;
71 /* running config for this subbuf */ 81 /* running config for this subbuf */
72 struct twrtp_jibuf_config conf; 82 struct twrtp_jibuf_config conf;
73 }; 83 };
99 /* operational state */ 109 /* operational state */
100 enum twrtp_jibuf_state state; 110 enum twrtp_jibuf_state state;
101 struct twrtp_jibuf_sub sb[2]; 111 struct twrtp_jibuf_sub sb[2];
102 uint8_t read_sb; /* 0 or 1 */ 112 uint8_t read_sb; /* 0 or 1 */
103 uint8_t write_sb; /* ditto */ 113 uint8_t write_sb; /* ditto */
104 /* Rx packet stream analysis */ 114 /* info about the most recent Rx packet */
105 uint32_t last_ssrc; 115 uint32_t last_ssrc;
106 uint32_t last_ts; 116 uint32_t last_ts;
107 uint16_t last_seq; 117 uint16_t last_seq;
108 bool got_first_packet; 118 bool got_first_packet;
119 struct timespec last_arrival;
120 uint32_t last_arrival_delta;
121 /* analytics for RTCP RR */
122 struct twrtp_jibuf_rr_info rr_info;
109 /* stats over lifetime of this instance */ 123 /* stats over lifetime of this instance */
110 struct twrtp_jibuf_stats stats; 124 struct twrtp_jibuf_stats stats;
111 }; 125 };
112 126
113 /* twjit module API functions */ 127 /* twjit module API functions */