falconia has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/libosmo-abis/+/39623?usp=email )


Change subject: rtp2trau HR: remove broken TRAU-16k-UL support
......................................................................

rtp2trau HR: remove broken TRAU-16k-UL support

GSM 08.61 defines two TRAU frame formats for HRv1 codec, using
either 16 kbit/s or 8 kbit/s submultiplexing.  The 16k format may be
used only on Abis, not in TFO.  When we interface to an E1 BTS, we
need to receive TRAU-UL frames and generate TRAU-DL frames - not
any other combination.  Untested support for emitting both
TRAU-16k-DL and TRAU-16k-UL frames for HR codec was added in the
very initial version of trau_rtp_conv.c module in 2020 by HW - but
while TRAU-16k-DL output support is potentially useful (if there
exist any historical BTS models that use this format), there is no
code anywhere in Osmocom that uses osmo_rtp2trau() to generate
TRAU-16k-UL frames for HR.

The legacy code that is removed in this patch should be considered
broken.  Proper generation of TRAU-16k-UL frames (e.g., in a BTS
emulator) would require ability to generate BFI, UFI, invalid SID,
TAF and other possible happenings in the UL of a call leg, but no
such capabilities exist in the legacy code being removed.  We do
support all of these capabilities for TRAU-8k-UL output, using
TW-TS-002 as the matching RTP format, but TW-TS-002 was designed
to feature-match TRAU-8k-UL, not TRAU-16k-UL.

Change-Id: If50036c4de9a11db524abffcd87d053878104982
---
M src/trau/trau_rtp_conv.c
1 file changed, 22 insertions(+), 46 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/23/39623/1

diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index d5ac1fa..86d2b77 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -678,6 +678,10 @@

 static int rtp2trau_hr16(struct osmo_trau_frame *tf, const uint8_t *data, 
size_t data_len)
 {
+       /* for TRAU-16k form of GSM-HR, we only support TRAU-DL output */
+       if (tf->dir != OSMO_TRAU_DIR_DL)
+               return -ENOTSUP;
+
        /* accept both TS 101 318 and RFC 5993 payloads */
        switch (data_len) {
        case GSM_HR_BYTES:
@@ -695,57 +699,26 @@

        tf->type = OSMO_TRAU16_FT_HR;

-       if (tf->dir == OSMO_TRAU_DIR_UL) {
-               /* C1 .. C5 */
-               tf->c_bits[0] = 0;
-               tf->c_bits[1] = 0;
-               tf->c_bits[2] = 0;
-               tf->c_bits[3] = 1;
-               tf->c_bits[4] = 1;
-       } else {
-               /* C1 .. C5 */
-               tf->c_bits[0] = 1;
-               tf->c_bits[1] = 1;
-               tf->c_bits[2] = 1;
-               tf->c_bits[3] = 0;
-               tf->c_bits[4] = 1;
-       }
+       /* C1 .. C5 */
+       tf->c_bits[0] = 1;
+       tf->c_bits[1] = 1;
+       tf->c_bits[2] = 1;
+       tf->c_bits[3] = 0;
+       tf->c_bits[4] = 1;
        /* C6.. C11: Time Alignment */
        memset(tf->c_bits + 5, 0, 6);
-       if (tf->dir == OSMO_TRAU_DIR_UL) {
-               /* BFI */
-               if (data_len == 0)
-                       tf->c_bits[11] = 1;
-               else
-                       tf->c_bits[11] = 0;
-               if (osmo_hr_check_sid(data, data_len)) {
-                       /* SID=2 is a valid SID frame */
-                       tf->c_bits[12] = 1;
-                       tf->c_bits[13] = 0;
-               } else {
-                       tf->c_bits[12] = 0;
-                       tf->c_bits[13] = 0;
-               }
-               /* FIXME: C15: TAF */
+       tf->c_bits[11] = 1; /* C12: UFE */
+       tf->c_bits[12] = 1; /* C13: spare */
+       tf->c_bits[13] = 1; /* C14: spare */
+       tf->c_bits[14] = 1; /* C15: spare */
+       if (osmo_hr_check_sid(data, data_len))
                tf->c_bits[15] = 0; /* C16: SP */
-               tf->c_bits[16] = 0; /* C17: DTXd shall not be applied */
-       } else {
-               tf->c_bits[11] = 1; /* C12: UFE */
-               tf->c_bits[12] = 1; /* C13: spare */
-               tf->c_bits[13] = 1; /* C14: spare */
-               tf->c_bits[14] = 1; /* C15: spare */
-               if (osmo_hr_check_sid(data, data_len))
-                       tf->c_bits[15] = 0; /* C16: SP */
-               else
-                       tf->c_bits[15] = 1; /* C16: SP */
-               tf->c_bits[16] = 1; /* C17: spare */
-       }
+       else
+               tf->c_bits[15] = 1; /* C16: SP */
+       tf->c_bits[16] = 1; /* C17: spare */
        memset(tf->c_bits+17, 1, 4); /* C18..C21: spare */
        memset(&tf->t_bits[0], 1, 4);
-       if (tf->dir == OSMO_TRAU_DIR_UL)
-               tf->ufi = 0;
-       else
-               tf->ufi = 1;
+       tf->ufi = 1;    /* spare bit in TRAU-DL */
        if (data_len)
                osmo_pbit2ubit(tf->d_bits, data, GSM_HR_BYTES * 8);
        else
@@ -1693,6 +1666,9 @@
  *   format for conversion to TRAU-UL is TW-TS-002.  RFC 5993 payloads are
  *   also accepted (because it is a subset of TW-TS-002), but not TS 101 318.
  *
+ * - HRv1 conversion to TRAU-UL is supported only in TRAU-8k format, not
+ *   TRAU-16k.  TFO always uses TRAU-8k format for this codec.
+ *
  * - TRAU-UL output for CSD 14.4 kbit/s mode is not currently implemented
  *   (C-bits are always set according to the rules for TRAU-DL) - but the
  *   primary application for TRAU-UL frame output via libosmotrau is TFO,

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

Gerrit-MessageType: newchange
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: If50036c4de9a11db524abffcd87d053878104982
Gerrit-Change-Number: 39623
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <fal...@freecalypso.org>

Reply via email to