fixeria has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/35132?usp=email )
(
7 is the latest approved patch-set. No files were changed between the latest approved patch-set and the submitted one. )Change subject: Transmit invalid AMR speech blocks instead of dummy FACCH ......................................................................
Transmit invalid AMR speech blocks instead of dummy FACCH
Every BTS needs to have some graceful handling for the scenario where it is time to send out a speech frame on TCH DL, but there is no frame to be sent. One possible solution is to transmit dummy FACCH, but this option is unattractive for TCH/AHS where FACCH displaces two speech frames rather than one. A more elegant solution is to emit a speech frame that is bad, causing the MS receiver to declare a BFI condition to trigger substitution and muting procedure. A bad frame is generated by gsm0503_tch_{afs,ahs}_encode() by setting the payload length to 0.
Depends: libosmocore.git I82ce2adf995a4b42d1f378c5819f88d773b9104a Related: OS#6049 Change-Id: I056f379715c91ad968f198e112d363a9009dc1c3 --- M src/osmo-bts-trx/sched_lchan_tchf.c M src/osmo-bts-trx/sched_lchan_tchh.c 2 files changed, 57 insertions(+), 8 deletions(-)
Approvals: Jenkins Builder: Verified falconia: Looks good to me, but someone else must approve pespin: Looks good to me, approved
diff --git a/src/osmo-bts-trx/sched_lchan_tchf.c b/src/osmo-bts-trx/sched_lchan_tchf.c index 0138a2a..b621b23 100644 --- a/src/osmo-bts-trx/sched_lchan_tchf.c +++ b/src/osmo-bts-trx/sched_lchan_tchf.c @@ -538,15 +538,14 @@ /* - If the channel mode is TCH/FS or TCH/EFS, transmit a dummy * speech block with inverted CRC3, designed to induce a BFI * condition in the MS receiver. + * - If the channel mode is TCH/AFS, transmit a dummy speech + * block with inverted CRC6, designed to induce a BFI + * condition in the MS receiver. * - If the channel mode is one of the CSD modes, transmit an * idle frame as described in 3GPP TS 44.021, sections 8.1.6 * and 10.2.3 (all data, status and E-bits set to binary '1'). * - In all other channel modes, transmit dummy FACCH * like we always did before. - * - * FIXME: someone who knows AMR needs to look at this problem - * and decide what is the correct BTS Tx behavior for frame - * gaps in TCH/AFS. See OS#6049. */ switch (tch_mode) { case GSM48_CMODE_DATA_12k0: @@ -562,6 +561,21 @@ /* fall-through */ case GSM48_CMODE_SIGN: default: + if (tch_mode == GSM48_CMODE_SPEECH_AMR) { + /* the first FN 4,13,21 defines that CMI is included in frame, + * the first FN 0,8,17 defines that CMR is included in frame. + */ + rc = gsm0503_tch_afs_encode(BUFPOS(bursts_p, 0), + NULL, 0, + !sched_tchf_dl_amr_cmi_map[br->fn % 26], + chan_state->codec, + chan_state->codecs, + chan_state->dl_ft, + chan_state->dl_cmr); + if (rc == 0) + goto send_burst; + } + /* TODO: use randomized padding */ msg_facch = tch_dummy_msgb(GSM_MACBLOCK_LEN, GSM_MACBLOCK_PADDING); /* dummy LAPDm func=UI frame */ diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c index e0d7aca..05e1af4 100644 --- a/src/osmo-bts-trx/sched_lchan_tchh.c +++ b/src/osmo-bts-trx/sched_lchan_tchh.c @@ -453,15 +453,14 @@ /* - If the channel mode is TCH/HS, transmit a dummy speech block * with inverted CRC3, designed to induce a BFI condition in * the MS receiver. + * - If the channel mode is TCH/AHS, transmit a dummy speech + * block with inverted CRC6, designed to induce a BFI + * condition in the MS receiver. * - If the channel mode is one of the CSD modes, transmit an * idle frame as described in 3GPP TS 44.021, sections 8.1.6 * and 10.2.3 (all data, status and E-bits set to binary '1'). * - In all other channel modes, transmit dummy FACCH * like we always did before. - * - * FIXME: someone who knows AMR needs to look at this problem - * and decide what is the correct BTS Tx behavior for frame - * gaps in TCH/AHS. See OS#6049. */ switch (tch_mode) { case GSM48_CMODE_DATA_6k0: @@ -474,6 +473,21 @@ /* fall-through */ case GSM48_CMODE_SIGN: default: + if (tch_mode == GSM48_CMODE_SPEECH_AMR) { + /* the first FN 4,13,21 or 5,14,22 defines that CMI is included + * in frame, the first FN 0,8,17 or 1,9,18 defines that CMR is + * included in frame. */ + rc = gsm0503_tch_ahs_encode(BUFPOS(bursts_p, 0), + NULL, 0, + !sched_tchh_dl_amr_cmi_map[br->fn % 26], + chan_state->codec, + chan_state->codecs, + chan_state->dl_ft, + chan_state->dl_cmr); + if (rc == 0) + goto send_burst; + } + /* FACCH/H can only be scheduled at specific TDMA offset */ if (!sched_tchh_dl_facch_map[br->fn % 26]) { /* FACCH/H is not allowed, send half-filled bursts with even numbered