From 42a833e89f443116fb165c35654c9f21ceed6876 Mon Sep 17 00:00:00 2001 From: Jacob Erlbeck Date: Mon, 14 Apr 2014 10:31:47 +0200 Subject: mgcp: Add packet size (ptime) conversion The current transcoder implemenation always does a 1:1 recoding concerning the duration of a packet. So RTP timestamps and sequence numbers are not modified. This is not sufficient in some cases, e.g. when the BTS does only allow for a single fixed ptime. This patch decouples encoding from decoding and moves the decoded samples to the state structure so that samples can be combined or drain according to the packaging of incoming and outgoing packets. This patch incorporates parts of Holger's experimental fixes in 0e669e05^..9eba68f9. Ticket: OW#1111 Sponsored-by: On-Waves ehf --- openbsc/include/openbsc/mgcp.h | 5 ++++- openbsc/include/openbsc/mgcp_internal.h | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'openbsc/include/openbsc') diff --git a/openbsc/include/openbsc/mgcp.h b/openbsc/include/openbsc/mgcp.h index 002dd7c6e..d4d614099 100644 --- a/openbsc/include/openbsc/mgcp.h +++ b/openbsc/include/openbsc/mgcp.h @@ -87,7 +87,8 @@ typedef int (*mgcp_policy)(struct mgcp_trunk_config *cfg, int endpoint, int stat typedef int (*mgcp_reset)(struct mgcp_trunk_config *cfg); typedef int (*mgcp_rqnt)(struct mgcp_endpoint *endp, char tone); -typedef int (*mgcp_processing)(struct mgcp_rtp_end *dst_end, +typedef int (*mgcp_processing)(struct mgcp_endpoint *endp, + struct mgcp_rtp_end *dst_end, char *data, int *len, int buf_size); typedef int (*mgcp_processing_setup)(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, @@ -181,6 +182,8 @@ struct mgcp_config { struct mgcp_port_range transcoder_ports; int endp_dscp; + int bts_force_ptime; + mgcp_change change_cb; mgcp_policy policy_cb; mgcp_reset reset_cb; diff --git a/openbsc/include/openbsc/mgcp_internal.h b/openbsc/include/openbsc/mgcp_internal.h index ac136a377..9f0c0f9e2 100644 --- a/openbsc/include/openbsc/mgcp_internal.h +++ b/openbsc/include/openbsc/mgcp_internal.h @@ -89,6 +89,7 @@ struct mgcp_rtp_end { char *audio_name; char *subtype_name; int output_enabled; + int force_output_ptime; /* RTP patching */ int force_constant_ssrc; /* -1: always, 0: don't, 1: once */ @@ -210,7 +211,7 @@ void mgcp_state_calc_loss(struct mgcp_rtp_state *s, struct mgcp_rtp_end *, uint32_t mgcp_state_calc_jitter(struct mgcp_rtp_state *); /* payload processing default functions */ -int mgcp_rtp_processing_default(struct mgcp_rtp_end *dst_end, +int mgcp_rtp_processing_default(struct mgcp_endpoint *endp, struct mgcp_rtp_end *dst_end, char *data, int *len, int buf_size); int mgcp_setup_rtp_processing_default(struct mgcp_endpoint *endp, -- cgit v1.2.3