laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-bts/+/32970 )
Change subject: all models, HR1 codec: select RTP output format via vty option ......................................................................
all models, HR1 codec: select RTP output format via vty option
The new vty option "rtp hr-format (rfc5993|ts101318)" selects the RTP output format to be used for HR1 codec, consistently across all models. The default is set to match legacy behavior: ts101318 on osmo-bts-{lc15,oc2g,sysmo} and rfc5993 on osmo-bts-trx. On models where no legacy behavior is applicable, the default is set to rfc5993 as a forward-looking measure - see OS#6036.
Closes: OS#5688 Change-Id: I168191874a062429a57904511a1e89e3f588732e --- M include/osmo-bts/bts.h M src/common/bts.c M src/common/l1sap.c M src/common/vty.c M src/osmo-bts-lc15/main.c M src/osmo-bts-oc2g/main.c M src/osmo-bts-sysmo/main.c M src/osmo-bts-trx/main.c M tests/osmo-bts.vty 9 files changed, 82 insertions(+), 1 deletion(-)
Approvals: laforge: Looks good to me, approved pespin: Looks good to me, but someone else must approve Jenkins Builder: Verified
diff --git a/include/osmo-bts/bts.h b/include/osmo-bts/bts.h index 0fff2a5..7ca3224 100644 --- a/include/osmo-bts/bts.h +++ b/include/osmo-bts/bts.h @@ -300,6 +300,7 @@ int rtp_priority;
bool rtp_nogaps_mode; /* emit RTP stream without any gaps */ + bool emit_hr_rfc5993;
struct { uint8_t ciphers; /* flags A5/1==0x1, A5/2==0x2, A5/3==0x4 */ diff --git a/src/common/bts.c b/src/common/bts.c index 242c5dd..802cb00 100644 --- a/src/common/bts.c +++ b/src/common/bts.c @@ -330,6 +330,7 @@ bts->rtp_port_range_next = bts->rtp_port_range_start; bts->rtp_ip_dscp = -1; bts->rtp_priority = -1; + bts->emit_hr_rfc5993 = true;
/* Default (fall-back) MS/BS Power control parameters */ power_ctrl_params_def_reset(&bts->bs_dpc_params, true); diff --git a/src/common/l1sap.c b/src/common/l1sap.c index f1692c6..cc775d3 100644 --- a/src/common/l1sap.c +++ b/src/common/l1sap.c @@ -1561,6 +1561,24 @@ lchan->rtp_tx_marker = false; }
+/* a helper function for emitting HR1 UL in RFC 5993 format */ +static void send_rtp_rfc5993(struct gsm_lchan *lchan, uint32_t fn, + struct msgb *msg) +{ + uint8_t toc; + + OSMO_ASSERT(msg->len == GSM_HR_BYTES); + /* FIXME: implement proper SID classification per GSM 06.41 section + * 6.1.1; see OS#6036. Until then, detect error-free SID frames + * using our existing osmo_hr_check_sid() function. */ + if (osmo_hr_check_sid(msg->data, msg->len)) + toc = 0x20; + else + toc = 0x00; + msgb_push_u8(msg, toc); + send_ul_rtp_packet(lchan, fn, msg->data, msg->len); +} + /* TCH received from bts model */ static int l1sap_tch_ind(struct gsm_bts_trx *trx, struct osmo_phsap_prim *l1sap, struct ph_tch_param *tch_ind) @@ -1600,7 +1618,11 @@ * good enough. */ if (msg->len && tch_ind->lqual_cb >= bts->min_qual_norm) { /* hand msg to RTP code for transmission */ - send_ul_rtp_packet(lchan, fn, msg->data, msg->len); + if (bts->emit_hr_rfc5993 && lchan->type == GSM_LCHAN_TCH_H && + lchan->tch_mode == GSM48_CMODE_SPEECH_V1) + send_rtp_rfc5993(lchan, fn, msg); + else + send_ul_rtp_packet(lchan, fn, msg->data, msg->len); /* if loopback is enabled, also queue received RTP data */ if (lchan->loopback) { /* add new frame to queue, make sure the queue doesn't get too long */ diff --git a/src/common/vty.c b/src/common/vty.c index b17800c..9f3c675 100644 --- a/src/common/vty.c +++ b/src/common/vty.c @@ -418,6 +418,8 @@ vty_out(vty, " rtp socket-priority %d%s", bts->rtp_priority, VTY_NEWLINE); if (bts->rtp_nogaps_mode) vty_out(vty, " rtp continuous-streaming%s", VTY_NEWLINE); + vty_out(vty, " rtp hr-format %s%s", + bts->emit_hr_rfc5993 ? "rfc5993" : "ts101318", 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), @@ -797,6 +799,18 @@ return CMD_SUCCESS; }
+DEFUN_ATTR(cfg_bts_rtp_hr_format, + cfg_bts_rtp_hr_format_cmd, + "rtp hr-format (rfc5993|ts101318)", + RTP_STR "HRv1 codec output format\n" "RFC 5993\n" "TS 101 318\n", + CMD_ATTR_IMMEDIATE) +{ + struct gsm_bts *bts = vty->index; + + bts->emit_hr_rfc5993 = !strcmp(argv[0], "rfc5993"); + return CMD_SUCCESS; +} + #define PAG_STR "Paging related parameters\n"
DEFUN_ATTR(cfg_bts_paging_queue_size, @@ -2686,6 +2700,7 @@ install_element(BTS_NODE, &cfg_bts_rtp_priority_cmd); install_element(BTS_NODE, &cfg_bts_rtp_cont_stream_cmd); install_element(BTS_NODE, &cfg_bts_no_rtp_cont_stream_cmd); + install_element(BTS_NODE, &cfg_bts_rtp_hr_format_cmd); install_element(BTS_NODE, &cfg_bts_band_cmd); install_element(BTS_NODE, &cfg_description_cmd); install_element(BTS_NODE, &cfg_no_description_cmd); diff --git a/src/osmo-bts-lc15/main.c b/src/osmo-bts-lc15/main.c index cb2a9ac..6c0e73d 100644 --- a/src/osmo-bts-lc15/main.c +++ b/src/osmo-bts-lc15/main.c @@ -114,6 +114,12 @@ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved + * vty config needs to match what was implemented previously, + * for the sake of existing deployments, i.e., to avoid + * a surprise functional change upon software update. */ + bts->emit_hr_rfc5993 = false; + return 0; }
diff --git a/src/osmo-bts-oc2g/main.c b/src/osmo-bts-oc2g/main.c index 4484d58..9918795 100644 --- a/src/osmo-bts-oc2g/main.c +++ b/src/osmo-bts-oc2g/main.c @@ -115,6 +115,12 @@ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved + * vty config needs to match what was implemented previously, + * for the sake of existing deployments, i.e., to avoid + * a surprise functional change upon software update. */ + bts->emit_hr_rfc5993 = false; + return 0; }
diff --git a/src/osmo-bts-sysmo/main.c b/src/osmo-bts-sysmo/main.c index 95492eb..8dba905 100644 --- a/src/osmo-bts-sysmo/main.c +++ b/src/osmo-bts-sysmo/main.c @@ -82,6 +82,12 @@ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MS_PWR_CTRL_DSP); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_NM_RCHANNEL_DEPENDS_RCARRIER);
+ /* The default HR codec output format in the absence of saved + * vty config needs to match what was implemented previously, + * for the sake of existing deployments, i.e., to avoid + * a surprise functional change upon software update. */ + bts->emit_hr_rfc5993 = false; + return 0; }
diff --git a/src/osmo-bts-trx/main.c b/src/osmo-bts-trx/main.c index 4bd7f0f..f3b8513 100644 --- a/src/osmo-bts-trx/main.c +++ b/src/osmo-bts-trx/main.c @@ -158,6 +158,12 @@ bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_MEAS_PAYLOAD_COMB); bts_internal_flag_set(bts, BTS_INTERNAL_FLAG_INTERF_MEAS);
+ /* The default HR codec output format in the absence of saved + * vty config needs to match what was implemented previously, + * for the sake of existing deployments, i.e., to avoid + * a surprise functional change upon software update. */ + bts->emit_hr_rfc5993 = true; + return 0; }
diff --git a/tests/osmo-bts.vty b/tests/osmo-bts.vty index 7f2e78c..356f2aa 100644 --- a/tests/osmo-bts.vty +++ b/tests/osmo-bts.vty @@ -235,6 +235,7 @@ rtp socket-priority <0-255> rtp continuous-streaming no rtp continuous-streaming + rtp hr-format (rfc5993|ts101318) band (450|GSM450|480|GSM480|750|GSM750|810|GSM810|850|GSM850|900|GSM900|1800|DCS1800|1900|PCS1900) description .TEXT no description