fixeria has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bts/+/38301?usp=email )
Change subject: csd_v110: properly set bit E2 for TCH/F4.8 NT ......................................................................
csd_v110: properly set bit E2 for TCH/F4.8 NT
As was reported by Mychaela Falconia in:
https://www.freecalypso.org/pipermail/community/2024-September/000941.html
contrary to 3GPP TS 48.020 Table 7, bit E2 is currently always 0 in the RTP output for TCH/F4.8 channels in non-transparent CSD mode.
The problem is that `desc->num_blocks` is 2 for TCH/F4.8 NT, so the for-loop in csd_v110_rtp_encode() will iterate only 2 (not 4) times, and thus `(i >> 1) & 0x01` never evaluates to 1 in this mode.
According to 3GPP TS 44.021, Figure 1, bit E7 is set to 0 in every 4-th frame (Q1), so use it to calculate the value of bit E2 properly.
Change-Id: If8307a9ce0fdc6da45157149ccef7b840ff9d9b3 Fixes: 183c08886 "csd_v110: properly set E1/E2/E3 for non-transparent data" Related: OS#1572 --- M src/common/csd_v110.c 1 file changed, 18 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/01/38301/1
diff --git a/src/common/csd_v110.c b/src/common/csd_v110.c index d6c00b0..5fb86b7 100644 --- a/src/common/csd_v110.c +++ b/src/common/csd_v110.c @@ -78,6 +78,7 @@ { const struct csd_v110_frame_desc *desc; ubit_t ra_bits[80 * 4]; + ubit_t e2_bit = 0;
OSMO_ASSERT(lchan->tch_mode < ARRAY_SIZE(csd_v110_lchan_desc)); if (lchan->type == GSM_LCHAN_TCH_F) @@ -109,8 +110,24 @@ /* E1 .. E3 must set by out-of-band knowledge */ if (lchan->csd_mode == LCHAN_CSD_M_NT) { /* non-transparent: as per 3GPP TS 48.020, Table 7 */ + if ((i & 1) == 0) { /* executed for Q1/Q3 */ + /* E7: 0 for Q1, 1 for Q2/Q3/Q4 (3GPP TS 44.021, Figure 1). + * We use this bit to set E2 bit properly (see below): + * + * | E2 | E7 + * ----+----+---- + * Q1 | =0 | =0 <-- e2_bit=E7 + * ----+----+---- + * Q2 | =0 | =1 + * ----+----+---- + * Q3 | =1 | =1 <-- e2_bit=E7 + * ----+----+---- + * Q4 | =1 | =1 + */ + e2_bit = df.e_bits[6]; + } df.e_bits[0] = 0; /* E1: as per 15.1.2, shall be set to 0 (for BSS-MSC) */ - df.e_bits[1] = (i >> 1) & 0x01; /* E2: 0 for Q1/Q2, 1 for Q3/Q4 */ + df.e_bits[1] = e2_bit; /* E2: 0 for Q1/Q2, 1 for Q3/Q4 */ df.e_bits[2] = (i >> 0) & 0x01; /* E3: 0 for Q1/Q3, 1 for Q2/Q4 */ } else { /* transparent: as per 3GPP TS 44.021, Figure 4 */