This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgMax has submitted this change and it was merged. Change subject: Fix DTX DL AMR SIDscheduling logic ...................................................................... Fix DTX DL AMR SIDscheduling logic Previously SID UPDATE was sometimes scheduled incorrectly. Fix this by: * avoid rounding error when computing scheduling time difference from FN * properly saving and updating cached SID type and FN Change-Id: I7acffae4792e7bddc2ae19a2f04ee921dc194c36 Related: OS#1801 --- M src/common/msg_utils.c 1 file changed, 14 insertions(+), 9 deletions(-) Approvals: Harald Welte: Looks good to me, approved Jenkins Builder: Verified diff --git a/src/common/msg_utils.c b/src/common/msg_utils.c index 393ae90..9c6f20f 100644 --- a/src/common/msg_utils.c +++ b/src/common/msg_utils.c @@ -116,8 +116,11 @@ ARRAY_SIZE(lchan->tch.dtx.cache) - amr); lchan->tch.dtx.len = copy_len + amr; - lchan->tch.dtx.fn = fn; - lchan->tch.dtx.is_update = update; + /* SID FIRST is special because it's both sent and cached: */ + if (update == 0) { + lchan->tch.dtx.fn = fn; + lchan->tch.dtx.is_update = false; /* Mark SID FIRST explicitly */ + } memcpy(lchan->tch.dtx.cache + amr, l1_payload, copy_len); } @@ -128,6 +131,7 @@ * \param[in] rtp_pl_len length of rtp_pl * \param[in] fn Frame Number for which we check scheduling * \param[in] l1_payload buffer where CMR and CMI prefix should be added + * \param[in] marker RTP Marker bit * \param[out] len Length of expected L1 payload * \param[out] ft_out Frame Type to be populated after decoding * \returns 0 in case of success; negative on error @@ -219,18 +223,18 @@ static inline bool dtx_amr_sid_optional(const struct gsm_lchan *lchan, uint32_t fn) { - /* Compute approx. time delta based on Fn duration */ - uint32_t delta = GSM_FN_TO_MS(fn - lchan->tch.dtx.fn); + /* Compute approx. time delta x26 based on Fn duration */ + uint32_t dx26 = 120 * (fn - lchan->tch.dtx.fn); - /* according to 3GPP TS 26.093 A.5.1.1: */ - if (lchan->tch.dtx.is_update) { - /* SID UPDATE should be repeated every 8th RTP frame */ - if (delta < GSM_RTP_FRAME_DURATION_MS * 8) + /* 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 */ + if (dx26 < GSM_RTP_FRAME_DURATION_MS * 8 * 26 - 120) return true; return false; } /* 3rd frame after SID FIRST should be SID UPDATE */ - if (delta < GSM_RTP_FRAME_DURATION_MS * 3) + if (dx26 < GSM_RTP_FRAME_DURATION_MS * 3 * 26 - 120) return true; return false; } @@ -289,6 +293,7 @@ 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 */ return lchan->tch.dtx.len + 1; } -- To view, visit https://gerrit.osmocom.org/1144 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: merged Gerrit-Change-Id: I7acffae4792e7bddc2ae19a2f04ee921dc194c36 Gerrit-PatchSet: 4 Gerrit-Project: osmo-bts Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de> Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: Max <msuraev at sysmocom.de>