# HG changeset patch # User Mychaela Falconia # Date 1720333676 0 # Node ID 9e477a4b485a55dfcb07ac163703f20738cb25be # Parent 587437b62ed5d06b699c3dbc0bae247b1ca23acf endp: implement RTP Rx diff -r 587437b62ed5 -r 9e477a4b485a src/Makefile --- a/src/Makefile Sun Jul 07 04:33:55 2024 +0000 +++ b/src/Makefile Sun Jul 07 06:27:56 2024 +0000 @@ -1,5 +1,5 @@ -OBJS= bind_fdpair.o endp_bind.o endp_create.o endp_register.o set_remote.o \ - twjit.o twjit_in.o twjit_out.o twjit_vty.o +OBJS= bind_fdpair.o endp_bind.o endp_create.o endp_register.o rtp_rx.o \ + set_remote.o twjit.o twjit_in.o twjit_out.o twjit_vty.o LIB= libtwrtp.a include ../config.defs diff -r 587437b62ed5 -r 9e477a4b485a src/rtp_rx.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/rtp_rx.c Sun Jul 07 06:27:56 2024 +0000 @@ -0,0 +1,42 @@ +/* + * Here we implement RTP Rx path via osmo_io callback. + */ + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include "endp_internal.h" + +static void rtp_rx_cb(struct osmo_io_fd *iofd, int res, struct msgb *msg, + const struct osmo_sockaddr *saddr) +{ + struct twrtp_endp *endp = osmo_iofd_get_data(iofd); + + if (!msg) + return; + if (!endp->remote_set) { + msgb_free(msg); + return; + } + if (osmo_sockaddr_cmp(saddr, &endp->rtp_remote)) { + endp->stats.rx_rtp_badsrc++; + msgb_free(msg); + return; + } + endp->stats.rx_rtp_pkt++; + if (endp->rx_enable) + twrtp_jibuf_input(endp->twjit, msg); + else + msgb_free(msg); +} + +const struct osmo_io_ops _twrtp_endp_iops_rtp = { + .recvfrom_cb = rtp_rx_cb, +};