falconia has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bts/+/32098 )
Change subject: common: implement rtp always-output mode
......................................................................
common: implement rtp always-output mode
In some environments it is highly desirable for the RTP stream
coming from each GSM call UL on a BTS to be fully continuous,
without any gaps, with _some_ RTP packet emitted every 20 ms,
even if there is no speech or SID frame to be sent in that frame
time window. The present change adds an rtp always-output vty
option which, when enabled, causes the BTS to emit RTP packets
with a zero-length payload, instead of producing gaps in the RTP
stream, when it has nothing else to send.
Related: OS#5975
Change-Id: Ic0e2edf2ed90ba0ac6bee5e7d9629bf0255e256d
---
M include/osmo-bts/bts.h
M src/common/l1sap.c
M src/common/vty.c
3 files changed, 57 insertions(+), 2 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/98/32098/1
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h
index ed3da1d..14c78a3 100644
--- a/include/osmo-bts/bts.h
+++ b/include/osmo-bts/bts.h
@@ -314,6 +314,8 @@
int rtp_ip_dscp;
int rtp_priority;
+ bool rtp_nogaps_mode; /* emit RTP stream without any gaps */
+
struct {
uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */
} support;
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index 2a1196c..f8320b0 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1247,6 +1247,11 @@
static bool rtppayload_is_valid(struct gsm_lchan *lchan, struct msgb *resp_msg)
{
+ /* A zero-length payload is never valid, it is merely a BFI marker
+ * and a timing tick, which we are not interested in because we run
+ * on our own TDMA timing. */
+ if (!resp_msg->len)
+ return false;
/* Avoid sending bw-efficient AMR to lower layers, most bts models
* don't support it. */
if (lchan->tch_mode == GSM48_CMODE_SPEECH_AMR &&
@@ -1571,6 +1576,7 @@
static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap,
struct ph_tch_param *tch_ind)
{
+ struct gsm_bts *bts = trx->bts;
struct msgb *msg = l1sap->oph.msg;
struct gsm_time g_time;
struct gsm_lchan *lchan;
@@ -1600,8 +1606,10 @@
/* Low level layers always call us when TCH content is expected, even if
* the content is not available due to decoding issues. Content not
- * available is expected as empty payload. */
- if (msg->len) {
+ * available is expected as empty payload. We send out an RTP packet
+ * if the lower layers sent us a non-empty payload OR if
+ * rtp always-output mode is configured. */
+ if (msg->len || bts->rtp_nogaps_mode) {
/* hand msg to RTP code for transmission */
if (lchan->abis_ip.osmux.use) {
lchan_osmux_send_frame(lchan, msg->data, msg->len,
diff --git a/src/common/vty.c b/src/common/vty.c
index dd1b07f..aa49f6b 100644
--- a/src/common/vty.c
+++ b/src/common/vty.c
@@ -421,6 +421,8 @@
vty_out(vty, " rtp ip-dscp %i%s", bts->rtp_ip_dscp, VTY_NEWLINE);
if (bts->rtp_priority != -1)
vty_out(vty, " rtp socket-priority %i%s", bts->rtp_priority,
VTY_NEWLINE);
+ if (bts->rtp_nogaps_mode)
+ vty_out(vty, " rtp always-output%s", VTY_NEWLINE);
vty_out(vty, " paging queue-size %u%s",
paging_get_queue_max(bts->paging_state),
VTY_NEWLINE);
vty_out(vty, " paging lifetime %u%s",
paging_get_lifetime(bts->paging_state),
@@ -780,6 +782,28 @@
return CMD_SUCCESS;
}
+DEFUN(cfg_bts_rtp_always_output,
+ cfg_bts_rtp_always_output_cmd,
+ "rtp always-output",
+ RTP_STR "Always emit an RTP packet every 20 ms\n")
+{
+ struct gsm_bts *bts = vty->index;
+
+ bts->rtp_nogaps_mode = true;
+ return CMD_SUCCESS;
+}
+
+DEFUN(cfg_bts_no_rtp_always_output,
+ cfg_bts_no_rtp_always_output_cmd,
+ "no rtp always-output",
+ NO_STR RTP_STR "Always emit an RTP packet every 20 ms\n")
+{
+ struct gsm_bts *bts = vty->index;
+
+ bts->rtp_nogaps_mode = false;
+ return CMD_SUCCESS;
+}
+
#define PAG_STR "Paging related parameters\n"
DEFUN_ATTR(cfg_bts_paging_queue_size,
@@ -2667,6 +2691,8 @@
install_element(BTS_NODE, &cfg_bts_rtp_port_range_cmd);
install_element(BTS_NODE, &cfg_bts_rtp_ip_dscp_cmd);
install_element(BTS_NODE, &cfg_bts_rtp_priority_cmd);
+ install_element(BTS_NODE, &cfg_bts_rtp_always_output_cmd);
+ install_element(BTS_NODE, &cfg_bts_no_rtp_always_output_cmd);
install_element(BTS_NODE, &cfg_bts_band_cmd);
install_element(BTS_NODE, &cfg_description_cmd);
install_element(BTS_NODE, &cfg_no_description_cmd);
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/32098
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: Ic0e2edf2ed90ba0ac6bee5e7d9629bf0255e256d
Gerrit-Change-Number: 32098
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-MessageType: newchange