FreeCalypso > hg > themwi-rtp-lib
diff src/twjit_in.c @ 10:e60df79cbe9f
twjit: eliminate dependency on libosmo-netif
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Sat, 06 Jul 2024 00:29:24 +0000 |
parents | 117fa99ff871 |
children | 4f82b9c07ddb |
line wrap: on
line diff
--- 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 <osmocom/core/timer.h> #include <osmocom/core/utils.h> -/* FIXME: this libosmo-netif dependency needs to be removed */ -#include <osmocom/netif/rtp.h> +#include <themwi/rtp/twjit.h> -#include <themwi/rtp/twjit.h> +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);