summaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/rtp_helper.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-08-29 19:14:45 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-08-30 15:04:16 +0200
commit556f076c4f6f2d59c87a409adda8a837acac507c (patch)
treeabb4a264ef3f66517deab126757e6a5040ba735e /openbsc/src/libmgcp/rtp_helper.c
parent3366375560cbaed1ed9d7545c186d1b4dd56164e (diff)
mgcp: Work on sequence numbers and document what we will need to do
Diffstat (limited to 'openbsc/src/libmgcp/rtp_helper.c')
-rw-r--r--openbsc/src/libmgcp/rtp_helper.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/openbsc/src/libmgcp/rtp_helper.c b/openbsc/src/libmgcp/rtp_helper.c
index 2fc583f5e..feb3d591d 100644
--- a/openbsc/src/libmgcp/rtp_helper.c
+++ b/openbsc/src/libmgcp/rtp_helper.c
@@ -262,7 +262,9 @@ int rtp_compress(struct mgcp_rtp_compr_state *state, struct msgb *msg,
reduced_hdr = msgb_put_struct(msg, struct reduced_rtp_hdr);
reduced_hdr->endp = endp;
- reduced_hdr->sequence_no = ++state->last_ts % UCHAR_MAX;
+
+ state->last_ts = (state->last_ts + 1) % UCHAR_MAX;
+ reduced_hdr->sequence_no = state->last_ts;
reduced_hdr->payloads = count;
if (marker)
@@ -285,6 +287,20 @@ int rtp_decompress(struct mgcp_rtp_compr_state *state,
}
rhdr = (struct reduced_rtp_hdr *) msg->l2h;
+
+ /* check if the state is matching */
+ /**
+ * We will need some simple state with a bit of history. We will start
+ * with last_ts == -1, then we initialize it to the expected ts, and
+ * when we get something we didn't expect we will need to guess if this
+ * is a late arrival (due re-ordering or such) or if that is just some
+ * packet loss and we continue. E.g. we need to check if the sequence_no
+ * is above or below our state... but as the counter wraps, e.g. if we
+ * wait for 512 but we get 2, we have jumped to the future...
+ * This will require some testing/simulation
+ */
+#warning "TODO: Deal with late arrivals, reset the state and accept late as new"
+
if (rhdr->type == 0)
return read_compressed_slim(msg, rhdr, list, state);
else if (rhdr->type == 1)