Project

General

Profile

Actions

Bug #5996

closed

DTXd and SID logic is broken for non-AMR codecs

Added by falconia 12 months ago. Updated 10 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
04/06/2023
Due date:
% Done:

100%

Spec Reference:
TS 46.031 chapter 5

Description

For non-AMR codecs the rules for SID transmission on the downlink are given in TS 46.031 for FR1 and GSM 06.81 for EFR, chapter 5 in both specs, particular emphasis on section 5.1.2. The desired behavior is as follows:

1. If the source feeding codec frames in RTP packets to the GSM RAN sends a new SID frame every 20 ms for the entire duration of every speech pause, mimicking the behavior of TDM-based TRAUs, the BTS needs to select which of these SIDs to transmit and drop the others, following the rules of section 5.1.2: transmit the first SID after non-SID speech frames, and transmit those SIDs which happen to fall into SACCH-aligned frame number positions.

2. If the RTP source sends a SID followed by gaps (no RTP transmission or BFI packets), as is expected to happen when this RTP stream comes from the UL of another GSM call (TrFO), the BTS needs to transmit the first received SID if it comes after a non-SID speech frame, but it also needs to remember this SID so it can be retransmitted if no new SID arrives in the SACCH-aligned frame number slot.

3. Rules 1 and 2 above need to be combined if the RTP source is a mixture of SID frames and frame gaps, but with source SID frames not aligning with the downlink SACCH multiframe. The most sensible way to combine these rules would be to first replace RTP Rx frame gaps with copies of the last SID if they do follow a valid SID (copy this last SID into immediately following frame gaps), and then apply the "filtering" rules of section 5.1.2 when deciding which frames should actually be transmitted on the air.

Furthermore, we need to consider what should be done when the RTP stream hitting the BTS contains SID frames even though DTXd is disabled. Per classic GSM specs this condition is a "should never happen", but actually making this condition not-happen (by implementing the logic of TS 28.062 section C.3.2.1.1) would be extremely difficult for EFR and HR1 (though easy for FR1), hence I propose that we cheat a little: have the BTS apply exactly the same logic in the presence of SID frames in its RTP input irrespective of whether DTXd is enabled or disabled, and in the case of DTXd being disabled, do a "fake DTXd" by transmitting dummy FACCH (an L2 fill frame) during those times when Tx would be physically turned off if DTXd were possible and enabled.

The present code fails to do most of the above:

1. osmo-bts-sysmo implements a SID catcher in the DL, repeating the last captured SID in the SACCH-aligned frame number position, but this logic is disabled when DTXd is disabled, resulting in the PHY getting an empty message instead of SID transmission in those SACCH-aligned positions, and resulting in the MS receiving a BFI there, causing its "lost SID" logic to kick in prematurely.

2. Even if one were to enable DTXd in osmo-bts-sysmo, that DL SID catcher logic is broken for non-AMR codecs: it will only save the first 20 bytes of the SID frame (out of 33 for FR or 31 for EFR), and then try to retransmit (send to the PHY) a truncated 20-byte SID frame in the SACCH-aligned position. It is unknown what the proprietary PHY will do with such an invalid, truncated FR or EFR SID frame.

3. osmo-bts-trx has no DTXd support at all, but more importantly, it has no DL SID handling logic, which is needed even in the absence of DTXd. The end effect on the shape of the transmitted DL and on the GSM MS will be the same as with problem point 1 above, osmo-bts-sysmo with DTXd disabled.

4. If the RTP source sends a new SID every 20 ms throughout pause periods and DTXd is enabled and supported by the BTS model, this DTXd will be defeated (radio Tx will never be cut) because the SID "filtering" logic of TS 46.031 section 5.1.2 is missing.

5. Like the previous point, but with DTXd disabled: having SID transmitted in every frame position, instead of having dummy FACCH inserted as "fake DTXd" in those frame positions where section 5.1.2 says "no Tx", will mess up the spec-compliant Rx DTX handler in the MS, particularly its SID update and interpolation logic.

I have a plan in mind for how to fix this bug and implement all desired functionality as outlined here, but it is currently blocked waiting for resolution of this libosmocodec patch and its prerequisites:

https://gerrit.osmocom.org/c/libosmocore/+/32184


Related issues

Related to OsmoBTS - Feature #6036: Implement ternary SID classification for HR1 uplinkNew05/17/2023

Actions
Actions

Also available in: Atom PDF

Add picture from clipboard (Maximum size: 48.8 MB)