falconia has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmo-abis/+/39799?usp=email )
Change subject: trau2rtp HR: update to TW-TS-002 version 1.2.0 ......................................................................
trau2rtp HR: update to TW-TS-002 version 1.2.0
osmo_trau2rtp() in HRv1 mode emits either RFC 5993 or TW-TS-002 format, depending on whether or not the latter extended format is enabled. TW-TS-002 can represent BFIs and invalid SID frames, in addition to good speech and valid SID in common with RFC 5993.
TW-TS-002 spec has recently been updated to version 1.2.0:
https://www.freecalypso.org/specs/tw-ts-002-v010200.txt
The principal difference is the way invalid SID frames are represented: in version 1.1.0 all payload bits were stripped in the case of invalid SID; version 1.2.0 allows these payload bits to be preserved if they exist. Section 5.4 in the new spec version provides the detailed rationale for this change.
Change osmo_trau2rtp() operating on HR frames in TW-TS-002 mode to emit invalid SID frames in the "verbose" form of TW-TS-002 version 1.2.0.
Compatibility considerations: there is no currently released or deployed software that accepts TW-TS-002 version 1.1.0 but not version 1.2.0. More specifically:
* osmo_rtp2trau() in TRAU-UL/TFO output mode accepts invalid SID in both short and long forms since first implementation;
* Themyscira libgsmhr1, the library that accepts TW-TS-002 RTP input for either full speech decoding or TFO transform, has not yet reached its first release. The current code in Hg implements TW-TS-002 version 1.2.0, thus the library will support both short and long forms of invalid SID upon its upcoming first release.
Change-Id: I497ad7b1f0f7229dc9a50cd3cc318e3dc1394171 --- M src/trau/trau_rtp_conv.c M tests/trau_conv/trau2rtp_hr_twts002.ok 2 files changed, 7 insertions(+), 5 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/libosmo-abis refs/changes/99/39799/1
diff --git a/src/trau/trau_rtp_conv.c b/src/trau/trau_rtp_conv.c index a36d317..f2e0022 100644 --- a/src/trau/trau_rtp_conv.c +++ b/src/trau/trau_rtp_conv.c @@ -294,9 +294,10 @@ if (tf->c_bits[11] && sidc == OSMO_GSM631_SID_CLASS_SPEECH) out[0] = FT_BFI_WITH_DATA << 4; twts002_hr16_set_extra_flags(out, tf); - /* invalid SID frames are truncated in TW-TS-002 */ + /* Invalid SID handling updated in TW-TS-002 version 1.2.0: + * see sections 5.4 and 6.2.3. */ if (sidc == OSMO_GSM631_SID_CLASS_INVALID) - return 1; + out[0] |= 0x04; /* Invalid_SID_Verbose bit */ }
/* TS 101 318 Section 5.2: The order of occurrence of the codec parameters in the buffer is @@ -398,12 +399,13 @@ /* can be represented only in TW-TS-002, not in RFC 5993 */ if (!emit_twts002) return 0; - out[0] = FT_INVALID_SID << 4; + out[0] = (FT_INVALID_SID << 4) | 0x04; /* Invalid_SID_Verbose */ twts002_hr8_set_extra_flags(out, tf); /* XC4 is TAF with this frame type */ if (tf->xc_bits[3]) out[0] |= 0x01; - return 1; /* short format per TW-TS-002 */ + osmo_ubit2pbit(out + 1, tf->d_bits, 112); + return GSM_HR_BYTES_RTP_RFC5993; case 6: case 7: /* bad speech frame (BFI=1, SID=0) */ diff --git a/tests/trau_conv/trau2rtp_hr_twts002.ok b/tests/trau_conv/trau2rtp_hr_twts002.ok index db65082..3593eb9 100644 --- a/tests/trau_conv/trau2rtp_hr_twts002.ok +++ b/tests/trau_conv/trau2rtp_hr_twts002.ok @@ -7,7 +7,7 @@ 00C4FF2305E137DF28F928DD5231EB 00CCFF0580FEB85D20AF485C70CFD0 20025FBB32FFFFFFFFFFFFFFFFFFFF -10 +140399BCE3FFFFFFFFFFFFDD7FFAFF 70 70 70