view mtctest/rtp_sink.c @ 8:a902ccbf6bbc

mtctest: introduce general user command structure
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 09 Jun 2024 02:48:55 +0000
parents 33d8b3177540
children
line wrap: on
line source

/*
 * In this module we implement our RTP handling: obtaining a GSM-side
 * RTP endpoint from themwi-rtp-mgr, then handling read select on RTP
 * and RTCP UDP sockets.
 */

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <strings.h>

#include <themwi/rtp/rtp_alloc_if.h>
#include <themwi/rtp/rtp_alloc_simple.h>

struct rtp_alloc_simple rtp_info;

void
obtain_rtp_endp()
{
	int rc;

	rc = rtp_alloc_simple(RTP_ALLOC_TYPE_GSM, &rtp_info);
	if (rc < 0)
		exit(1);	/* error msg already printed */
}

void
rtp_rx_select()
{
	u_char buf[512];

	recv(rtp_info.gsm_rtp_fd, buf, sizeof buf, 0);
}

void
rtcp_rx_select()
{
	u_char buf[512];

	recv(rtp_info.gsm_rtcp_fd, buf, sizeof buf, 0);
}