[PATCH] osmo-bts[master]: DTX: fix TS adjustment for ONSET

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
Fri Dec 9 13:16:29 UTC 2016


Review at  https://gerrit.osmocom.org/1399

DTX: fix TS adjustment for ONSET

Previously timestamp was always adjusted according to FN difference. In
case of ONSET event this causes unnecessary TS gap with subsequent
speech packet. Fix this by checking Marker bit before performing
adjustment.

Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c
Related: OS#1801
---
M src/common/l1sap.c
1 file changed, 11 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/99/1399/1

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index cfa02bd..a223729 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -71,16 +71,23 @@
 
 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)
+static uint32_t fn_ms_adj(uint32_t fn, const struct gsm_lchan *lchan)
 {
+	uint32_t samples_passed, r;
+
+	/* do not adjust duration for ONSET RTP packet to avoid timestamp gap
+	   with subsequent SPEECH RTP packet*/
+	if (lchan->rtp_tx_marker)
+		return GSM_RTP_DURATION;
+
 	if (last_fn != LCHAN_FN_DUMMY) {
 		/* 12/13 frames usable for audio in TCH,
 		   160 samples per RTP packet,
 		   1 RTP packet per 4 frames */
-		uint32_t samples_passed = (fn - last_fn) * 12 * 160 / (13 * 4);
+		samples_passed = (fn - lchan->tch.last_fn) * 12 * 160 / (13 * 4);
 		/* round number of samples to the nearest multiple of
 		   GSM_RTP_DURATION */
-		uint32_t r = samples_passed + GSM_RTP_DURATION / 2;
+		r = samples_passed + GSM_RTP_DURATION / 2;
 		r -= r % GSM_RTP_DURATION;
 		return r;
 	}
@@ -912,7 +919,7 @@
 	/* hand msg to RTP code for transmission */
 	if (lchan->abis_ip.rtp_socket)
 		osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
-			msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker);
+			msg->data, msg->len, fn_ms_adj(fn, lchan), lchan->rtp_tx_marker);
 
 	/* if loopback is enabled, also queue received RTP data */
 	if (lchan->loopback) {

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list