falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37150?usp=email )
Change subject: rtp2trau_hr16: set D bits correctly
......................................................................
rtp2trau_hr16: set D bits correctly
The original code failed to do the step of osmo_pbit2ubit() for
transferring HRv1 payload bits from packed to unpacked form,
instead doing the bogon of memcpy()ing the RTP payload directly
into tf->d_bits array - fix it. Also set all D bits to zeros
in the case of empty payload input - not ideal, but better than
transmitting uninitialized memory content.
Change-Id: Icb6a21a12fe82f6637f327d45bd843686a90a458
---
M src/trau/trau_rtp_conv.c
1 file changed, 19 insertions(+), 1 deletion(-)
Approvals:
fixeria: Looks good to me, approved
Jenkins Builder: Verified
pespin: Looks good to me, but someone else must approve
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index 4a62cc0..cf8d12e 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -425,7 +425,9 @@
tf->ufi = 1;
/* CRC is computed by TRAU frame encoder */
if (data_len)
- memcpy(tf->d_bits, data, GSM_HR_BYTES);
+ osmo_pbit2ubit(tf->d_bits, data, GSM_HR_BYTES * 8);
+ else
+ memset(tf->d_bits, 0, GSM_HR_BYTES * 8);
return 0;
}
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/37150?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Icb6a21a12fe82f6637f327d45bd843686a90a458
Gerrit-Change-Number: 37150
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>
Gerrit-MessageType: merged
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37152?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: trau2rtp_hr16: change output format to RFC 5993
......................................................................
trau2rtp_hr16: change output format to RFC 5993
Emitting RFC 5993 payload format instead of TS 101 318 brings
Osmocom+E1 BSS into compliance with TS 48.103 (which requires
RFC 5993 format at AoIP interface), and will also make it much
easier to add optional support for TW-TS-002.
There are no backward compatibility issues: OsmoMGW E1 support
currently works only for FR and EFR, not for HR.
Related: OS#6448
Change-Id: I0bcfdccbf4df5a5cd90a65525527f08107be2cf5
---
M src/trau/trau_rtp_conv.c
1 file changed, 43 insertions(+), 14 deletions(-)
Approvals:
laforge: Looks good to me, but someone else must approve
Jenkins Builder: Verified
fixeria: Looks good to me, approved
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index 5e06273..b19d582 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -147,40 +147,51 @@
static const uint8_t rtp_hr_sid[14] = { 0x00, 0x00, 0x00, 0x00, 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-/*! Generate the 14 bytes ETSI TS 101 318 RTP payload for HR from a decoded 16k TRAU frame.
- * Note that thsi differs from the IETF RFC5993 format. However, as OsmoBTS implements
- * the TS 101 318 format, we also use the same format here. osmo-mgw can convert them.
+/*! Generate an RFC 5993 RTP payload for HR from a decoded 16k TRAU frame.
+ * We previously emitted TS 101 318 format; however, RFC 5993 is the format
+ * specified in TS 48.103 for AoIP, it can also be extended with TRAU-UL-like
+ * capabilities with TW-TS-002, and we now support RFC 5993 output in OsmoBTS
+ * on all models.
* \param[out] out caller-provided output buffer
* \param[in] out_len length of out buffer in bytes
* \param[in] tf input TRAU frame in decoded form
* \returns number of bytes generated in 'out'; negative on error. */
static int trau2rtp_hr16(uint8_t *out, size_t out_len, const struct osmo_trau_frame *tf)
{
- unsigned int i;
+ enum osmo_gsm631_sid_class sidc;
if (tf->type != OSMO_TRAU16_FT_HR)
return -EINVAL;
+ if (out_len < GSM_HR_BYTES_RTP_RFC5993)
+ return -ENOSPC;
+
/* HR Data Bits according to TS 48.061 Section 5.1.4.1.1 */
- if (tf->dir == OSMO_TRAU_DIR_UL && tf->c_bits[11]) /* C12: BFI */
+ sidc = (tf->c_bits[12] << 1) | tf->c_bits[13];
+ /* both C13 and C14 being set is invalid combination */
+ if (sidc > OSMO_GSM631_SID_CLASS_VALID)
goto bad_frame;
- if (out_len < GSM_HR_BYTES)
- return -ENOSPC;
+ /* Plain RFC 5993 without TW-TS-002 extensions does not allow
+ * BFI or invalid SID packets. */
+ if (tf->c_bits[11] || sidc == OSMO_GSM631_SID_CLASS_INVALID)
+ goto bad_frame;
+
+ /* RFC 5993 Frame Type is equal to GSM 06.41 SID classification,
+ * restricted to just speech or valid SID per above. */
+ out[0] = sidc << 4;
/* TS 101 318 Section 5.2: The order of occurrence of the codec parameters in the buffer is
* the same as order of occurrence over the Abis as defined in annex B of ETS 300 969
* [which is 3GPP TS 46.020 */
- osmo_ubit2pbit(out, tf->d_bits, 112);
+ osmo_ubit2pbit(out + 1, tf->d_bits, 112);
- if (tf->c_bits[12] || tf->c_bits[13]) {
- /* Generate SID frame as per TS 101 318 Section 5.2.2 */
- for (i = 0; i < sizeof(rtp_hr_sid); i++)
- out[i] = out[i] | rtp_hr_sid[i];
- }
+ /* RFC 5993 requires SID frames to be perfect, error-free */
+ if (sidc == OSMO_GSM631_SID_CLASS_VALID)
+ osmo_hr_sid_reset(out + 1);
- return GSM_HR_BYTES;
+ return GSM_HR_BYTES_RTP_RFC5993;
bad_frame:
return 0;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/37152?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I0bcfdccbf4df5a5cd90a65525527f08107be2cf5
Gerrit-Change-Number: 37152
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: laforge <laforge(a)osmocom.org>
Gerrit-CC: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
falconia has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37151?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted one.
)Change subject: rtp2trau_hr16: accept both TS 101 318 and RFC 5993 payload formats
......................................................................
rtp2trau_hr16: accept both TS 101 318 and RFC 5993 payload formats
OsmoBTS already accepts both payload formats for HRv1 - do likewise
when interfacing to E1-based BTS. While OsmoMGW does have a vty
config option to convert between TS 101 318 and RFC 5993 payload
formats on the fly, it should be considered deprecated, and we
should be moving toward recommended configurations with that option
disabled.
Change-Id: I125d57d3451b030e35a7b2b95a45e38b4581626c
---
M src/trau/trau_rtp_conv.c
1 file changed, 29 insertions(+), 1 deletion(-)
Approvals:
laforge: Looks good to me, approved
pespin: Looks good to me, but someone else must approve
fixeria: Looks good to me, but someone else must approve
Jenkins Builder: Verified
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c
index cf8d12e..5e06273 100644
--- a/src/trau/trau_rtp_conv.c
+++ b/src/trau/trau_rtp_conv.c
@@ -367,8 +367,20 @@
static int rtp2trau_hr16(struct osmo_trau_frame *tf, const uint8_t *data, size_t data_len)
{
- if (data_len < GSM_HR_BYTES && data_len != 0)
+ /* accept both TS 101 318 and RFC 5993 payloads */
+ switch (data_len) {
+ case GSM_HR_BYTES:
+ break;
+ case GSM_HR_BYTES_RTP_RFC5993:
+ data++;
+ data_len--;
+ break;
+ case 0:
+ /* accept no-data input */
+ break;
+ default:
return -EINVAL;
+ }
tf->type = OSMO_TRAU16_FT_HR;
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/37151?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: I125d57d3451b030e35a7b2b95a45e38b4581626c
Gerrit-Change-Number: 37151
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: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: merged
Attention is currently required from: falconia.
pespin has posted comments on this change. ( https://gerrit.osmocom.org/c/libosmo-abis/+/37150?usp=email )
Change subject: rtp2trau_hr16: set D bits correctly
......................................................................
Patch Set 2: Code-Review+1
(1 comment)
File src/trau/trau_rtp_conv.c:
https://gerrit.osmocom.org/c/libosmo-abis/+/37150/comment/3b5e77aa_820d7747
PS1, Line 428: osmo_pbit2ubit(tf->d_bits, data, 112);
> I changed that raw 112 to GSM_HR_BYTES*8.
yeah much better I guess, thanks!
--
To view, visit https://gerrit.osmocom.org/c/libosmo-abis/+/37150?usp=email
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: libosmo-abis
Gerrit-Branch: master
Gerrit-Change-Id: Icb6a21a12fe82f6637f327d45bd843686a90a458
Gerrit-Change-Number: 37150
Gerrit-PatchSet: 2
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: pespin <pespin(a)sysmocom.de>
Gerrit-Attention: falconia <falcon(a)freecalypso.org>
Gerrit-Comment-Date: Tue, 11 Jun 2024 15:30:44 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: falconia <falcon(a)freecalypso.org>
Comment-In-Reply-To: pespin <pespin(a)sysmocom.de>
Gerrit-MessageType: comment