@@ -1,3 +1,4 @@
enable_nat_test='@osmo_ac_build_nat@'
enable_smpp_test='@osmo_ac_build_smpp@'
enable_bsc_test='@osmo_ac_build_bsc@'
+enable_mgcp_transcoding_test='@osmo_ac_mgcp_transcoding@'
@@ -1,11 +1,15 @@
-AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include
-AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(COVERAGE_CFLAGS)
+AM_CPPFLAGS = $(all_includes) -I$(top_srcdir)/include -I$(top_srcdir)
+AM_CFLAGS=-Wall -ggdb3 $(LIBOSMOCORE_CFLAGS) $(LIBOSMOSCCP_CFLAGS) $(COVERAGE_CFLAGS) $(LIBBCG729_CFLAGS)
AM_LDFLAGS = $(COVERAGE_LDFLAGS)
-EXTRA_DIST = mgcp_test.ok
+EXTRA_DIST = mgcp_test.ok mgcp_transcoding_test.ok
noinst_PROGRAMS = mgcp_test
+if BUILD_MGCP_TRANSCODING
+noinst_PROGRAMS += mgcp_transcoding_test
+endif
+
mgcp_test_SOURCES = mgcp_test.c
mgcp_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
@@ -13,3 +17,12 @@ mgcp_test_LDADD = $(top_builddir)/src/libbsc/libbsc.a \
$(top_builddir)/src/libcommon/libcommon.a \
$(LIBOSMOCORE_LIBS) -lrt -lm $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) \
$(LIBRARY_DL)
+
+mgcp_transcoding_test_SOURCES = mgcp_transcoding_test.c $(top_builddir)/src/osmo-bsc_mgcp/mgcp_transcode.c
+
+mgcp_transcoding_test_LDADD = \
+ $(top_builddir)/src/libbsc/libbsc.a \
+ $(top_builddir)/src/libmgcp/libmgcp.a \
+ $(top_builddir)/src/libcommon/libcommon.a \
+ $(LIBOSMOCORE_LIBS) $(LIBBCG729_LIBS) -lrt -lm $(LIBOSMOSCCP_LIBS) $(LIBOSMOVTY_LIBS) \
+ $(LIBRARY_DL)
new file mode 100644
@@ -0,0 +1,377 @@
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+#include <err.h>
+
+#include <osmocom/core/talloc.h>
+#include <osmocom/core/application.h>
+
+#include <openbsc/debug.h>
+#include <openbsc/gsm_data.h>
+#include <openbsc/mgcp.h>
+#include <openbsc/mgcp_internal.h>
+
+#include "bscconfig.h"
+#ifndef BUILD_MGCP_TRANSCODING
+#error "Requires MGCP transcoding enabled (see --enable-mgcp-transcoding)"
+#endif
+
+#include "src/osmo-bsc_mgcp/mgcp_transcode.h"
+
+uint8_t *audio_frame_l16[] = {
+};
+
+struct rtp_packets {
+ float t;
+ int len;
+ char *data;
+};
+
+struct rtp_packets audio_packets_l16[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 332,
+ "\x80\x0B\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ "\x00\x00\x40\x13\x5A\x9E\x40\x13\x00\x00\xBF\xED\xA5\x62\xBF\xED"
+ },
+};
+
+struct rtp_packets audio_packets_gsm[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 45,
+ "\x80\x03\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xD4\x7C\xE3\xE9\x62\x50\x39\xF0\xF8\xB4\x68\xEA\x6C\x0E\x81\x1B"
+ "\x56\x2A\xD5\xBC\x69\x9C\xD1\xF0\x66\x7A\xEC\x49\x7A\x33\x3D\x0A"
+ "\xDE"
+ },
+};
+
+struct rtp_packets audio_packets_gsm_invalid_size[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 41,
+ "\x80\x03\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xD4\x7C\xE3\xE9\x62\x50\x39\xF0\xF8\xB4\x68\xEA\x6C\x0E\x81\x1B"
+ "\x56\x2A\xD5\xBC\x69\x9C\xD1\xF0\x66\x7A\xEC\x49\x7A\x33\x3D\x0A"
+ "\xDE"
+ },
+};
+
+struct rtp_packets audio_packets_gsm_invalid_data[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 45,
+ "\x80\x03\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+ "\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE\xEE"
+ "\xEE"
+ },
+};
+
+struct rtp_packets audio_packets_gsm_invalid_ptype[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 45,
+ "\x80\x08\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xD4\x7C\xE3\xE9\x62\x50\x39\xF0\xF8\xB4\x68\xEA\x6C\x0E\x81\x1B"
+ "\x56\x2A\xD5\xBC\x69\x9C\xD1\xF0\x66\x7A\xEC\x49\x7A\x33\x3D\x0A"
+ "\xDE"
+ },
+};
+
+struct rtp_packets audio_packets_g729[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 32,
+ "\x80\x12\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xAF\xC2\x81\x40\x00\xFA\xCE\xA4\x21\x7C\xC5\xC3\x4F\xA5\x98\xF5"
+ "\xB2\x95\xC4\xAD"
+ },
+};
+
+struct rtp_packets audio_packets_pcma[] = {
+ /* RTP: SeqNo=1, TS=160 */
+ {0.020000, 172,
+ "\x80\x08\x00\x01\x00\x00\x00\xA0\x11\x22\x33\x44"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ "\xD5\xA5\xA3\xA5\xD5\x25\x23\x25\xD5\xA5\xA3\xA5\xD5\x25\x23\x25"
+ },
+};
+
+
+
+static int audio_name_to_type(const char *name)
+{
+ if (!strcasecmp(name, "gsm"))
+ return 3;
+#ifdef HAVE_BCG729
+ else if (!strcasecmp(name, "g729"))
+ return 18;
+#endif
+ else if (!strcasecmp(name, "pcma"))
+ return 8;
+ else if (!strcasecmp(name, "l16"))
+ return 11;
+ return -1;
+}
+
+int mgcp_get_trans_frame_size(void *state_, int nsamples, int dst);
+
+static int transcode_test(const char *srcfmt, const char *dstfmt,
+ uint8_t *src_pkts, size_t src_pkt_size)
+{
+ char buf[4096] = {0x80, 0};
+ int rc;
+ struct mgcp_rtp_end *dst_end;
+ struct mgcp_rtp_end *src_end;
+ struct mgcp_trunk_config tcfg = {{0}};
+ struct mgcp_endpoint endp = {0};
+ struct mgcp_process_rtp_state *state;
+ int in_size;
+ int in_samples = 160;
+ int len, cont;
+
+ printf("== Transcoding test ==\n");
+ printf("converting %s -> %s\n", srcfmt, dstfmt);
+
+ tcfg.endpoints = &endp;
+ tcfg.number_endpoints = 1;
+ endp.tcfg = &tcfg;
+ mgcp_free_endp(&endp);
+
+ dst_end = &endp.bts_end;
+ src_end = &endp.net_end;
+
+ src_end->payload_type = audio_name_to_type(srcfmt);
+ dst_end->payload_type = audio_name_to_type(dstfmt);
+
+ rc = mgcp_transcoding_setup(&endp, dst_end, src_end);
+ if (rc < 0)
+ errx(1, "setup failed: %s", strerror(-rc));
+
+ state = dst_end->rtp_process_data;
+ OSMO_ASSERT(state != NULL);
+
+ in_size = mgcp_transcoding_get_frame_size(state, in_samples, 0);
+ OSMO_ASSERT(sizeof(buf) >= in_size + 12);
+
+ memcpy(buf, src_pkts, src_pkt_size);
+
+ len = src_pkt_size;
+
+ cont = mgcp_transcoding_process_rtp(&endp, dst_end,
+ buf, &len, sizeof(buf));
+ if (cont < 0)
+ errx(1, "processing failed: %s", strerror(-cont));
+
+ if (len < 24) {
+ printf("encoded: %s\n", osmo_hexdump((unsigned char *)buf, len));
+ } else {
+ const char *str = osmo_hexdump((unsigned char *)buf, len);
+ int i = 0;
+ const int prefix = 4;
+ const int cutlen = 48;
+ int nchars = 0;
+
+ printf("encoded:\n");
+ do {
+ nchars = printf("%*s%-.*s", prefix, "", cutlen, str + i);
+ i += nchars - prefix;
+ printf("\n");
+ } while (nchars - prefix >= cutlen);
+ }
+ return 0;
+}
+
+static int test_repacking(int in_samples, int out_samples, int no_transcode)
+{
+ char buf[4096] = {0x80, 0};
+ int cc, rc;
+ struct mgcp_rtp_end *dst_end;
+ struct mgcp_rtp_end *src_end;
+ struct mgcp_config *cfg;
+ struct mgcp_trunk_config tcfg = {{0}};
+ struct mgcp_endpoint endp = {0};
+ struct mgcp_process_rtp_state *state;
+ int in_cnt;
+ int out_size;
+ int in_size;
+ uint32_t ts = 0;
+ uint16_t seq = 0;
+ const char *srcfmt = "pcma";
+ const char *dstfmt = no_transcode ? "pcma" : "l16";
+
+ cfg = mgcp_config_alloc();
+
+ tcfg.endpoints = &endp;
+ tcfg.number_endpoints = 1;
+ tcfg.cfg = cfg;
+ endp.tcfg = &tcfg;
+ endp.cfg = cfg;
+ mgcp_free_endp(&endp);
+
+ dst_end = &endp.bts_end;
+ src_end = &endp.net_end;
+
+ printf("== Transcoding test ==\n");
+ printf("converting %s -> %s\n", srcfmt, dstfmt);
+
+ src_end->payload_type = audio_name_to_type(srcfmt);
+ dst_end->payload_type = audio_name_to_type(dstfmt);
+
+ if (out_samples) {
+ dst_end->frame_duration_den = dst_end->rate;
+ dst_end->frame_duration_num = out_samples;
+ dst_end->frames_per_packet = 1;
+ dst_end->force_output_ptime = 1;
+ }
+
+ rc = mgcp_transcoding_setup(&endp, dst_end, src_end);
+ if (rc < 0)
+ errx(1, "setup failed: %s", strerror(-rc));
+
+ state = dst_end->rtp_process_data;
+ OSMO_ASSERT(state != NULL);
+
+ in_size = mgcp_transcoding_get_frame_size(state, in_samples, 0);
+ OSMO_ASSERT(sizeof(buf) >= in_size + 12);
+
+ out_size = mgcp_transcoding_get_frame_size(state, -1, 1);
+ OSMO_ASSERT(sizeof(buf) >= out_size + 12);
+
+ buf[1] = src_end->payload_type;
+ *(uint16_t*)(buf+2) = htons(1);
+ *(uint32_t*)(buf+4) = htonl(0);
+ *(uint32_t*)(buf+8) = htonl(0xaabbccdd);
+
+ for (in_cnt = 0; in_cnt < 16; in_cnt++) {
+ int cont;
+ int len;
+
+ /* fake PCMA data */
+ printf("generating %d %s input samples\n", in_samples, srcfmt);
+ for (cc = 0; cc < in_samples; cc++)
+ buf[12+cc] = cc;
+
+ *(uint16_t*)(buf+2) = htonl(seq);
+ *(uint32_t*)(buf+4) = htonl(ts);
+
+ seq += 1;
+ ts += in_samples;
+
+ cc += 12; /* include RTP header */
+
+ len = cc;
+
+ do {
+ cont = mgcp_transcoding_process_rtp(&endp, dst_end,
+ buf, &len, sizeof(buf));
+ if (cont == -EAGAIN) {
+ fprintf(stderr, "Got EAGAIN\n");
+ break;
+ }
+
+ if (cont < 0)
+ errx(1, "processing failed: %s", strerror(-cont));
+
+ len -= 12; /* ignore RTP header */
+
+ printf("got %d %s output frames (%d octets)\n",
+ len / out_size, dstfmt, len);
+
+ len = cont;
+ } while (len > 0);
+ }
+ return 0;
+}
+
+int main(int argc, char **argv)
+{
+ osmo_init_logging(&log_info);
+
+ printf("=== Transcoding Good Cases ===\n");
+
+ transcode_test("l16", "l16",
+ (uint8_t *)audio_packets_l16[0].data,
+ audio_packets_l16[0].len);
+ transcode_test("l16", "gsm",
+ (uint8_t *)audio_packets_l16[0].data,
+ audio_packets_l16[0].len);
+ transcode_test("l16", "pcma",
+ (uint8_t *)audio_packets_l16[0].data,
+ audio_packets_l16[0].len);
+ transcode_test("gsm", "l16",
+ (uint8_t *)audio_packets_gsm[0].data,
+ audio_packets_gsm[0].len);
+ transcode_test("gsm", "gsm",
+ (uint8_t *)audio_packets_gsm[0].data,
+ audio_packets_gsm[0].len);
+ transcode_test("gsm", "pcma",
+ (uint8_t *)audio_packets_gsm[0].data,
+ audio_packets_gsm[0].len);
+ transcode_test("pcma", "l16",
+ (uint8_t *)audio_packets_pcma[0].data,
+ audio_packets_pcma[0].len);
+ transcode_test("pcma", "gsm",
+ (uint8_t *)audio_packets_pcma[0].data,
+ audio_packets_pcma[0].len);
+ transcode_test("pcma", "pcma",
+ (uint8_t *)audio_packets_pcma[0].data,
+ audio_packets_pcma[0].len);
+
+ printf("=== Transcoding Bad Cases ===\n");
+
+ printf("Invalid size:\n");
+ transcode_test("gsm", "pcma",
+ (uint8_t *)audio_packets_gsm_invalid_size[0].data,
+ audio_packets_gsm_invalid_size[0].len);
+
+ printf("Invalid data:\n");
+ transcode_test("gsm", "pcma",
+ (uint8_t *)audio_packets_gsm_invalid_data[0].data,
+ audio_packets_gsm_invalid_data[0].len);
+
+ printf("Invalid payload type:\n");
+ transcode_test("gsm", "pcma",
+ (uint8_t *)audio_packets_gsm_invalid_ptype[0].data,
+ audio_packets_gsm_invalid_ptype[0].len);
+
+ printf("=== Repacking ===\n");
+
+ test_repacking(160, 160, 0);
+ test_repacking(160, 160, 1);
+ test_repacking(160, 80, 0);
+ test_repacking(160, 80, 1);
+ test_repacking(160, 320, 0);
+ test_repacking(160, 320, 1);
+ test_repacking(160, 240, 0);
+ test_repacking(160, 240, 1);
+ test_repacking(160, 100, 0);
+ test_repacking(160, 100, 1);
+
+ return 0;
+}
+
new file mode 100644
@@ -0,0 +1,534 @@
+=== Transcoding Good Cases ===
+== Transcoding test ==
+converting l16 -> l16
+encoded:
+ 80 0b 00 01 00 00 00 a0 11 22 33 44 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed 00 00 40 13
+ 5a 9e 40 13 00 00 bf ed a5 62 bf ed
+== Transcoding test ==
+converting l16 -> gsm
+encoded:
+ 80 0b 00 00 00 00 00 a0 11 22 33 44 d4 7c e3 e9
+ 62 50 39 f0 f8 b4 68 ea 6c 0e 81 1b 56 2a d5 bc
+ 69 9c d1 f0 66 7a ec 49 7a 33 3d 0a de
+== Transcoding test ==
+converting l16 -> pcma
+encoded:
+ 80 0b 00 00 00 00 00 a0 11 22 33 44 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25
+== Transcoding test ==
+converting gsm -> l16
+encoded:
+ 80 03 00 00 00 00 00 a0 11 22 33 44 00 00 54 00
+ 59 f0 34 20 c4 c8 b9 f8 e2 18 f1 e8 f2 28 f0 e0
+ 46 08 4f 80 2c a0 a9 c8 80 00 c0 58 3f 80 63 c0
+ 24 b8 fa b8 f6 88 0b a0 c8 70 a8 b0 c8 c0 3b a8
+ 66 a0 2e 38 d1 f8 98 98 aa 18 e8 30 26 a0 37 40
+ 37 e8 17 00 ee 50 b7 80 b1 88 de 28 18 40 45 b0
+ 4f 48 21 d8 df 78 ae 68 ab 98 d6 b8 18 18 48 90
+ 4e 70 27 40 e8 10 b5 b0 ac 80 d4 60 14 50 48 48
+ 50 10 2a 00 ec 08 ba 00 af 58 d1 c0 10 60 45 c8
+ 54 10 30 78 f1 a8 bb 18 ad 48 ce 30 0a e8 3f 30
+ 4f 10 32 18 f6 18 bf 20 ac 30 cd 80 0b d0 43 d8
+ 55 e0 34 a0 f5 78 bc 98 ad 98 cd c8 0a 80 40 58
+ 51 c0 35 40 f9 60 c1 68 ac c8 cb 38 08 00 40 98
+ 51 e0 34 d8 fa 28 c2 f0 ae 40 c7 70 02 d0 3c a8
+ 54 78 38 a0 fc 68 c2 08 ad 50 c7 78 01 60 39 c0
+ 51 38 3a e8 00 e8 c6 38 ab d8 c4 00 fe 08 39 18
+ 50 30 39 50 01 d8 ca 70 b1 80 c4 c8 fc 58 36 40
+ 51 d8 3b 08 02 80 c8 58 b0 60 c5 a8 fb d0 33 e8
+ 4e 80 3c e0 06 10 cb 90 ae 48 c2 60 f9 58 34 08
+ 4d a0 3a a8 06 48 cf 80 b4 60 c3 e8 f7 90 30 18
+ 4d a0 3b 98 07 90 cf 18 b4 68 c4 88
+== Transcoding test ==
+converting gsm -> gsm
+encoded:
+ 80 03 00 01 00 00 00 a0 11 22 33 44 d4 7c e3 e9
+ 62 50 39 f0 f8 b4 68 ea 6c 0e 81 1b 56 2a d5 bc
+ 69 9c d1 f0 66 7a ec 49 7a 33 3d 0a de
+== Transcoding test ==
+converting gsm -> pcma
+encoded:
+ 80 03 00 00 00 00 00 a0 11 22 33 44 d5 a0 a3 bf
+ 38 24 08 19 1e 1b a4 a6 b3 20 2a 3a ba ad b7 60
+ 17 92 3e 20 3e b8 ac b2 32 2c 20 02 b6 be be 82
+ 04 27 26 35 8d a4 a6 b5 35 21 20 31 8d a7 a6 b6
+ 02 27 21 30 81 a7 a1 b0 06 24 21 32 85 a4 a0 bd
+ 19 24 21 3d 90 ba a6 bc 16 25 21 3c 92 a5 a0 bf
+ 10 25 21 3c 90 a5 a1 bf 6f 3a 21 3f 95 a5 a1 bf
+ 62 3b 21 39 f3 bb a0 b9 79 3b 21 39 c3 b9 a1 b8
+ db 39 20 3b 4a b9 a1 b9 c8 3f 26 38 78 be a1 b8
+ f1 3e 26 38 65 bc a6 bb ed 3f 21 3b 6f bf a6 b8
+ ec 3d 27 3b 15 bd a6 b8 eb 3d 27 38
+== Transcoding test ==
+converting pcma -> l16
+encoded:
+ 80 08 00 00 00 00 00 a0 11 22 33 44 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00 00 08 42 00
+ 5a 00 42 00 00 08 be 00 a6 00 be 00
+== Transcoding test ==
+converting pcma -> gsm
+encoded:
+ 80 08 00 00 00 00 00 a0 11 22 33 44 d4 b9 f4 5d
+ d9 50 5a e1 a0 cd 76 ea 52 0e 87 53 ad d4 ea a2
+ 0a 63 ca e9 60 79 e2 2a 25 d2 c0 f3 39
+== Transcoding test ==
+converting pcma -> pcma
+encoded:
+ 80 08 00 01 00 00 00 a0 11 22 33 44 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25 d5 a5 a3 a5
+ d5 25 23 25 d5 a5 a3 a5 d5 25 23 25
+=== Transcoding Bad Cases ===
+Invalid size:
+== Transcoding test ==
+converting gsm -> pcma
+encoded:
+ 80 03 00 01 00 00 00 a0 11 22 33 44 d4 7c e3 e9
+ 62 50 39 f0 f8 b4 68 ea 6c 0e 81 1b 56 2a d5 bc
+ 69 9c d1 f0 66 7a ec 49 7a
+Invalid data:
+== Transcoding test ==
+converting gsm -> pcma
+encoded:
+ 80 03 00 01 00 00 00 a0 11 22 33 44 ee ee ee ee
+ ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee ee
+ ee ee ee ee ee ee ee ee ee ee ee ee ee
+Invalid payload type:
+== Transcoding test ==
+converting gsm -> pcma
+encoded:
+ 80 08 00 00 00 00 00 a0 11 22 33 44 d5 a0 a3 bf
+ 38 24 08 19 1e 1b a4 a6 b3 20 2a 3a ba ad b7 60
+ 17 92 3e 20 3e b8 ac b2 32 2c 20 02 b6 be be 82
+ 04 27 26 35 8d a4 a6 b5 35 21 20 31 8d a7 a6 b6
+ 02 27 21 30 81 a7 a1 b0 06 24 21 32 85 a4 a0 bd
+ 19 24 21 3d 90 ba a6 bc 16 25 21 3c 92 a5 a0 bf
+ 10 25 21 3c 90 a5 a1 bf 6f 3a 21 3f 95 a5 a1 bf
+ 62 3b 21 39 f3 bb a0 b9 79 3b 21 39 c3 b9 a1 b8
+ db 39 20 3b 4a b9 a1 b9 c8 3f 26 38 78 be a1 b8
+ f1 3e 26 38 65 bc a6 bb ed 3f 21 3b 6f bf a6 b8
+ ec 3d 27 3b 15 bd a6 b8 eb 3d 27 38
+=== Repacking ===
+== Transcoding test ==
+converting pcma -> l16
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+generating 160 pcma input samples
+got 2 l16 output frames (320 octets)
+== Transcoding test ==
+converting pcma -> pcma
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+generating 160 pcma input samples
+got 2 pcma output frames (160 octets)
+== Transcoding test ==
+converting pcma -> l16
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+== Transcoding test ==
+converting pcma -> pcma
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+== Transcoding test ==
+converting pcma -> l16
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 l16 output frames (640 octets)
+== Transcoding test ==
+converting pcma -> pcma
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 4 pcma output frames (320 octets)
+== Transcoding test ==
+converting pcma -> l16
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 l16 output frames (480 octets)
+== Transcoding test ==
+converting pcma -> pcma
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+generating 160 pcma input samples
+generating 160 pcma input samples
+got 3 pcma output frames (240 octets)
+== Transcoding test ==
+converting pcma -> l16
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+generating 160 pcma input samples
+got 1 l16 output frames (160 octets)
+got 1 l16 output frames (160 octets)
+== Transcoding test ==
+converting pcma -> pcma
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
+generating 160 pcma input samples
+got 1 pcma output frames (80 octets)
+got 1 pcma output frames (80 octets)
@@ -27,6 +27,13 @@ cat $abs_srcdir/mgcp/mgcp_test.ok > expout
AT_CHECK([$abs_top_builddir/tests/mgcp/mgcp_test], [], [expout], [ignore])
AT_CLEANUP
+AT_SETUP([mgcp-trans])
+AT_KEYWORDS([mgcp-trans])
+AT_CHECK([test "$enable_mgcp_transcoding_test" == yes || exit 77])
+cat $abs_srcdir/mgcp/mgcp_transcoding_test.ok > expout
+AT_CHECK([$abs_top_builddir/tests/mgcp/mgcp_transcoding_test], [], [expout], [ignore])
+AT_CLEANUP
+
AT_SETUP([gprs])
AT_KEYWORDS([gprs])
cat $abs_srcdir/gprs/gprs_test.ok > expout