aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_transcode.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-04 20:55:20 +0200
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-07-22 14:31:35 +0200
commit91eeeae312b3dfc54fc577b437c481811ff60d4a (patch)
treed4167b35cdc4c968d1f2234842f7b70ea1a980ff /openbsc/src/libmgcp/mgcp_transcode.c
parent1fc1ed23b25273688ef1f695e2f0135aaff97c73 (diff)
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.
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_transcode.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_transcode.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsc/src/libmgcp/mgcp_transcode.c b/openbsc/src/libmgcp/mgcp_transcode.c
index 8ab9a04fd..296020c49 100644
--- a/openbsc/src/libmgcp/mgcp_transcode.c
+++ b/openbsc/src/libmgcp/mgcp_transcode.c
@@ -429,7 +429,7 @@ int mgcp_transcoding_process_rtp(struct mgcp_endpoint *endp,
if (payload_len > 0) {
ts_no = ntohl(*(uint32_t*)(data+4));
if (!state->is_running)
- state->next_seq = ntohs(*(uint32_t*)(data+4));
+ state->next_seq = ntohs(*(uint16_t*)(data+2));
state->is_running = 1;
@@ -494,7 +494,7 @@ int mgcp_transcoding_process_rtp(struct mgcp_endpoint *endp,
nsamples -= state->sample_cnt;
*len = rtp_hdr_size + rc;
- *(uint16_t*)(data+2) = htonl(state->next_seq);
+ *(uint16_t*)(data+2) = htons(state->next_seq);
*(uint32_t*)(data+4) = htonl(ts_no);
state->next_seq += 1;