[PATCH 2/6] mgcp/rtp: Fix output timing error counter

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Jacob Erlbeck jerlbeck at sysmocom.de
Tue Dec 3 16:17:05 UTC 2013


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
---
 openbsc/src/libmgcp/mgcp_network.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/openbsc/src/libmgcp/mgcp_network.c b/openbsc/src/libmgcp/mgcp_network.c
index 75d39c1..06452a6 100644
--- a/openbsc/src/libmgcp/mgcp_network.c
+++ b/openbsc/src/libmgcp/mgcp_network.c
@@ -237,6 +237,15 @@ 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;
+		state->out_stream.ssrc = rtp_hdr->ssrc - 1; /* SSRC change <=> initialisation */
+		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 +295,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
-- 
1.7.9.5





More information about the OpenBSC mailing list