falconia has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/41049?usp=email )
Change subject: FR/HR/EFR: implement SID filter in TCH UL path
......................................................................
FR/HR/EFR: implement SID filter in TCH UL path
As a result of how FR/HR/EFR DTX interacts with block diagonal
interleaving, at the beginning and end of each DTX pause a
correctly functioning TCH receiver will always pick up an
artifact consisting of 4 received bursts (2 for TCH/HS)
and same number of omitted bursts. Standard channel decoding
of this Rx artifact will produce a "half-block" in which half
of the bits prior to convolutional decoding will come from
a SID repetition whose Tx was notionally suppressed, while
the other half will be garbage. As a result of convolutional
decoding, the result will often appear as valid SID per
classification rules - but passing it as such to the Rx DTX
handler is wrong. Classic E1 BTS and GSM MS implementations
include a kind of SID filter at this point, setting BFI on
these received half-blocks, so that the Rx DTX handler will
see an invalid SID condition. Invalid SID means that comfort
noise generation is to be continued, but no updated CN
parameters are available - which is the truth in half-block
Rx situations. Implement the same filter.
Additional background info can be found here:
https://osmocom.org/projects/retro-gsm/wiki/DTXu_half-blocks
Change-Id: I46c62312316b04567bcadf6050597673f071247d
---
M include/osmo-bts/lchan.h
M src/common/l1sap.c
2 files changed, 58 insertions(+), 8 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/include/osmo-bts/lchan.h b/include/osmo-bts/lchan.h
index 5c34015..42de2f4 100644
--- a/include/osmo-bts/lchan.h
+++ b/include/osmo-bts/lchan.h
@@ -292,6 +292,9 @@
bool dl_sid_transmitted;
/* The current frame in the DL is taken up by FACCH */
bool dl_facch_stealing;
+ /* UL SID filter to catch DTXu half-blocks,
+ * see tch_ul_fr_hr_efr() function. */
+ bool ul_sid_filter;
} dtx_fr_hr_efr;
uint8_t last_cmr;
uint32_t last_fn;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 5d5c65f..ab787ae 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2328,7 +2328,19 @@
{
enum osmo_gsm631_sid_class sidc;
- /* If we got no payload (BFI without data), there is nothing
+ /* No matter what else is happening, even if we are about to bail out
+ * early because we received FACCH and thus BFI-no-data, if we are
+ * at a mandatory-Tx position for SID, we need to clear UL SID filter
+ * state so that the next valid SID frame will be allowed through,
+ * whether it occurs right now or in a later frame position because
+ * of FACCH. See the note in GSM 06.31 section 5.1.2: if the
+ * SACCH-aligned SID update position is stolen by FACCH, the next
+ * frame position shall carry the SID update as soon as FACCH stealing
+ * is over. */
+ if (fr_hr_efr_sid_position(lchan, fn))
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = false;
+
+ /* If we got no payload (BFI without data), there is nothing more
* for us to do here. */
if (msg->len == 0)
return;
@@ -2369,11 +2381,26 @@
* is an accepted SID frame in the definition of GSM 06.31
* and its HR & EFR counterparts.
*
- * 2) Next patch in the series will introduce logic that sets BFI
- * under certain conditions dependent on SID classification and
- * previous state, in order to suppress false indications of
- * "valid" SID to the Rx DTX handler on the RTP receiving end
- * during "half-block" conditions.
+ * 2) As a result of how FR/HR/EFR DTX interacts with block diagonal
+ * interleaving, at the beginning and end of each DTX pause a
+ * correctly functioning TCH receiver will always pick up an
+ * artifact consisting of 4 received bursts (2 for TCH/HS)
+ * and same number of omitted bursts. Standard channel decoding
+ * of this Rx artifact will produce a "half-block" in which half
+ * of the bits prior to convolutional decoding will come from
+ * a SID repetition whose Tx was notionally suppressed, while
+ * the other half will be garbage. As a result of convolutional
+ * decoding, the result will often appear as valid SID per
+ * classification rules - but passing it as such to the Rx DTX
+ * handler is wrong. Classic E1 BTS and GSM MS implementations
+ * include a kind of SID filter at this point, setting BFI on
+ * these received half-blocks, so that the Rx DTX handler will
+ * see an invalid SID condition. Invalid SID means that comfort
+ * noise generation is to be continued, but no updated CN
+ * parameters are available - which is the truth in half-block
+ * Rx situations. We implement the same filter. More info here:
+ *
+ * https://osmocom.org/projects/retro-gsm/wiki/DTXu_half-blocks
*
* 3) For HR codec only, RTP output format functions need to know
* both BFI flag and SID classification.
@@ -2382,12 +2409,32 @@
case OSMO_GSM631_SID_CLASS_SPEECH:
/* Only a good speech frame, not an unusable frame,
* using GSM 06.31 definitions, marks exit from a DTX pause. */
- if (!tch_ul_msg_bfi(msg))
+ if (!tch_ul_msg_bfi(msg)) {
lchan_set_marker(false, lchan);
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = false;
+ }
break;
- case OSMO_GSM631_SID_CLASS_INVALID:
case OSMO_GSM631_SID_CLASS_VALID:
+ /* Here comes the just-described SID filter. The logic is
+ * thus: a valid SID is allowed through to the Rx DTX handler
+ * if it follows speech (end of talkspurt), if it appears
+ * in the expected mandatory-Tx position for SID updates,
+ * or if it happens after that mandatory-Tx position due to
+ * FACCH stealing. Otherwise, valid SID is converted to
+ * invalid by setting BFI.
+ */
+ if (lchan->tch.dtx_fr_hr_efr.ul_sid_filter)
+ tch_ul_msg_bfi(msg) = true;
+ /* fall through */
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ /* Whether we got valid or invalid SID, we know that the MS
+ * has entered or remains in a DTXu pause. (Invalid SID
+ * means that MS state is known to be DTXu, but no CN
+ * parameters are available.) Hence we indicate DTXu pause
+ * state for both RTP marker bit and SID filter mechanisms.
+ */
lchan_set_marker(true, lchan);
+ lchan->tch.dtx_fr_hr_efr.ul_sid_filter = true;
break;
default:
/* There are only 3 possible SID classifications per
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41049?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I46c62312316b04567bcadf6050597673f071247d
Gerrit-Change-Number: 41049
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/41047?usp=email )
Change subject: TCH UL path: add out-of-band BFI flag
......................................................................
TCH UL path: add out-of-band BFI flag
In original OsmoBTS architecture prior to Themyscira patches,
BFI (Bad Frame Indication) condition was signaled internally by
zero-length payload passed from BTS model to l1sap, and externally
by absence of RTP output (intentional gap) or a zero-length RTP
payload emitted in 'rtp continuous-streaming' mode. However, this
paradigm is contrary to classic GSM BSS architecture in which BFI
is an out-of-band metadata flag that travels alongside with frame
payload bits, whether the latter are valid or invalid.
Since 2024 OsmoBTS supports the option of TW-TS-001 output for
FR and EFR codecs, which allows the possibility of BFI-with-data
in RTP. OsmoBTS can already emit such BFI-with-data packets when
the BTS model delivered a deemed-good traffic frame, but that frame
was subsequently deemed bad by the link quality check in l1sap -
but there is still no explicit out-of-band BFI flag inside OsmoBTS
TCH UL path.
By introducing an out-of-band BFI flag, we make it possible for BTS
model PHYs to deliver marked-bad traffic frames: when CRC fails
in GSM 05.03 channel decoding step, a PHY that permits modification
(libosmocoding or future FOSS DSP PHY) can be enhanced to preserve
channel-decoded bits while conveying BFI.
The link quality check in l1sap is reworked to use the new OOB BFI
flag. Follow-on patches will introduce further logic that can also
assert BFI at high level, above BTS model PHYs.
While reworking the link quality check in l1sap, restrict it to
speech modes only: per GSM specs, BFI does not exist in CSD.
Change-Id: I8097946429e83eae90f89e49d17ffb8eb0636fcb
---
M include/osmo-bts/msg_utils.h
M src/common/l1sap.c
2 files changed, 58 insertions(+), 21 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index db7142d..6cebce7 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -13,21 +13,38 @@
struct msgb;
-/* Access 1st part of msgb control buffer */
+/****************************************************************
+* Accessor macros for control buffer words in RTP input path (DL)
+*****************************************************************/
+
+/* Storing RTP header fields in the path from RTP and Osmux
+ * Rx callback functions to TCH-RTS.ind handling.
+ * FIXME: do we really need this RTP header info downstream
+ * of the jitter buffer mechanism in the RTP endpoint library?
+ */
#define rtpmsg_marker_bit(x) ((x)->cb[0])
+#define rtpmsg_seq(x) ((x)->cb[1])
+#define rtpmsg_ts(x) ((x)->cb[2])
-/* Access 2nd part of msgb control buffer */
-#define rtpmsg_seq(x) ((x)->cb[1])
-
-/* Access 3rd part of msgb control buffer */
-#define rtpmsg_ts(x) ((x)->cb[2])
-
-/* Access 4th part of msgb control buffer */
+/* l1sap_rtp_rx_cb() does some preening or preparsing on some
+ * RTP payloads, and in two cases (HR with RFC 5993 input and
+ * CSD NT modes) this preparsing step produces some metadata
+ * that need to be passed to TCH-RTS.ind handling.
+ */
#define rtpmsg_is_rfc5993_sid(x) ((x)->cb[3])
-
-/* Access 5th part of msgb control buffer */
#define rtpmsg_csd_align_bits(x) ((x)->cb[4])
+/********************************************************
+* Accessor macros for control buffer words in TCH UL path
+*********************************************************/
+
+/* We provide an ability for BTS models to indicate BFI along with payload
+ * bits just like in GSM 08.60 TRAU-UL frames, and the same BFI flag can
+ * then be set by model-independent functions for higher-level BFI
+ * conditions. This cb word shall act as a Boolean flag.
+ */
+#define tch_ul_msg_bfi(x) ((x)->cb[0])
+
/**
* Classification of OML message. ETSI for plain GSM 12.21
* messages and IPA/Osmo for manufacturer messages.
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 09f6a90..8f7745e 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2220,16 +2220,15 @@
/* a helper function for emitting FR/EFR UL in TW-TS-001 format */
static void send_rtp_twts001(struct gsm_lchan *lchan, uint32_t fn,
- struct msgb *msg, bool good_frame)
+ struct msgb *msg)
{
uint8_t teh;
bool send_frame;
if (msg->len == GSM_FR_BYTES || msg->len == GSM_EFR_BYTES) {
- if (good_frame)
- teh = 0xE0;
- else
- teh = 0xE2;
+ teh = 0xE0;
+ if (tch_ul_msg_bfi(msg))
+ teh |= 0x02;
send_frame = true;
} else {
teh = 0xE6;
@@ -2272,7 +2271,7 @@
lchan->type == GSM_LCHAN_TCH_F &&
(lchan->tch_mode == GSM48_CMODE_SPEECH_V1 ||
lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)) {
- send_rtp_twts001(lchan, fn, msg, false);
+ send_rtp_twts001(lchan, fn, msg);
return;
}
@@ -2345,10 +2344,31 @@
msgb_pull_to_l2(msg);
/* Low level layers always call us when TCH content is expected, even if
- * the content is not available due to decoding issues. Content not
- * available is expected as empty payload. We also check if quality is
- * good enough. */
- if (msg->len && tch_ind->lqual_cb >= bts->min_qual_norm) {
+ * the content is not available due to decoding issues. Content not
+ * available is indicated as empty payload, also termed BFI w/o data.
+ * Alternatively, a BTS model can supply channel-decoded payload bits,
+ * but also set BFI flag, just like in TRAU-UL frames on E1 Abis.
+ *
+ * If the channel mode is speech (not CSD), we also check if quality is
+ * good enough - if it isn't, we set BFI. This quality check is
+ * essential with FRv1 codec and DTXu, otherwise DTXu pauses will be
+ * filled with very unpleasant sounds as channel-decoded radio noise
+ * gets declared as good traffic frames with 1/8 probability given
+ * only a 3-bit CRC. However, this check is restricted to speech
+ * because per the specs, BFI does not exist in CSD: every channel-
+ * decoded frame is passed along, error handling either falls on RLP
+ * or is the responsibility of user applications in Transparent mode.
+ */
+ if ((lchan->rsl_cmode == RSL_CMOD_SPD_SPEECH) &&
+ (tch_ind->lqual_cb < bts->min_qual_norm))
+ tch_ul_msg_bfi(msg) = true;
+
+ /* FR/HR/EFR SID classification, with potential effects on BFI flag,
+ * will go here - further patches in the series. */
+
+ /* Good RTP output happens when we got some payload AND it is not
+ * marked as BFI. */
+ if (msg->len && !tch_ul_msg_bfi(msg)) {
/* feed the good frame to the ECU, if we are applying one */
if (lchan->ecu_state)
osmo_ecu_frame_in(lchan->ecu_state, false, msg->data, msg->len);
@@ -2361,7 +2381,7 @@
lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)) {
/* FR and EFR codecs */
if (lchan->abis_ip.rtp_extensions & OSMO_RTP_EXT_TWTS001)
- send_rtp_twts001(lchan, fn, msg, true);
+ send_rtp_twts001(lchan, fn, msg);
else
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
} else if (lchan->type == GSM_LCHAN_TCH_H &&
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41047?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8097946429e83eae90f89e49d17ffb8eb0636fcb
Gerrit-Change-Number: 41047
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
falconia has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/41048?usp=email )
Change subject: FR/HR/EFR: centralize TCH UL SID classification
......................................................................
FR/HR/EFR: centralize TCH UL SID classification
In any environment where GSM MS may exercise DTXu on TCH/FS, TCH/HS or
TCH/EFS, the BTS receiving this TCH UL has to classify each received
traffic frame as valid SID, invalid SID or non-SID speech. For E1 BTS
this SID classification requirement is explicit as there are dedicated
bits in TRAU-UL frames carrying the SID code. For an IP BTS the need
for this classification is less obvious as most RTP payload formats
omit SID indicator bits - however:
* For HR codec, RTP output in RFC 5993 and TW-TS-002 formats does
include explicit SID classification;
* Also for HR output in both TS 101 318 and RFC 5993 formats
(but not TW-TS-002), SID classification must be considered in order
to turn valid SID with some bit errors into perfect SID codeword;
* OsmoBTS already had logic for all 3 of FR/HR/EFR whereby if a frame
is received that is an accepted SID frame in GSM 06.31/06.41/06.81
definition, a flag is set so that the next good speech frame will
be emitted in RTP with marker bit set. This logic implies SID
classification in TCH UL path.
Prior to this patch, OsmoBTS performed limited, non-consolidated
SID classification:
* For FR and EFR, the only SID classification in TCH UL path was done
for RTP marker purposes by way of osmo_{fr,efr}_is_any_sid() Boolean
result fed to lchan_set_marker();
* For the same RTP marker logic with HR codec, only perfect, error-free
SID frames were detected;
* The same limitation applied to SID classification for RFC 5993 output.
Centralize this SID classification by moving it from BTS model to common
l1sap code and unifying it across all 3 codecs. Immediate functional
effects from this change are:
* On TCH/HS we now detect imperfect (partially corrupted) SID frames
and classify them as valid or invalid SID as intended by ETSI,
like we already did for TCH/FS and TCH/EFS;
* When emitting TS 101 318 or RFC 5993, we apply the inherent limitations
of those RTP formats to valid and invalid SID;
* With all 3 codecs, the check for a good speech frame as exit criterion
from DTXu state now happens after the link quality check in l1sap,
rather than before.
AMR speech mode is not affected at all by these changes: AMR DTX model
is completely different from that of FR/HR/EFR.
Related: OS#6036
Change-Id: Id6c8c146962de2f173760889eb232693bb4229d3
---
M include/osmo-bts/msg_utils.h
M src/common/l1sap.c
M src/osmo-bts-lc15/tch.c
M src/osmo-bts-oc2g/tch.c
M src/osmo-bts-sysmo/tch.c
M src/osmo-bts-trx/sched_lchan_tchf.c
M src/osmo-bts-trx/sched_lchan_tchh.c
7 files changed, 131 insertions(+), 50 deletions(-)
Approvals:
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, approved
Jenkins Builder: Verified
diff --git a/include/osmo-bts/msg_utils.h b/include/osmo-bts/msg_utils.h
index 6cebce7..7942a17 100644
--- a/include/osmo-bts/msg_utils.h
+++ b/include/osmo-bts/msg_utils.h
@@ -45,6 +45,18 @@
*/
#define tch_ul_msg_bfi(x) ((x)->cb[0])
+/* For HRv1 codec, we have to pass SID classification from the function
+ * that makes the initial determination to TS 101 318, RFC 5993 and
+ * TW-TS-002 output functions. Per classic GSM specs, common across
+ * FR/HR/EFR, SID classification code is an integer equal to 0, 1 or 2;
+ * in Osmocom it is enum osmo_gsm631_sid_class.
+ *
+ * NOTE: while the actual SID ternary classification exists in exactly
+ * the same form across all 3 of FR/HR/EFR, we store it in a cb word
+ * only for HR codec where we need it for RTP output functions.
+ */
+#define tch_ul_msg_hr_sid(x) ((x)->cb[1])
+
/**
* Classification of OML message. ETSI for plain GSM 12.21
* messages and IPA/Osmo for manufacturer messages.
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 8f7745e..5d5c65f 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -2200,24 +2200,6 @@
handle_tch_ind_csd_hr(lchan, tch_ind, data, data_len);
}
-/* a helper function for emitting HR1 UL in RFC 5993 format */
-static void send_rtp_rfc5993(struct gsm_lchan *lchan, uint32_t fn,
- struct msgb *msg)
-{
- uint8_t toc;
-
- OSMO_ASSERT(msg->len == GSM_HR_BYTES);
- /* FIXME: implement proper SID classification per GSM 06.41 section
- * 6.1.1; see OS#6036. Until then, detect error-free SID frames
- * using our existing osmo_hr_check_sid() function. */
- if (osmo_hr_check_sid(msg->data, msg->len))
- toc = 0x20;
- else
- toc = 0x00;
- msgb_push_u8(msg, toc);
- send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
-}
-
/* a helper function for emitting FR/EFR UL in TW-TS-001 format */
static void send_rtp_twts001(struct gsm_lchan *lchan, uint32_t fn,
struct msgb *msg)
@@ -2305,6 +2287,117 @@
lchan->rtp_tx_marker = true;
}
+/* Helper function for l1sap_tch_ind(): RTP output for GSM-HR in either
+ * of the two standard, non-ThemWi-extended payload formats, with restrictions
+ * inherent to these non-TRAU-UL-like formats. */
+static void send_gsmhr_std_rtp(struct gsm_lchan *lchan,
+ const struct gsm_time *g_time, struct msgb *msg,
+ bool emit_rfc5993)
+{
+ uint32_t fn = g_time->fn;
+
+ OSMO_ASSERT(msg->len == GSM_HR_BYTES);
+
+ switch (tch_ul_msg_hr_sid(msg)) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ break;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ /* neither of these RTP formats allows invalid SID */
+ tch_ul_bfi_handler(lchan, g_time, msg);
+ return;
+ case OSMO_GSM631_SID_CLASS_VALID:
+ /* both formats require perfect, error-free SID output */
+ osmo_hr_sid_reset(msg->data);
+ break;
+ default:
+ OSMO_ASSERT(0);
+ }
+
+ /* Are we emitting "bare" TS 101 318 or "decorated" RFC 5993? */
+ if (emit_rfc5993) {
+ uint8_t toc = tch_ul_msg_hr_sid(msg) << 4;
+ msgb_push_u8(msg, toc);
+ }
+
+ send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+}
+
+/* Helper function for l1sap_tch_ind(): SID classification and related logic
+ * for FR, HR and EFR speech codecs. */
+static void tch_ul_fr_hr_efr(struct gsm_lchan *lchan, uint32_t fn, struct msgb *msg)
+{
+ enum osmo_gsm631_sid_class sidc;
+
+ /* If we got no payload (BFI without data), there is nothing
+ * for us to do here. */
+ if (msg->len == 0)
+ return;
+
+ /* GSM 06.31, 06.41 and 06.81 are DTX specs for FR, HR and EFR,
+ * respectively. Section 6.1.1 in each of these specs defines a
+ * ternary SID classification whereby each channel-decoded traffic
+ * frame is valid SID, invalid SID or non-SID speech. Perform
+ * this classification. */
+ switch (lchan->tch_mode) {
+ case GSM48_CMODE_SPEECH_V1:
+ if (lchan->type == GSM_LCHAN_TCH_F) {
+ sidc = osmo_fr_sid_classify(msg->data);
+ } else {
+ /* None of our current BTS models has UFI or BCI
+ * error flags for TCH/HS UL Rx, hence we have to
+ * perform SID classification without BCI. */
+ sidc = osmo_hr_sid_classify(msg->data, false, NULL);
+ /* Pass it to RTP output functions */
+ tch_ul_msg_hr_sid(msg) = sidc;
+ }
+ break;
+ case GSM48_CMODE_SPEECH_EFR:
+ sidc = osmo_efr_sid_classify(msg->data);
+ break;
+ default:
+ /* This static function should never be called except for
+ * V1 and EFR speech modes. */
+ OSMO_ASSERT(0);
+ }
+
+ /* We use this SID classification for three purposes:
+ *
+ * 1) For those users who desire to have RTP marker bit set in the
+ * output packet corresponding to the first speech frame after
+ * a DTX pause, the logic of lchan_set_marker() is driven by
+ * the determination of whether or not each received traffic frame
+ * is an accepted SID frame in the definition of GSM 06.31
+ * and its HR & EFR counterparts.
+ *
+ * 2) Next patch in the series will introduce logic that sets BFI
+ * under certain conditions dependent on SID classification and
+ * previous state, in order to suppress false indications of
+ * "valid" SID to the Rx DTX handler on the RTP receiving end
+ * during "half-block" conditions.
+ *
+ * 3) For HR codec only, RTP output format functions need to know
+ * both BFI flag and SID classification.
+ */
+ switch (sidc) {
+ case OSMO_GSM631_SID_CLASS_SPEECH:
+ /* Only a good speech frame, not an unusable frame,
+ * using GSM 06.31 definitions, marks exit from a DTX pause. */
+ if (!tch_ul_msg_bfi(msg))
+ lchan_set_marker(false, lchan);
+ break;
+ case OSMO_GSM631_SID_CLASS_INVALID:
+ case OSMO_GSM631_SID_CLASS_VALID:
+ lchan_set_marker(true, lchan);
+ break;
+ default:
+ /* There are only 3 possible SID classifications per
+ * section 6.1.1 of each of the three DTX specs,
+ * and correspondingly only 3 possible output values
+ * from osmo_*_sid_classify() functions. */
+ OSMO_ASSERT(0);
+ }
+}
+
/* TCH received from bts model */
static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
struct ph_tch_param *tch_ind)
@@ -2363,8 +2456,12 @@
(tch_ind->lqual_cb < bts->min_qual_norm))
tch_ul_msg_bfi(msg) = true;
- /* FR/HR/EFR SID classification, with potential effects on BFI flag,
- * will go here - further patches in the series. */
+ /* For FR, HR or EFR speech we also have to perform SID classification
+ * and apply logic that results from such. This logic can also set
+ * BFI that wasn't set before! */
+ if (lchan->tch_mode == GSM48_CMODE_SPEECH_V1 ||
+ lchan->tch_mode == GSM48_CMODE_SPEECH_EFR)
+ tch_ul_fr_hr_efr(lchan, fn, msg);
/* Good RTP output happens when we got some payload AND it is not
* marked as BFI. */
@@ -2388,10 +2485,8 @@
lchan->tch_mode == GSM48_CMODE_SPEECH_V1) {
/* HR codec: TS 101 318 or RFC 5993,
* will also support TW-TS-002 in the future. */
- if (bts->emit_hr_rfc5993)
- send_rtp_rfc5993(lchan, fn, msg);
- else
- send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
+ send_gsmhr_std_rtp(lchan, &g_time, msg,
+ bts->emit_hr_rfc5993);
} else {
/* generic case, no RTP alterations */
send_ul_rtp_packet(lchan, fn, msg->data, msg->len);
diff --git a/src/osmo-bts-lc15/tch.c b/src/osmo-bts-lc15/tch.c
index afd5b53..048b6d3 100644
--- a/src/osmo-bts-lc15/tch.c
+++ b/src/osmo-bts-lc15/tch.c
@@ -68,8 +68,6 @@
cur = msgb_put(msg, GSM_FR_BYTES);
memcpy(cur, l1_payload, GSM_FR_BYTES);
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -102,8 +100,6 @@
cur = msgb_put(msg, GSM_EFR_BYTES);
memcpy(cur, l1_payload, GSM_EFR_BYTES);
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -134,8 +130,6 @@
cur = msgb_put(msg, GSM_HR_BYTES);
memcpy(cur, l1_payload, GSM_HR_BYTES);
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-oc2g/tch.c b/src/osmo-bts-oc2g/tch.c
index 4ea1eb6..c3f0417 100644
--- a/src/osmo-bts-oc2g/tch.c
+++ b/src/osmo-bts-oc2g/tch.c
@@ -68,8 +68,6 @@
cur = msgb_put(msg, GSM_FR_BYTES);
memcpy(cur, l1_payload, GSM_FR_BYTES);
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -102,8 +100,6 @@
cur = msgb_put(msg, GSM_EFR_BYTES);
memcpy(cur, l1_payload, GSM_EFR_BYTES);
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -134,8 +130,6 @@
cur = msgb_put(msg, GSM_HR_BYTES);
memcpy(cur, l1_payload, GSM_HR_BYTES);
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 2cf784e..b5bf04b 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -77,8 +77,6 @@
cur[0] |= 0xD0;
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_fr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -132,8 +130,6 @@
cur[0] |= 0xC0;
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_efr_is_any_sid(l1_payload), lchan);
-
return msg;
}
@@ -218,8 +214,6 @@
osmo_revbytebits_buf(cur, GSM_HR_BYTES);
#endif /* USE_L1_RTP_MODE */
- lchan_set_marker(osmo_hr_check_sid(l1_payload, payload_len), lchan);
-
return msg;
}
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c
index 5a3e80a..2403392 100644
--- a/src/osmo-bts-trx/sched_lchan_tchf.c
+++ b/src/osmo-bts-trx/sched_lchan_tchf.c
@@ -166,14 +166,10 @@
case GSM48_CMODE_SPEECH_V1: /* FR */
rc = gsm0503_tch_fr_decode(tch_data, BUFTAIL8(bursts_p),
1, 0, &n_errors, &n_bits_total);
- if (rc == GSM_FR_BYTES) /* only for valid *speech* frames */
- lchan_set_marker(osmo_fr_is_any_sid(tch_data), lchan); /* DTXu */
break;
case GSM48_CMODE_SPEECH_EFR: /* EFR */
rc = gsm0503_tch_fr_decode(tch_data, BUFTAIL8(bursts_p),
1, 1, &n_errors, &n_bits_total);
- if (rc == GSM_EFR_BYTES) /* only for valid *speech* frames */
- lchan_set_marker(osmo_efr_is_any_sid(tch_data), lchan); /* DTXu */
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
/* the first FN 0,8,17 defines that CMI is included in frame,
diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c
index 01ac155..5d5f246 100644
--- a/src/osmo-bts-trx/sched_lchan_tchh.c
+++ b/src/osmo-bts-trx/sched_lchan_tchh.c
@@ -232,10 +232,6 @@
rc = gsm0503_tch_hr_decode2(tch_data, BUFTAIL8(bursts_p),
!sched_tchh_ul_facch_map[bi->fn % 26],
&n_errors, &n_bits_total);
- if (rc == GSM_HR_BYTES) { /* only for valid *speech* frames */
- bool is_sid = osmo_hr_check_sid(tch_data, GSM_HR_BYTES);
- lchan_set_marker(is_sid, lchan); /* DTXu */
- }
break;
case GSM48_CMODE_SPEECH_AMR: /* AMR */
/* the first FN 0,8,17 or 1,9,18 defines that CMI is included
--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/41048?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Id6c8c146962de2f173760889eb232693bb4229d3
Gerrit-Change-Number: 41048
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Attention is currently required from: fixeria, lynxis lazus, pespin.
Hello Jenkins Builder, fixeria, pespin,
I'd like you to reexamine a change. Please visit
https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/41077?usp=email
to look at the new patch set (#3).
The following approvals got outdated and were removed:
Code-Review+1 by fixeria, Verified-1 by Jenkins Builder
Change subject: aaa_diameter_swx_tests: use MAR record to improve readability
......................................................................
aaa_diameter_swx_tests: use MAR record to improve readability
Change-Id: I0e77aae792fb9bc2e7277668a4fdda21a993aaa2
---
M src/aaa_diameter_swx_tests.erl
1 file changed, 21 insertions(+), 17 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/erlang/osmo-epdg refs/changes/77/41077/3
--
To view, visit https://gerrit.osmocom.org/c/erlang/osmo-epdg/+/41077?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: erlang/osmo-epdg
Gerrit-Branch: master
Gerrit-Change-Id: I0e77aae792fb9bc2e7277668a4fdda21a993aaa2
Gerrit-Change-Number: 41077
Gerrit-PatchSet: 3
Gerrit-Owner: lynxis lazus <lynxis(a)fe80.eu>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-Attention: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: lynxis lazus <lynxis(a)fe80.eu>