Commit Graph

12 Commits

Author SHA1 Message Date
Holger Hans Peter Freyther 4680121fe6 mgcp: Deal with receiving another payload type
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-02 09:27:45 +02:00
Holger Hans Peter Freyther cac2438b0c mgcp: Move the "codec" params to a struct
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-02 08:25:49 +02:00
Holger Hans Peter Freyther 3713f78ac2 mgcp: Use the rtp_hdr structure and extract ts/seq from there
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-09-02 08:25:49 +02:00
Holger Hans Peter Freyther b936278b2e mgcp: Fix/test the case of a time jump and the resync
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-22 14:48:07 +02:00
Holger Hans Peter Freyther c8b29083d2 mgcp: Initialise next_time in case the initial timestamp is not 0. 2014-07-22 14:48:07 +02:00
Holger Hans Peter Freyther bd4109babc mgcp: Document transcoding semantic and follow it
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-22 14:42:53 +02:00
Holger Hans Peter Freyther 91eeeae312 mgcp: Fix/test reading/writing the sequence number
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-22 14:31:35 +02:00
Holger Hans Peter Freyther 77ceaaf7f5 mgcp: Add a comment about the return of the function 2014-07-22 13:51:39 +02:00
Holger Hans Peter Freyther dd1f81512d mgcp: Make the internal state of the transcoder accessible
For the unit tests we need to look at the internal state.
2014-07-22 13:12:19 +02:00
Holger Hans Peter Freyther e52ca9aad1 mgcp: Warn when the buffer is being reset due a wrong seq number
When the sample buffer is being dropped write a warning so we can
see how often this event occurs.
2014-07-22 12:41:48 +02:00
Holger Hans Peter Freyther c5c239f361 mgcp: Fix memory leak in the transcoding code
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-07-22 12:40:59 +02:00
Jacob Erlbeck 909fac6689 mgcp: Move transcoding to libmgcp
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
2014-06-05 14:08:53 +02:00