[MERGED] 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/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu Dec 15 19:57:04 UTC 2016


Harald Welte has submitted this change and it was merged.

Change subject: DTX: fix TS adjustment for ONSET
......................................................................


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, 15 insertions(+), 5 deletions(-)

Approvals:
  Harald Welte: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index cfa02bd..e9c94f0 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -71,16 +71,26 @@
 
 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)
 {
-	if (last_fn != LCHAN_FN_DUMMY) {
+	uint32_t samples_passed, r;
+
+	/* don't adjust duration:
+	   - when no DTX enabled at all
+	   - for ONSET RTP packet to avoid timestamp gap with subsequent SPEECH
+	   RTP packet*/
+	if (lchan->rtp_tx_marker ||
+	    lchan->ts->trx->bts->dtxu == GSM48_DTX_SHALL_NOT_BE_USED)
+		return GSM_RTP_DURATION;
+
+	if (lchan->tch.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 +922,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: merged
Gerrit-Change-Id: I9bf4b45aa990dd4014334dd846f43f793366056c
Gerrit-PatchSet: 4
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
Gerrit-Reviewer: Max <msuraev at sysmocom.de>



More information about the gerrit-log mailing list