aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmgcp/mgcp_network.c
diff options
context:
space:
mode:
authorJacob Erlbeck <jerlbeck@sysmocom.de>2013-11-29 11:16:07 +0100
committerJacob Erlbeck <jerlbeck@sysmocom.de>2013-12-05 16:55:39 +0100
commit55ba140da126c78013fe1a6055d750ee10b60ecf (patch)
tree44c0c5dad4befb700861b08623f0cfe51ab52131 /openbsc/src/libmgcp/mgcp_network.c
parent83c052373907c1cdaa134b5a7420eacabd893901 (diff)
mgcp/rtp: Fix output timing error counter
The tsdelta computation and error detection didn't handle the intialisation phase properly. This patches fixes this by skipping the output timing validation when the SSRCs don't match. Sponsored-by: On-Waves ehf
Diffstat (limited to 'openbsc/src/libmgcp/mgcp_network.c')
-rw-r--r--openbsc/src/libmgcp/mgcp_network.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 75d39c1..53f1a20 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -237,6 +237,16 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
state->jitter = 0;
state->transit = arrival_time - timestamp;
state->out_stream = state->in_stream;
+ state->out_stream.last_timestamp = timestamp;
+ /* force output SSRC change */
+ state->out_stream.ssrc = rtp_hdr->ssrc - 1;
+ LOGP(DMGCP, LOGL_INFO,
+ "Initializing stream on 0x%x SSRC: %u timestamp: %u "
+ "from %s:%d in %d\n",
+ ENDPOINT_NUMBER(endp), state->in_stream.ssrc,
+ state->seq_offset,
+ inet_ntoa(addr->sin_addr), ntohs(addr->sin_port),
+ endp->conn_mode);
} else if (state->in_stream.ssrc != rtp_hdr->ssrc) {
int32_t tsdelta = state->out_stream.last_tsdelta;
if (tsdelta == 0) {
@@ -286,9 +296,10 @@ void mgcp_patch_and_count(struct mgcp_endpoint *endp, struct mgcp_rtp_state *sta
}
/* Check again, whether the timestamps are still valid */
- check_rtp_timestamp(endp, &state->out_stream, rtp_end, addr,
- seq, timestamp, "output",
- &state->out_stream.last_tsdelta);
+ if (state->out_stream.ssrc == rtp_hdr->ssrc)
+ check_rtp_timestamp(endp, &state->out_stream, rtp_end, addr,
+ seq, timestamp, "output",
+ &state->out_stream.last_tsdelta);
/*
* The below takes the shape of the validation from Appendix A. Check