From eb8059b615abe5a3315adf037b96c344286aba24 Mon Sep 17 00:00:00 2001 From: Vadim Yanitskiy Date: Thu, 10 Mar 2022 14:31:33 +0300 Subject: [PATCH] osmo-bts-trx: rx_tchh_fn(): fix HR SID detection (wrong offset) According to RFC5993, which is referenced by 3GPP TS 48.103, the complete RTP HR payload consists of a Table-of-Contents (ToC) byte followed by the 14 bytes of the HR codec frame. See section 5.2. gsm0503_tch_hr_decode() outputs frames in the RTP format with length of 15 bytes (120 bits): 1 (ToC) + 14 (HR frame): +-------------+------------------------- | ToC section | HR codec frame ... +-------------+------------------------- osmo_hr_check_sid() expects a HR codec frame of 14 bytes (112 bits) as the input, so we should skip the ToC section when calling it. Change-Id: Ie5fa776dcb2b2203a97aed56ecbf2450af7d87c1 Related: SYS#5853 --- src/osmo-bts-trx/sched_lchan_tchh.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/osmo-bts-trx/sched_lchan_tchh.c b/src/osmo-bts-trx/sched_lchan_tchh.c index b6d83d031..d2ee4f058 100644 --- a/src/osmo-bts-trx/sched_lchan_tchh.c +++ b/src/osmo-bts-trx/sched_lchan_tchh.c @@ -147,8 +147,10 @@ int rx_tchh_fn(struct l1sched_ts *l1ts, const struct trx_ul_burst_ind *bi) */ rc = gsm0503_tch_hr_decode(tch_data, *bursts_p, fn_is_odd, &n_errors, &n_bits_total); - if (rc == (GSM_HR_BYTES + 1)) /* only for valid *speech* frames */ - lchan_set_marker(osmo_hr_check_sid(tch_data, rc), lchan); /* DTXu */ + if (rc == (GSM_HR_BYTES + 1)) { /* only for valid *speech* frames */ + /* gsm0503_tch_hr_decode() prepends a ToC octet (see RFC5993), skip it */ + lchan_set_marker(osmo_hr_check_sid(&tch_data[1], GSM_HR_BYTES), lchan); /* DTXu */ + } break; case GSM48_CMODE_SPEECH_AMR: /* AMR */ /* the first FN 0,8,17 or 1,9,18 defines that CMI is included