aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_transcode.c
AgeCommit message (Collapse)AuthorFilesLines
2016-03-16mgcp: Fix compiler warnings on size_t on AMD64Holger Hans Peter Freyther1-4/+4
mgcp_transcode.c: In function 'decode_audio': mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_ERROR, ^ mgcp_transcode.c:332:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'long unsigned int' [-Wformat=] mgcp_transcode.c: In function 'encode_audio': mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_INFO, ^ mgcp_transcode.c:390:4: warning: format '%d' expects argument of type 'int', but argument 8 has type 'size_t' [-Wformat=] mgcp_transcode.c: In function 'mgcp_transcoding_process_rtp': mgcp_transcode.c:542:5: warning: format '%d' expects argument of type 'int', but argument 9 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^ mgcp_transcode.c:571:4: warning: format '%d' expects argument of type 'int', but argument 7 has type 'size_t' [-Wformat=] LOGP(DMGCP, LOGL_NOTICE, ^
2015-08-19mgcp: Add transcoding from PCMU as wellHolger Hans Peter Freyther1-0/+26
Use the existing ulaw encode/decode to support PCMU as well. The MERA VoIP switch has some severe issues with the GSM codec and it appears easier to enable transcoding for it. The mera switch doesn't appear to cope with codec change between a SIP 180 trying and the 200 ok connection result. Inserting the codec is touching too many places. Ideally we should have the transcoding function as pointer in the struct as well but the arguments differ.. so it is not a direct way forward.
2015-04-28mgcp: Move assignment of src_codec downwardsJacob Erlbeck1-1/+2
Currently the src_codec const variable is set to &src_end->codec before src_end is checked against NULL. Since the assigment is just an address operation and the memory where it points to is only accessed after the NULL check, this does not harm technically. Nevertheless this is potential source for errors if that code is changed. This commit moves the definition below the NULL check. This does not comply with the coding style, but it cannot be split into definition and a later assignment due to the const qualifier. Sponsored-by: On-Waves ehf
2015-04-24mgcp: Allow to disable transcoding for trunksHolger Hans Peter Freyther1-0/+7
We might have compiled transcoding into the MGW but we don't want to enable it for a given user. Add a new switch that should allow that. I had manually tested the allow-transcoding/no allow VTY interface for the primary interface and a new trunk using show running-config.
2015-04-24mgcp: Ignore the case for finding a codecHolger Hans Peter Freyther1-5/+5
It is unlikely that GSM, gsm and GsM refer to different codecs. The mera mvts does send the audio codecs in lower case even if RFC 3551 has them in upper case (but copy and paste is sometimes too hard).
2015-03-22rtp: Catch up with the removal of the rtp.hHolger Hans Peter Freyther1-1/+1
2014-09-02mgcp: Deal with receiving another payload typeHolger Hans Peter Freyther1-1/+53
In case we get offered G729 and G711 we might have selected G729 as the audio codec. The first packet we receive might be G711 though. In that case we will need to change. But only if we have a matching alternate codec payload_type. E.g. in the case of comfort noise we will receive the PT=11 and we don't want to change.
2014-09-02mgcp: Move the "codec" params to a structHolger Hans Peter Freyther1-23/+28
We might be offered multiple codecs by the remote and need to switch between them once we receive data. Do this by moving it to a struct so we can separate between proposed and current codec. In SDP we can have multiple codecs but a global ptime. The current code doesn't separate that clearly instead we write it to the main codec.
2014-09-02mgcp: Use the rtp_hdr structure and extract ts/seq from thereHolger Hans Peter Freyther1-6/+8
Use the rtp_hdr structure. The basic alignment issue remains and I need to merge/cherry-pick Jacob's getters for the ts, sequence number and other attributes.
2014-07-22mgcp: Fix/test the case of a time jump and the resyncHolger Hans Peter Freyther1-0/+1
In case the sender didn't send a couple of frames we will have a time gap that is bigger than the accepted delta. Add a new testcase for this and update the next_time.
2014-07-22mgcp: Initialise next_time in case the initial timestamp is not 0.Holger Hans Peter Freyther1-2/+4
2014-07-22mgcp: Document transcoding semantic and follow itHolger Hans Peter Freyther1-1/+8
Transcoding from GSM to PCMA can lead to the MGCP MGW sending two PCMA packages with the same sequence number and timestamp. Once with the encoded audio and once completely empty. This is because "state->dst_packet_duration" is 0 in most cases (unless a ptime is forced) and we attempt to encode audio even if there are not enough samples. The encode_audio return will return 0 in that case which is not trated as an error by the mgcp network code. Handle rc == 0 specially and document the semantic.
2014-07-22mgcp: Fix/test reading/writing the sequence numberHolger Hans Peter Freyther1-2/+2
The sequence number was read from the wrong place and then the wrong byte order conversion routine was used so we ended up wirting 0x00, 0x00 into the patched sequence number. Add a testcase for that.
2014-07-22mgcp: Add a comment about the return of the functionHolger Hans Peter Freyther1-0/+5
2014-07-22mgcp: Make the internal state of the transcoder accessibleHolger Hans Peter Freyther1-50/+1
For the unit tests we need to look at the internal state.
2014-07-22mgcp: Warn when the buffer is being reset due a wrong seq numberHolger Hans Peter Freyther1-2/+5
When the sample buffer is being dropped write a warning so we can see how often this event occurs.
2014-07-22mgcp: Fix memory leak in the transcoding codeHolger Hans Peter Freyther1-1/+1
The GSM handle was never released. This was found using valgrind and the leak check. ==14933== 752 bytes in 1 blocks are definitely lost in loss record 15 of 19 ==14933== at 0x4028B4C: malloc (in /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so) ==14933== by 0x4130201: gsm_create (in /usr/lib/i386-linux-gnu/libgsm.so.1.0.12) ==14933== by 0x80517AE: mgcp_transcoding_setup (mgcp_transcode.c:199) ==14933== by 0x8049691: given_configured_endpoint.isra.1 (mgcp_transcoding_test.c:198) ==14933== by 0x8049C11: test_transcode_result (mgcp_transcoding_test.c:328) ==14933== by 0x8049418: main (mgcp_transcoding_test.c:582)
2014-06-05mgcp: Move transcoding to libmgcpJacob Erlbeck1-0/+550
This patch moves the files relevant to transcoding from src/osmo-bsc_mgcp to src/libmgcp and src/include/openbsc. Makefiles and include directives are being updated accordingly. Sponsored-by: On-Waves ehf