aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_network.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2014-03-13 14:24:52 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2014-06-05 12:19:46 +0200
commita0d64ce063fbf60733c6f2949015091aa33a2c9d (patch)
tree418bb62907a3c135017865d6cae592b535b3175a /openbsc/src/libmgcp/mgcp_network.c
parentb492d39177f6df893772ee6c7c37f51caa9f0d64 (diff)
mgcp: Add callbacks for payload processing
This patch adds the callbacks rtp_processing_cb and setup_rtp_processing_cb to mgcp_config to support arbitrary RTP payload processing. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_network.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 5e8284d..393a9e5 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -79,6 +79,7 @@ struct rtp_hdr {
#define RTP_SEQ_MOD (1 << 16)
#define RTP_MAX_DROPOUT 3000
#define RTP_MAX_MISORDER 100
+#define RTP_BUF_SIZE 4096
enum {
MGCP_PROTO_RTP,
@@ -339,6 +340,18 @@ static int align_rtp_timestamp_offset(struct mgcp_endpoint *endp,
return timestamp_error;
}
+int mgcp_rtp_processing_default(struct mgcp_rtp_end *dst_end,
+ char *data, int *len, int buf_size)
+{
+ return 0;
+}
+
+int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp,
+ struct mgcp_rtp_end *dst_end,
+ struct mgcp_rtp_end *src_end)
+{
+ return 0;
+}
/**
* The RFC 3550 Appendix A assumes there are multiple sources but
@@ -589,6 +602,7 @@ int mgcp_send(struct mgcp_endpoint *endp, int dest, int is_rtp,
rtp_end->dropped_packets += 1;
else if (is_rtp) {
mgcp_patch_and_count(endp, rtp_state, rtp_end, addr, buf, rc);
+ endp->cfg->rtp_processing_cb(rtp_end, buf, &rc, RTP_BUF_SIZE);
forward_data(rtp_end->rtp.fd, &endp->taps[tap_idx], buf, rc);
return mgcp_udp_send(rtp_end->rtp.fd,
&rtp_end->addr,
@@ -627,7 +641,7 @@ static int receive_from(struct mgcp_endpoint *endp, int fd, struct sockaddr_in *
static int rtp_data_net(struct osmo_fd *fd, unsigned int what)
{
- char buf[4096];
+ char buf[RTP_BUF_SIZE];
struct sockaddr_in addr;
struct mgcp_endpoint *endp;
int rc, proto;
@@ -723,7 +737,7 @@ static void discover_bts(struct mgcp_endpoint *endp, int proto, struct sockaddr_
static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
{
- char buf[4096];
+ char buf[RTP_BUF_SIZE];
struct sockaddr_in addr;
struct mgcp_endpoint *endp;
int rc, proto;
@@ -790,7 +804,7 @@ static int rtp_data_bts(struct osmo_fd *fd, unsigned int what)
static int rtp_data_transcoder(struct mgcp_rtp_end *end, struct mgcp_endpoint *_endp,
int dest, struct osmo_fd *fd)
{
- char buf[4096];
+ char buf[RTP_BUF_SIZE];
struct sockaddr_in addr;
struct mgcp_config *cfg;
int rc, proto;