# HG changeset patch # User Mychaela Falconia # Date 1720225764 0 # Node ID e60df79cbe9f9465d6feb55a077dfc5b16ba7e7e # Parent 117fa99ff871ac76c2a04cda9c2479c4e818b0fa twjit: eliminate dependency on libosmo-netif diff -r 117fa99ff871 -r e60df79cbe9f src/twjit_in.c --- a/src/twjit_in.c Fri Jul 05 23:49:37 2024 +0000 +++ b/src/twjit_in.c Sat Jul 06 00:29:24 2024 +0000 @@ -12,10 +12,15 @@ #include #include -/* FIXME: this libosmo-netif dependency needs to be removed */ -#include +#include -#include +struct rtp_basic_hdr { + uint8_t v_p_x_cc; + uint8_t m_pt; + uint16_t seq; + uint32_t tstamp; + uint32_t ssrc; +}; /* raw analytics on the Rx packet stream */ @@ -211,22 +216,23 @@ void twrtp_jibuf_input(struct twrtp_jibuf_inst *twjit, struct msgb *msg) { - struct rtp_hdr *rtph; + struct rtp_basic_hdr *rtph; uint32_t rx_ssrc, rx_ts; uint16_t rx_seq; struct timespec now; enum input_decision id; - rtph = osmo_rtp_get_hdr(msg); - if (!rtph) { - /* invalid packet, couldn't even get header from it */ - twjit->stats.bad_packets++; + if (msg->len < sizeof(struct rtp_basic_hdr)) { +inv_packet: twjit->stats.bad_packets++; msgb_free(msg); return; } + rtph = (struct rtp_basic_hdr *)msg->data; + if ((rtph->v_p_x_cc & 0xC0) != 0x80) /* version field */ + goto inv_packet; rx_ssrc = ntohl(rtph->ssrc); - rx_ts = ntohl(rtph->timestamp); - rx_seq = ntohs(rtph->sequence); + rx_ts = ntohl(rtph->tstamp); + rx_seq = ntohs(rtph->seq); osmo_clock_gettime(CLOCK_MONOTONIC, &now); if (!twjit->got_first_packet) { analytics_init(twjit, rx_seq);