diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-04-14 10:31:47 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-06-05 14:08:45 +0200 |
commit | 42a833e89f443116fb165c35654c9f21ceed6876 (patch) | |
tree | 12c99fe7ba58aa888147366a46f04feddf61d903 /openbsc/src/libmgcp/mgcp_protocol.c | |
parent | 136a319e910eec81ea9ff8f8a34c324557109d03 (diff) |
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
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_protocol.c')
-rw-r--r-- | openbsc/src/libmgcp/mgcp_protocol.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/openbsc/src/libmgcp/mgcp_protocol.c b/openbsc/src/libmgcp/mgcp_protocol.c index 6e974f147..21b9ff0f8 100644 --- a/openbsc/src/libmgcp/mgcp_protocol.c +++ b/openbsc/src/libmgcp/mgcp_protocol.c @@ -621,6 +621,15 @@ static int set_audio_info(void *ctx, struct mgcp_rtp_end *rtp, rtp->channels = channels; rtp->subtype_name = talloc_strdup(ctx, audio_codec); rtp->audio_name = talloc_strdup(ctx, audio_name); + + if (!strcmp(audio_codec, "G729")) { + rtp->frame_duration_num = 10; + rtp->frame_duration_den = 1000; + } else { + rtp->frame_duration_num = DEFAULT_RTP_AUDIO_FRAME_DUR_NUM; + rtp->frame_duration_den = DEFAULT_RTP_AUDIO_FRAME_DUR_DEN; + } + if (channels != 1) LOGP(DMGCP, LOGL_NOTICE, "Channels != 1 in SDP: '%s'\n", audio_name); @@ -944,11 +953,16 @@ mgcp_header_done: set_audio_info(p->cfg, &endp->bts_end, tcfg->audio_payload, tcfg->audio_name); endp->bts_end.fmtp_extra = talloc_strdup(tcfg->endpoints, tcfg->audio_fmtp_extra); - if (have_sdp) { + if (have_sdp) parse_sdp_data(&endp->net_end, p); - setup_rtp_processing(endp); + + if (p->cfg->bts_force_ptime) { + endp->bts_end.packet_duration_ms = p->cfg->bts_force_ptime; + endp->bts_end.force_output_ptime = 1; } + setup_rtp_processing(endp); + /* policy CB */ if (p->cfg->policy_cb) { int rc; |