falconia has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-bts/+/32100 )


Change subject: sysmo: emit empty RTP ticks during FACCH stealing on TCH/F
......................................................................

sysmo: emit empty RTP ticks during FACCH stealing on TCH/F

When FACCH stealing occurs and sysmoBTS L1 delivers GsmL1_Sapi_FacchF
instead of GsmL1_Sapi_TchF, that 20 ms unit still needs to be
accounted for in the RTP timestamp cadence, and if we run with
rtp always-output output, then an actual BFI packet needs to be
emitted.  The original code failed to do either; the present
change implements correct behavior for TCH/F.

The case of TCH/H is still unhandled, and it may or may not be
possible to handle correctly, particularly for rtp always-output mode.
The fundamental difficulty is that in order to produce truly
undisrupted RTP timing, two BFI packets will need to be sent for
one FACCH, spaced 20 ms apart - but if the PHY only sends one
GsmL1_Sapi_FacchH message surrounded by a 40 ms time gap, then
we may be out of luck.

Related: OS#5974
Change-Id: I39d15faade28fb7d670493a99a0e0bdb654e2a4a
---
M src/osmo-bts-sysmo/l1_if.c
M src/osmo-bts-sysmo/l1_if.h
M src/osmo-bts-sysmo/tch.c
3 files changed, 56 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/00/32100/1

diff --git a/src/osmo-bts-sysmo/l1_if.c b/src/osmo-bts-sysmo/l1_if.c
index 646cf01..06347cf 100644
--- a/src/osmo-bts-sysmo/l1_if.c
+++ b/src/osmo-bts-sysmo/l1_if.c
@@ -980,6 +980,12 @@
                return rc;
        }

+       /* If we got FACCH, the RTP clock needs to account for it,
+        * and if we have rtp always-output enabled, an actual BFI packet
+        * will be emitted. */
+       if (data_ind->sapi == GsmL1_Sapi_FacchF)
+               l1if_tch_rx_facch(trx, chan_nr, l1p_msg);
+
        /* fill L1SAP header */
        sap_msg = l1sap_msgb_alloc(data_ind->msgUnitParam.u8Size);
        l1sap = msgb_l1sap_prim(sap_msg);
diff --git a/src/osmo-bts-sysmo/l1_if.h b/src/osmo-bts-sysmo/l1_if.h
index 8691eef..5b2da04 100644
--- a/src/osmo-bts-sysmo/l1_if.h
+++ b/src/osmo-bts-sysmo/l1_if.h
@@ -129,6 +129,8 @@
                    const uint8_t *rtp_pl, unsigned int rtp_pl_len, uint32_t fn,
                    bool use_cache, bool marker);
 int l1if_tch_rx(struct gsm_bts_trx *trx, uint8_t chan_nr, struct msgb 
*l1p_msg);
+int l1if_tch_rx_facch(struct gsm_bts_trx *trx, uint8_t chan_nr,
+                     struct msgb *l1p_msg);
 int l1if_tch_fill(struct gsm_lchan *lchan, uint8_t *l1_buffer);
 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn);

diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 6a5d2c3..cecb4dd 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -625,6 +625,29 @@
        return -EINVAL;
 }

+/*! \brief provide an RTP empty payload "tick" to upper layers upon FACCH */
+int l1if_tch_rx_facch(struct gsm_bts_trx *trx, uint8_t chan_nr,
+                     struct msgb *l1p_msg)
+{
+       GsmL1_Prim_t *l1p = msgb_l1prim(l1p_msg);
+       GsmL1_PhDataInd_t *data_ind = &l1p->u.phDataInd;
+       struct msgb *rmsg = NULL;
+       struct gsm_lchan *lchan = 
&trx->ts[L1SAP_CHAN2TS(chan_nr)].lchan[l1sap_chan2ss(chan_nr)];
+
+       if (is_recv_only(lchan->abis_ip.speech_mode))
+               return -EAGAIN;
+
+       LOGPFN(DL1P, LOGL_DEBUG, data_ind->u32Fn, "chan_nr %d Rx FACCH\n", 
chan_nr);
+       /* Push empty payload to upper layers */
+       rmsg = msgb_alloc_headroom(256, 128, "L1P-to-RTP");
+       return add_l1sap_header(trx, rmsg, lchan, chan_nr, data_ind->u32Fn,
+                               data_ind->measParam.fBer * 10000,
+                               data_ind->measParam.fLinkQuality * 10,
+                               0,      /* suppress RSSI like in osmo-bts-trx */
+                               data_ind->measParam.i16BurstTiming * 64,
+                               0);
+}
+
 struct msgb *gen_empty_tch_msg(struct gsm_lchan *lchan, uint32_t fn)
 {
        struct msgb *msg;

--
To view, visit https://gerrit.osmocom.org/c/osmo-bts/+/32100
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I39d15faade28fb7d670493a99a0e0bdb654e2a4a
Gerrit-Change-Number: 32100
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <[email protected]>
Gerrit-MessageType: newchange

Reply via email to