summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-12-19 17:50:27 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2014-01-16 13:20:47 +0100
commit785e3c95d76d58e1a6a9559e197db5679edea721 (patch)
tree480cd4f6c07acd4ebe51fb4aad2e943c4b9404c5
parent2645c9e7fc0698434f0555bbc8653252d56496ad (diff)
mgcp/rtp: Make offset computation understandable
Rename the timestamp variable to make in clear, that the input timestamp is meant. Add a helper variable to illustrate the offset computation. Sponsored-by: On-Waves ehf
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 21d52b58e..04e6cbef8 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -241,10 +241,11 @@ static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp,
struct mgcp_rtp_state *state,
struct mgcp_rtp_end *rtp_end,
struct sockaddr_in *addr,
- int16_t delta_seq, uint32_t timestamp)
+ int16_t delta_seq, uint32_t in_timestamp)
{
int32_t tsdelta = state->packet_duration;
int timestamp_offset;
+ uint32_t out_timestamp;
if (tsdelta == 0) {
tsdelta = state->out_stream.last_tsdelta;
@@ -269,9 +270,8 @@ static int adjust_rtp_timestamp_offset(struct mgcp_endpoint *endp,
}
}
- timestamp_offset =
- state->out_stream.last_timestamp - timestamp +
- delta_seq * tsdelta;
+ out_timestamp = state->out_stream.last_timestamp + delta_seq * tsdelta;
+ timestamp_offset = out_timestamp - in_timestamp;
if (state->timestamp_offset != timestamp_offset) {
state->timestamp_offset = timestamp_offset;