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.org
Review at https://gerrit.osmocom.org/223
DTXu: mark beginning of speech burst in RTP
Set Marker bit in RTP header to mark the beginning of talkspurt.
Change-Id: I3dd70ad8ff94356e3c3cc5458255f6c23534783e
Related: OS#1562
---
M src/common/l1sap.c
M src/osmo-bts-litecell15/tch.c
M src/osmo-bts-sysmo/tch.c
3 files changed, 92 insertions(+), 14 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/23/223/1
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 77fd1a0..163e129 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -866,8 +866,8 @@
/* hand msg to RTP code for transmission */
if (lchan->abis_ip.rtp_socket)
- osmo_rtp_send_frame(lchan->abis_ip.rtp_socket,
- msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn));
+ osmo_rtp_send_frame_ext(lchan->abis_ip.rtp_socket,
+ msg->data, msg->len, fn_ms_adj(fn, lchan->tch.last_fn), lchan->rtp_tx_marker);
/* if loopback is enabled, also queue received RTP data */
if (lchan->loopback) {
@@ -885,6 +885,8 @@
msgb_enqueue(&lchan->dl_tch_queue, msg);
}
+
+ lchan->rtp_tx_marker = false;
lchan->tch.last_fn = fn;
return 0;
}
diff --git a/src/osmo-bts-litecell15/tch.c b/src/osmo-bts-litecell15/tch.c
index 15ad456..36656e0 100644
--- a/src/osmo-bts-litecell15/tch.c
+++ b/src/osmo-bts-litecell15/tch.c
@@ -101,7 +101,8 @@
#define GSM_HR_BYTES 14 /* TS 101318 Chapter 5.2: 112 bits, no sig */
#define GSM_EFR_BYTES 31 /* TS 101318 Chapter 5.3: 244 bits + 4bit sig */
-static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -113,6 +114,13 @@
/* new L1 can deliver bits like we need them */
cur = msgb_put(msg, GSM_FR_BYTES);
memcpy(cur, l1_payload, GSM_FR_BYTES);
+
+ if (osmo_fr_check_sid(l1_payload, payload_len))
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -131,7 +139,9 @@
return GSM_FR_BYTES;
}
-static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload,
+ uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -143,6 +153,17 @@
/* new L1 can deliver bits like we need them */
cur = msgb_put(msg, GSM_EFR_BYTES);
memcpy(cur, l1_payload, GSM_EFR_BYTES);
+ enum osmo_amr_type ft;
+ enum osmo_amr_quality bfi;
+ uint8_t cmr;
+ int8_t sti, cmi;
+ osmo_amr_rtp_dec(l1_payload, payload_len, &cmr, &cmi, &ft, &bfi, &sti);
+ if (ft == AMR_GSM_EFR_SID)
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -154,7 +175,8 @@
return payload_len;
}
-static struct msgb *l1_to_rtppayload_hr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_hr(uint8_t *l1_payload, uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -171,6 +193,13 @@
cur = msgb_put(msg, GSM_HR_BYTES);
memcpy(cur, l1_payload, GSM_HR_BYTES);
+
+ if (osmo_hr_check_sid(l1_payload, payload_len))
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -431,6 +460,15 @@
lchan->type != GSM_LCHAN_TCH_F)
goto err_payload_match;
break;
+ case GsmL1_TchPlType_Amr_Onset:
+ if (lchan->type != GSM_LCHAN_TCH_H &&
+ lchan->type != GSM_LCHAN_TCH_F)
+ goto err_payload_match;
+ /* according to 3GPP TS 26.093 ONSET frames precede the first
+ speech frame of a speech burst - set the marker for next RTP
+ frame and drop last SID */
+ lchan->rtp_tx_marker = true;
+ break;
default:
LOGP(DL1C, LOGL_NOTICE, "%s Rx Payload Type %s is unsupported\n",
gsm_lchan_name(lchan),
@@ -441,13 +479,13 @@
switch (payload_type) {
case GsmL1_TchPlType_Fr:
- rmsg = l1_to_rtppayload_fr(payload, payload_len);
+ rmsg = l1_to_rtppayload_fr(payload, payload_len, lchan);
break;
case GsmL1_TchPlType_Hr:
- rmsg = l1_to_rtppayload_hr(payload, payload_len);
+ rmsg = l1_to_rtppayload_hr(payload, payload_len, lchan);
break;
case GsmL1_TchPlType_Efr:
- rmsg = l1_to_rtppayload_efr(payload, payload_len);
+ rmsg = l1_to_rtppayload_efr(payload, payload_len, lchan);
break;
case GsmL1_TchPlType_Amr:
rmsg = l1_to_rtppayload_amr(payload, payload_len, lchan);
diff --git a/src/osmo-bts-sysmo/tch.c b/src/osmo-bts-sysmo/tch.c
index 63d90af..6f61096 100644
--- a/src/osmo-bts-sysmo/tch.c
+++ b/src/osmo-bts-sysmo/tch.c
@@ -91,7 +91,8 @@
}
-static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_fr(uint8_t *l1_payload, uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -115,6 +116,13 @@
cur[0] |= 0xD0;
#endif /* USE_L1_RTP_MODE */
+
+ if (osmo_fr_check_sid(l1_payload, payload_len))
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -142,7 +150,9 @@
}
#if defined(L1_HAS_EFR) && defined(USE_L1_RTP_MODE)
-static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_efr(uint8_t *l1_payload,
+ uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -166,6 +176,17 @@
cur[0] |= 0xC0;
#endif /* USE_L1_RTP_MODE */
+ enum osmo_amr_type ft;
+ enum osmo_amr_quality bfi;
+ uint8_t cmr;
+ int8_t sti, cmi;
+ osmo_amr_rtp_dec(l1_payload, payload_len, &cmr, &cmi, &ft, &bfi, &sti);
+ if (ft == AMR_GSM_EFR_SID)
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -184,7 +205,8 @@
#warning No EFR support in L1
#endif /* L1_HAS_EFR */
-static struct msgb *l1_to_rtppayload_hr(uint8_t *l1_payload, uint8_t payload_len)
+static struct msgb *l1_to_rtppayload_hr(uint8_t *l1_payload, uint8_t payload_len,
+ struct gsm_lchan *lchan)
{
struct msgb *msg;
uint8_t *cur;
@@ -206,6 +228,13 @@
/* reverse the bit-order of each payload byte */
osmo_revbytebits_buf(cur, GSM_HR_BYTES);
#endif /* USE_L1_RTP_MODE */
+
+ if (osmo_hr_check_sid(l1_payload, payload_len))
+ lchan->tch.ul_sid = true;
+ else if (lchan->tch.ul_sid) {
+ lchan->tch.ul_sid = false;
+ lchan->rtp_tx_marker = true;
+ }
return msg;
}
@@ -525,6 +554,15 @@
lchan->type != GSM_LCHAN_TCH_F)
goto err_payload_match;
break;
+ case GsmL1_TchPlType_Amr_Onset:
+ if (lchan->type != GSM_LCHAN_TCH_H &&
+ lchan->type != GSM_LCHAN_TCH_F)
+ goto err_payload_match;
+ /* according to 3GPP TS 26.093 ONSET frames precede the first
+ speech frame of a speech burst - set the marker for next RTP
+ frame and drop last SID */
+ lchan->rtp_tx_marker = true;
+ break;
default:
LOGP(DL1C, LOGL_NOTICE, "%s Rx Payload Type %s is unsupported\n",
gsm_lchan_name(lchan),
@@ -535,14 +573,14 @@
switch (payload_type) {
case GsmL1_TchPlType_Fr:
- rmsg = l1_to_rtppayload_fr(payload, payload_len);
+ rmsg = l1_to_rtppayload_fr(payload, payload_len, lchan);
break;
case GsmL1_TchPlType_Hr:
- rmsg = l1_to_rtppayload_hr(payload, payload_len);
+ rmsg = l1_to_rtppayload_hr(payload, payload_len, lchan);
break;
#if defined(L1_HAS_EFR) && defined(USE_L1_RTP_MODE)
case GsmL1_TchPlType_Efr:
- rmsg = l1_to_rtppayload_efr(payload, payload_len);
+ rmsg = l1_to_rtppayload_efr(payload, payload_len, lchan);
break;
#endif
case GsmL1_TchPlType_Amr:
--
To view, visit https://gerrit.osmocom.org/223
To unsubscribe, visit https://gerrit.osmocom.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I3dd70ad8ff94356e3c3cc5458255f6c23534783e
Gerrit-PatchSet: 1
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Owner: Max <msuraev at sysmocom.de>