[PATCH] osmo-bts[master]: Fix RTP timestamps in case of DTX

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/gerrit-log@lists.osmocom.org/.

Max gerrit-no-reply at lists.osmocom.org
Mon Jun 6 10:22:47 UTC 2016


Hello Harald Welte, Jenkins Builder,

I'd like you to reexamine a change.  Please visit

    https://gerrit.osmocom.org/196

to look at the new patch set (#3).

Fix RTP timestamps in case of DTX

Compute RTP user_ts adjustment based on the difference between current
and previous FN instead of hard-coded value.

Change-Id: If1677ddcf754b29990ff7cd846e11c32e3d30b33
Related: OS#1562
---
M src/common/l1sap.c
1 file changed, 16 insertions(+), 2 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/96/196/3

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index ac398d3..77fd1a0 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -69,6 +69,20 @@
 
 static int l1sap_down(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap);
 
+static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn)
+{
+	if (last_fn) {
+		uint32_t ms_passed = GSM_FN_TO_MS(fn - last_fn),
+			samples_passed = GSM_MS_TO_SAMPLES(ms_passed);
+		/* round number of samples to the nearest multiple of
+		   GSM_RTP_DURATION */
+		uint32_t r = samples_passed + GSM_RTP_DURATION / 2;
+		r -= r % GSM_RTP_DURATION;
+		return r;
+	}
+	return GSM_RTP_DURATION;
+}
+
 static const uint8_t fill_frame[GSM_MACBLOCK_LEN] = {
         0x03, 0x03, 0x01, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
         0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B, 0x2B,
@@ -853,7 +867,7 @@
 	/* hand msg to RTP code for transmission */
 	if (lchan->abis_ip.rtp_socket)
 		osmo_rtp_send_frame(lchan->abis_ip.rtp_socket,
-			msg->data, msg->len, 160);
+			msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn));
 
 	/* if loopback is enabled, also queue received RTP data */
 	if (lchan->loopback) {
@@ -871,7 +885,7 @@
 
 		msgb_enqueue(&lchan->dl_tch_queue, msg);
 	}
-
+	lchan->tch.last_fn = fn;
 	return 0;
 }
 

-- 
To view, visit https://gerrit.osmocom.org/196
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: If1677ddcf754b29990ff7cd846e11c32e3d30b33
Gerrit-PatchSet: 3
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder



More information about the gerrit-log mailing list