aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/msg_utils.c
diff options
context:
space:
mode:
authorMax <msuraev@sysmocom.de>2016-10-26 17:28:42 +0200
committerHarald Welte <laforge@gnumonks.org>2016-10-28 13:42:29 +0000
commitbce25a60f4bbd798b98727e66b25bf343031f7bc (patch)
tree5e71659c7f73d6db41f4897098fd6860c0957422 /src/common/msg_utils.c
parentefb4a4baeb8ecd13ff41f25d61fd91a1162e6fa9 (diff)
DTX DL: split ONSET state handling
Handle ONSET cause by Voice and FACCH separately. In case of Voice we have RTP payload which we have to cache and send later on in next response to L1 RTS. FACCH have higher priority so it preempts both voice and silence alike - hence we can send ONSET immediately but still have to track previous state in order to get back to it gracefully. This affects lc15 and sysmo hw as there's no FSM-based DTX implementation for other models yet. Note: this requires patch for OpenBSC which adds FACCH buffer to tch.dtx struct. Change-Id: Idba14dcd0cb12cd7aee86391fcc152c49fcd7052 Related: OS#1802
Diffstat (limited to 'src/common/msg_utils.c')
-rw-r--r--src/common/msg_utils.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c
index 9c6f20f1..4b213665 100644
--- a/src/common/msg_utils.c
+++ b/src/common/msg_utils.c
@@ -220,12 +220,23 @@ int dtx_dl_amr_fsm_step(struct gsm_lchan *lchan, const uint8_t *rtp_pl,
* \param[in] fn Frame Number for which we check scheduling
* \returns true if transmission can be omitted, false otherwise
*/
-static inline bool dtx_amr_sid_optional(const struct gsm_lchan *lchan,
- uint32_t fn)
+static inline bool dtx_amr_sid_optional(struct gsm_lchan *lchan, uint32_t fn)
{
/* Compute approx. time delta x26 based on Fn duration */
uint32_t dx26 = 120 * (fn - lchan->tch.dtx.fn);
+ /* We're resuming after FACCH interruption */
+ if (lchan->tch.dtx.dl_amr_fsm->state == ST_FACCH) {
+ /* force STI bit to 0 so cache is treated as SID FIRST */
+ lchan->tch.dtx.cache[6 + 2] &= ~16;
+ lchan->tch.dtx.is_update = false;
+ osmo_fsm_inst_dispatch(lchan->tch.dtx.dl_amr_fsm, E_SID_F,
+ (void *)lchan);
+ /* this FN was already used for ONSET message so we just prepare
+ things for next one */
+ return true;
+ }
+
/* according to 3GPP TS 26.093 A.5.1.1:
(*26) to avoid float math, add 1 FN tolerance (-120) */
if (lchan->tch.dtx.is_update) { /* SID UPDATE: every 8th RTP frame */
@@ -293,7 +304,11 @@ uint8_t repeat_last_sid(struct gsm_lchan *lchan, uint8_t *dst, uint32_t fn)
if (lchan->tch.dtx.len) {
memcpy(dst, lchan->tch.dtx.cache, lchan->tch.dtx.len);
lchan->tch.dtx.fn = fn;
- lchan->tch.dtx.is_update = true; /* SID UPDATE sent */
+ /* enforce SID UPDATE for next repetition - it might have
+ been altered by FACCH handling */
+ lchan->tch.dtx.cache[6 + 2] |= 16;
+ if (lchan->tch.dtx.dl_amr_fsm->state == ST_SID_U)
+ lchan->tch.dtx.is_update = true;
return lchan->tch.dtx.len + 1;
}