falconia has submitted this change. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/32347 )

Change subject: osmo_rtp2trau() for FR & EFR UL: set C13 & C14 correctly
......................................................................

osmo_rtp2trau() for FR & EFR UL: set C13 & C14 correctly

Control bits C13 & C14 in TRAU-UL frames indicate SID classification
per section 6.1.1 of GSM 06.31 for FR or GSM 06.81 for EFR.
Previous commit 08d0c0990275 implements correct setting of C16 in
TRAU-DL, but the case of generating TRAU-UL was left as a FIXME.
Now that we have osmo_{fr,efr}_sid_classify() functions in
libosmocodec, we can set C13 & C14 in TRAU-UL too.  Do it.

Change-Id: Ifcfc28ad7d77e561d456be546689995abfd8a6f5
---
M TODO-RELEASE
M src/trau/trau_rtp_conv.c
2 files changed, 39 insertions(+), 12 deletions(-)

Approvals:
  laforge: Looks good to me, but someone else must approve
  fixeria: Looks good to me, approved
  Jenkins Builder: Verified




diff --git a/TODO-RELEASE b/TODO-RELEASE
index c021505..5f2f654 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -8,3 +8,4 @@
 # If any interfaces have been removed or changed since the last public 
release: c:r:0.
 #library       what            description / commit summary line
 libosmo-abis   struct e1inp_driver Field added at the end (ABI break)
+libosmocodec   >1.8.0          osmo_{fr,efr}_sid_classify() new functions
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index e08b0b9..5c87c46 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -257,6 +257,7 @@
 static int rtp2trau_fr(struct osmo_trau_frame *tf, const uint8_t *data, size_t 
data_len)
 {
        int i, j, k, l, o;
+       enum osmo_gsm631_sid_class sidc;

        /* data_len == 0 for BFI frame */
        if (data_len < GSM_FR_BYTES && data_len != 0)
@@ -296,13 +297,17 @@
        }
        memset(&tf->c_bits[5], 0, 6);   /* C6 .. C11: Time Alignment */
        if (tf->dir == OSMO_TRAU_DIR_UL) {
-               if (data_len == 0)
+               if (data_len == 0) {
                        tf->c_bits[11] = 1;     /* C12: BFI */
-               else
+                       tf->c_bits[12] = 0;     /* C13: SID=0 */
+                       tf->c_bits[13] = 0;     /* C14: SID=0 */
+               } else {
                        tf->c_bits[11] = 0;     /* C12: BFI */
-               /* FIXME: set C13 & C14 per GSM 06.31 section 6.1.1 */
-               tf->c_bits[12] = 0; /* C13: SID=0 */
-               tf->c_bits[13] = 0; /* C14: SID=0 */
+                       /* SID classification per GSM 06.31 section 6.1.1 */
+                       sidc = osmo_fr_sid_classify(data);
+                       tf->c_bits[12] = (sidc >> 1) & 1; /* C13: msb */
+                       tf->c_bits[13] = (sidc >> 0) & 1; /* C14: lsb */
+               }
                tf->c_bits[14] = 0; /* C15: TAF (SACCH or not) */
                tf->c_bits[15] = 1; /* C16: spare */
                tf->c_bits[16] = 0; /* C17: DTXd not applied */
@@ -430,6 +435,7 @@
 {
        int i, j;
        ubit_t check_bits[26];
+       enum osmo_gsm631_sid_class sidc;

        /* data_len == 0 for BFI frame */
        if (data_len < GSM_EFR_BYTES && data_len != 0)
@@ -461,13 +467,17 @@

        memset(&tf->c_bits[5], 0, 6); /* C6 .. C11: Time Alignment */
        if (tf->dir == OSMO_TRAU_DIR_UL) {
-               if (data_len == 0)
-                       tf->c_bits[11] = 1; /* C12: BFI=1 */
-               else
-                       tf->c_bits[11] = 0; /* C12: BFI=1 */
-               /* FIXME: set C13 & C14 per GSM 06.81 section 6.1.1 */
-               tf->c_bits[12] = 0; /* C13: SID=0 */
-               tf->c_bits[13] = 0; /* C14: SID=0 */
+               if (data_len == 0) {
+                       tf->c_bits[11] = 1;     /* C12: BFI */
+                       tf->c_bits[12] = 0;     /* C13: SID=0 */
+                       tf->c_bits[13] = 0;     /* C14: SID=0 */
+               } else {
+                       tf->c_bits[11] = 0;     /* C12: BFI */
+                       /* SID classification per GSM 06.81 section 6.1.1 */
+                       sidc = osmo_efr_sid_classify(data);
+                       tf->c_bits[12] = (sidc >> 1) & 1; /* C13: msb */
+                       tf->c_bits[13] = (sidc >> 0) & 1; /* C14: lsb */
+               }
                tf->c_bits[14] = 0; /* C15: TAF (SACCH) */
                tf->c_bits[15] = 1; /* C16: spare */
                tf->c_bits[16] = 0; /* C17: DTXd applied */

--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/32347
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Ifcfc28ad7d77e561d456be546689995abfd8a6f5
Gerrit-Change-Number: 32347
Gerrit-PatchSet: 3
Gerrit-Owner: falconia <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: falconia <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>
Gerrit-CC: pespin <[email protected]>
Gerrit-MessageType: merged

Reply via email to