Change in osmo-bts[master]: dtx: add detection of AMR DTX frames

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/.

dexter gerrit-no-reply at lists.osmocom.org
Wed Feb 19 08:52:11 UTC 2020


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/17221 )


Change subject: dtx: add detection of AMR DTX frames
......................................................................

dtx: add detection of AMR DTX frames

Currently we do not detect any of the DTX frames (SID_FIRST, SID_UPDATE
etc.) Detecting and tagging those frames as is_sub is important for
measurement processing. Also the RTP marker bit must be set on each
ONSET frame.

 - Add detection of DTX frames
 - Tag DTX frames as is_sub
 - Set RTP marker bit when ONSET frames are received

Change-Id: I5afe730fff2fa3199a5913b0de4f5c7b23a39f31
Related: OS#2978
---
M include/osmo-bts/scheduler_backend.h
M src/common/scheduler.c
M src/osmo-bts-trx/scheduler_trx.c
3 files changed, 37 insertions(+), 9 deletions(-)



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

diff --git a/include/osmo-bts/scheduler_backend.h b/include/osmo-bts/scheduler_backend.h
index aa2d6e9..bdb5224 100644
--- a/include/osmo-bts/scheduler_backend.h
+++ b/include/osmo-bts/scheduler_backend.h
@@ -55,7 +55,8 @@
 
 int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 			   enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len,
-			   int16_t ta_offs_256bits, uint16_t ber10k, float rssi);
+			   int16_t ta_offs_256bits, uint16_t ber10k, float rssi,
+			   uint8_t is_sub);
 
 ubit_t *tx_idle_fn(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 	enum trx_chan_type chan, uint8_t bid, uint16_t *nbits);
diff --git a/src/common/scheduler.c b/src/common/scheduler.c
index e8df537..20c665a 100644
--- a/src/common/scheduler.c
+++ b/src/common/scheduler.c
@@ -754,7 +754,8 @@
 
 int _sched_compose_tch_ind(struct l1sched_trx *l1t, uint8_t tn, uint32_t fn,
 			   enum trx_chan_type chan, uint8_t *tch, uint8_t tch_len,
-			   int16_t ta_offs_256bits, uint16_t ber10k, float rssi)
+			   int16_t ta_offs_256bits, uint16_t ber10k, float rssi,
+			   uint8_t is_sub)
 {
 	struct msgb *msg;
 	struct osmo_phsap_prim *l1sap;
@@ -773,6 +774,7 @@
 	l1sap->u.tch.rssi = (int8_t) (rssi);
 	l1sap->u.tch.ber10k = ber10k;
 	l1sap->u.tch.ta_offs_256bits = ta_offs_256bits;
+	l1sap->u.tch.is_sub = is_sub & 1;
 
 	msg->l2h = msgb_put(msg, tch_len);
 	if (tch_len)
diff --git a/src/osmo-bts-trx/scheduler_trx.c b/src/osmo-bts-trx/scheduler_trx.c
index 5abb73b..5bf8cff 100644
--- a/src/osmo-bts-trx/scheduler_trx.c
+++ b/src/osmo-bts-trx/scheduler_trx.c
@@ -37,6 +37,8 @@
 #include <osmocom/core/bits.h>
 #include <osmocom/gsm/a5.h>
 #include <osmocom/coding/gsm0503_coding.h>
+#include <osmocom/coding/gsm0503_amr_dtx.h>
+
 
 #include <osmo-bts/gsm_data.h>
 #include <osmo-bts/logging.h>
@@ -400,7 +402,7 @@
 
 			/* Note: RSSI is set to 0 to indicate to the higher
 			 * layers that this is a faked tch_ind */
-			_sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len, toa256, 10000, 0);
+			_sched_compose_tch_ind(l1t, tn, fn, chan, tch_data, len, toa256, 10000, 0, 0);
 		}
 	}
 
@@ -1138,6 +1140,8 @@
 		get_lchan_by_chan_nr(l1t->trx, trx_chan_desc[chan].chan_nr | bi->tn);
 	unsigned int fn_begin;
 	uint16_t ber10k;
+	uint8_t amr_dtx;
+	uint8_t is_sub = 0;
 
 	/* handle rach, if handover rach detection is turned on */
 	if (chan_state->ho_rach_detect == 1)
@@ -1197,10 +1201,19 @@
 		 * the first FN 4,13,21 defines that CMR is included in frame.
 		 * NOTE: A frame ends 7 FN after start.
 		 */
-		rc = gsm0503_tch_afs_decode(tch_data + 2, *bursts_p,
+
+		memset(tch_data, 0, sizeof(tch_data));
+		
+		rc = gsm0503_tch_afs_decode_dtx(tch_data + 2, *bursts_p,
 			(((bi->fn + 26 - 7) % 26) >> 2) & 1, chan_state->codec,
 			chan_state->codecs, &chan_state->ul_ft,
-			&chan_state->ul_cmr, &n_errors, &n_bits_total);
+			&chan_state->ul_cmr, &n_errors, &n_bits_total, &amr_dtx);
+
+		if (amr_dtx != AMR_OTHER)
+			is_sub = 1;
+		if (amr_dtx == AFS_ONSET)
+			lchan->rtp_tx_marker = true;
+		
 		if (rc)
 			trx_loop_amr_input(l1t,
 				trx_chan_desc[chan].chan_nr | bi->tn, chan_state,
@@ -1305,7 +1318,7 @@
 compose_l1sap:
 	fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_F);
 	return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
-				      tch_data, rc, bi->toa256, ber10k, bi->rssi);
+				      tch_data, rc, bi->toa256, ber10k, bi->rssi, is_sub);
 }
 
 /*! \brief a single TCH/H burst was received by the PHY, process it */
@@ -1333,6 +1346,8 @@
 	int fn_is_odd = (((bi->fn + 26 - 10) % 26) >> 2) & 1;
 	unsigned int fn_begin;
 	uint16_t ber10k;
+	uint8_t amr_dtx;
+	uint8_t is_sub = 0;
 
 	/* handle RACH, if handover RACH detection is turned on */
 	if (chan_state->ho_rach_detect == 1)
@@ -1404,10 +1419,20 @@
 		 * in frame, the first FN 4,13,21 or 5,14,22 defines that CMR
 		 * is included in frame.
 		 */
-		rc = gsm0503_tch_ahs_decode(tch_data + 2, *bursts_p,
+		rc = gsm0503_tch_ahs_decode_dtx(tch_data + 2, *bursts_p,
 			fn_is_odd, fn_is_odd, chan_state->codec,
 			chan_state->codecs, &chan_state->ul_ft,
-			&chan_state->ul_cmr, &n_errors, &n_bits_total);
+			&chan_state->ul_cmr, &n_errors, &n_bits_total, &amr_dtx);
+
+		if (amr_dtx != AMR_OTHER)
+			is_sub = 1;
+		if (amr_dtx == AHS_ONSET)
+			lchan->rtp_tx_marker = true;
+		else if (amr_dtx == AHS_SID_FIRST_INH)
+			lchan->rtp_tx_marker = true;
+		else if (amr_dtx == AHS_SID_UPDATE_INH)
+			lchan->rtp_tx_marker = true;
+
 		if (rc)
 			trx_loop_amr_input(l1t,
 				trx_chan_desc[chan].chan_nr | bi->tn, chan_state,
@@ -1522,7 +1547,7 @@
 	else
 		fn_begin = gsm0502_fn_remap(bi->fn, FN_REMAP_TCH_H1);
 	return _sched_compose_tch_ind(l1t, bi->tn, fn_begin, chan,
-				      tch_data, rc, bi->toa256, ber10k, bi->rssi);
+				      tch_data, rc, bi->toa256, ber10k, bi->rssi, is_sub);
 }
 
 /* schedule all frames of all TRX for given FN */

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/17221
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I5afe730fff2fa3199a5913b0de4f5c7b23a39f31
Gerrit-Change-Number: 17221
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200219/8eb50e8a/attachment.htm>


More information about the gerrit-log mailing list