aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/tests/mgcp
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-09-01 10:35:55 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-09-02 08:25:49 +0200
commitcac2438b0c33f54a6dcac55b55e8cfc33de197b2 (patch)
treebf8b01402f20bfb5d49a4cf6204197061dcb0924 /openbsc/tests/mgcp
parent3713f78ac23ca815c361fe79378ff6d2e522ef6a (diff)
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.
Diffstat (limited to 'openbsc/tests/mgcp')
-rw-r--r--openbsc/tests/mgcp/mgcp_test.c14
-rw-r--r--openbsc/tests/mgcp/mgcp_transcoding_test.c10
2 files changed, 12 insertions, 12 deletions
diff --git a/openbsc/tests/mgcp/mgcp_test.c b/openbsc/tests/mgcp/mgcp_test.c
index 50c8b2d0a..06981dd44 100644
--- a/openbsc/tests/mgcp/mgcp_test.c
+++ b/openbsc/tests/mgcp/mgcp_test.c
@@ -410,7 +410,7 @@ static void test_messages(void)
/* reset endpoints */
for (i = 0; i < cfg->trunk.number_endpoints; i++) {
endp = &cfg->trunk.endpoints[i];
- endp->net_end.payload_type = PTYPE_NONE;
+ endp->net_end.codec.payload_type = PTYPE_NONE;
endp->net_end.packet_duration_ms = -1;
OSMO_ASSERT(endp->conn_mode == MGCP_CONN_NONE);
@@ -498,18 +498,18 @@ static void test_messages(void)
fprintf(stderr, "endpoint %d: "
"payload type BTS %d (exp %d), NET %d (exp %d)\n",
last_endpoint,
- endp->bts_end.payload_type, t->exp_bts_ptype,
- endp->net_end.payload_type, t->exp_net_ptype);
+ endp->bts_end.codec.payload_type, t->exp_bts_ptype,
+ endp->net_end.codec.payload_type, t->exp_net_ptype);
if (t->exp_bts_ptype != PTYPE_IGNORE)
- OSMO_ASSERT(endp->bts_end.payload_type ==
+ OSMO_ASSERT(endp->bts_end.codec.payload_type ==
t->exp_bts_ptype);
if (t->exp_net_ptype != PTYPE_IGNORE)
- OSMO_ASSERT(endp->net_end.payload_type ==
+ OSMO_ASSERT(endp->net_end.codec.payload_type ==
t->exp_net_ptype);
/* Reset them again for next test */
- endp->net_end.payload_type = PTYPE_NONE;
+ endp->net_end.codec.payload_type = PTYPE_NONE;
}
}
@@ -830,7 +830,7 @@ static void test_packet_error_detection(int patch_ssrc, int patch_ts)
mgcp_initialize_endp(&endp);
- rtp->payload_type = 98;
+ rtp->codec.payload_type = 98;
for (i = 0; i < ARRAY_SIZE(test_rtp_packets1); ++i) {
struct rtp_packet_info *info = test_rtp_packets1 + i;
diff --git a/openbsc/tests/mgcp/mgcp_transcoding_test.c b/openbsc/tests/mgcp/mgcp_transcoding_test.c
index 44f307251..079f62eba 100644
--- a/openbsc/tests/mgcp/mgcp_transcoding_test.c
+++ b/openbsc/tests/mgcp/mgcp_transcoding_test.c
@@ -183,14 +183,14 @@ static int given_configured_endpoint(int in_samples, int out_samples,
mgcp_initialize_endp(endp);
dst_end = &endp->bts_end;
- dst_end->payload_type = audio_name_to_type(dstfmt);
+ dst_end->codec.payload_type = audio_name_to_type(dstfmt);
src_end = &endp->net_end;
- src_end->payload_type = audio_name_to_type(srcfmt);
+ src_end->codec.payload_type = audio_name_to_type(srcfmt);
if (out_samples) {
- dst_end->frame_duration_den = dst_end->rate;
- dst_end->frame_duration_num = out_samples;
+ dst_end->codec.frame_duration_den = dst_end->codec.rate;
+ dst_end->codec.frame_duration_num = out_samples;
dst_end->frames_per_packet = 1;
dst_end->force_output_ptime = 1;
}
@@ -463,7 +463,7 @@ static int test_repacking(int in_samples, int out_samples, int no_transcode)
out_size = mgcp_transcoding_get_frame_size(state, -1, 1);
OSMO_ASSERT(sizeof(buf) >= out_size + 12);
- buf[1] = endp->net_end.payload_type;
+ buf[1] = endp->net_end.codec.payload_type;
*(uint16_t*)(buf+2) = htons(1);
*(uint32_t*)(buf+4) = htonl(0);
*(uint32_t*)(buf+8) = htonl(0xaabbccdd);