diff options
author | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-06-20 14:43:14 +0200 |
---|---|---|
committer | Jacob Erlbeck <jerlbeck@sysmocom.de> | 2014-08-04 10:33:07 +0200 |
commit | 213cc107976941c05f32cd5d8ebc9e768a67b65c (patch) | |
tree | 76c1cd0bf910d22a0ff6ca7ea54b0e3eea7560f6 | |
parent | 2f2f2aa4382ecb4a8e429f9a0b6ab1ae8fb253b0 (diff) |
mgcp/test: Check RTP header after transcodingjerlbeck/wip/mgcp
The current transcoder fails to update the RTP sequence correctly.
This patch modifies the test to check the (modified) RTP header
fields after each call to mgcp_transcoding_process_rtp.
Sponsored-by: On-Waves ehf
-rw-r--r-- | openbsc/tests/mgcp/mgcp_transcoding_test.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/openbsc/tests/mgcp/mgcp_transcoding_test.c b/openbsc/tests/mgcp/mgcp_transcoding_test.c index 1899a7d75..28584319c 100644 --- a/openbsc/tests/mgcp/mgcp_transcoding_test.c +++ b/openbsc/tests/mgcp/mgcp_transcoding_test.c @@ -155,6 +155,8 @@ static int transcode_test(const char *srcfmt, const char *dstfmt, int in_samples = 160; int len, cont; struct rtp_hdr *rtp; + uint32_t exp_ts; + uint16_t exp_seq; printf("== Transcoding test ==\n"); printf("converting %s -> %s\n", srcfmt, dstfmt); @@ -184,6 +186,8 @@ static int transcode_test(const char *srcfmt, const char *dstfmt, rtp = (struct rtp_hdr *)buf; OSMO_ASSERT(rtp_header_len(rtp) == 12); + exp_ts = rtp_timestamp(rtp); + exp_seq = rtp_sequence(rtp); len = src_pkt_size; @@ -192,6 +196,12 @@ static int transcode_test(const char *srcfmt, const char *dstfmt, if (cont < 0) errx(1, "processing failed: %s", strerror(-cont)); + if (exp_ts != rtp_timestamp(rtp) || exp_seq != rtp_sequence(rtp)) + printf("RTP header fields differ: " + "TS %u (expected %u), SEQ %u (expected %u)\n", + rtp_timestamp(rtp), exp_ts, + rtp_sequence(rtp), exp_seq); + if (len < 24) { printf("encoded: %s\n", osmo_hexdump((unsigned char *)buf, len)); } else { @@ -226,9 +236,12 @@ static int test_repacking(int in_samples, int out_samples, int no_transcode) int in_size; uint32_t ts = 0; uint16_t seq = 0; + uint32_t exp_ts = 0; + uint16_t exp_seq = 0; const char *srcfmt = "pcma"; const char *dstfmt = no_transcode ? "pcma" : "l16"; struct rtp_hdr *rtp; + int exp_undefined = 1; cfg = mgcp_config_alloc(); @@ -306,6 +319,22 @@ static int test_repacking(int in_samples, int out_samples, int no_transcode) if (cont < 0) errx(1, "processing failed: %s", strerror(-cont)); + if (exp_undefined) { + exp_ts = rtp_timestamp(rtp); + exp_seq = rtp_sequence(rtp); + exp_undefined = 0; + } else { + exp_ts += out_samples; + exp_seq += 1; + } + + if (exp_ts != rtp_timestamp(rtp) || + exp_seq != rtp_sequence(rtp)) + printf("RTP header fields differ: " + "TS %u (expected %u), SEQ %u (expected %u)\n", + rtp_timestamp(rtp), exp_ts, + rtp_sequence(rtp), exp_seq); + len -= 12; /* ignore RTP header */ printf("got %d %s output frames (%d octets)\n", |