[PATCH] osmo-bts[master]: DTX: fix conversion from fn to ms

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
Tue Oct 11 16:20:57 UTC 2016


Hello Harald Welte, Jenkins Builder,

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

    https://gerrit.osmocom.org/1029

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

DTX: fix conversion from fn to ms

Previously FN was converted to millisecondss incorrectly due to wrong
conversion between FN and a number of voice samples. The conversion
should be based on following:
* there are 12/13 useful frames for audio in TCH
* there is 1 RTP packet per 4 frame
* there are 160 samples per RTP packet

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


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

diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 04cc800..dd34d80 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -73,8 +73,10 @@
 static uint32_t fn_ms_adj(uint32_t fn, uint32_t last_fn)
 {
 	if (last_fn != LCHAN_FN_DUMMY) {
-		uint32_t ms_passed = GSM_FN_TO_MS(fn - last_fn),
-			samples_passed = GSM_MS_TO_SAMPLES(ms_passed);
+		/* 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);
 		/* round number of samples to the nearest multiple of
 		   GSM_RTP_DURATION */
 		uint32_t r = samples_passed + GSM_RTP_DURATION / 2;

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

Gerrit-MessageType: newpatchset
Gerrit-Change-Id: I9cc70cacabde98621aa892cee74f4ac461645093
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