falconia has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bts/+/32968 )
Change subject: all models, HR1 codec: accept both TS101318 and RFC5993 formats
......................................................................
all models, HR1 codec: accept both TS101318 and RFC5993 formats
There exist two different RTP encoding formats for HR1 codec: one
"simple" format defined in ETSI TS 101 318, and an extended format
(adding a ToC octet) defined in IETF RFC 5993. Following the
liberal-accept clause of Postel's law, we would like to accept
both formats. Implement this feature by first converting all HR1
RTP inputs to the more basic TS 101 318 format at the point of
input preening, and then consistently using this basic format
internally.
Related: OS#5688
Depends: I13eaad366f9f68615b9e9e4a5f87396a0e9dea0f (libosmocore)
Change-Id: I702e26c3ad5b9d8347e73c6cd23efa38a3a3407e
---
M TODO-RELEASE
M src/common/l1sap.c
2 files changed, 46 insertions(+), 1 deletion(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/68/32968/1
diff --git a/TODO-RELEASE b/TODO-RELEASE
index 88ad00d..676f148 100644
--- a/TODO-RELEASE
+++ b/TODO-RELEASE
@@ -9,3 +9,5 @@
#library what description / commit summary line
libosmocodec >1.8.0 osmo_efr_check_sid() new function
libosmogsm >1.8.0 <osmocom/gsm/protocol/gsm_44_060.h> added
+libosmocoding >1.8.0 gsm0503_tch_hr_encode() extended to accept
+ TS 101 318 format
diff --git a/src/common/l1sap.c b/src/common/l1sap.c
index f24bc2f..75bc795 100644
--- a/src/common/l1sap.c
+++ b/src/common/l1sap.c
@@ -1261,6 +1261,29 @@
return osmo_efr_sid_preen(msg->data);
}
+static bool rtppayload_validate_hr(struct msgb *msg)
+{
+ switch (msg->len) {
+ case GSM_HR_BYTES:
+ /* RTP input matches our internal format - we are good */
+ return true;
+ case GSM_HR_BYTES_RTP_RFC5993:
+ /* Strip ToC octet, leaving only "pure" TS 101 318 payload.
+ * Unfortunately the obvious way of msgb_pull(msg, 1);
+ * does not work: the code in l1sap_tch_rts_ind() will
+ * add a struct osmo_phsap_prim header with msgb_push(),
+ * and if we were to remove the ToC octet with msgb_pull(),
+ * that l1sap header will become misaligned, causing severe
+ * performance problems at least on sysmoBTS.
+ * Thus we have to do it in a convoluted way instead. */
+ memmove(msg->data, msg->data + 1, GSM_HR_BYTES);
+ msgb_get(msg, 1);
+ return true;
+ default:
+ return false;
+ }
+}
+
static bool rtppayload_is_valid(struct gsm_lchan *lchan, struct msgb *resp_msg)
{
/* If rtp continuous-streaming is enabled, we shall emit RTP packets
@@ -1280,7 +1303,7 @@
if (lchan->type == GSM_LCHAN_TCH_F)
return rtppayload_validate_fr(resp_msg);
else
- return true; /* FIXME: implement preening for HR1 */
+ return rtppayload_validate_hr(resp_msg);
case GSM48_CMODE_SPEECH_EFR:
return rtppayload_validate_efr(resp_msg);
case GSM48_CMODE_SPEECH_AMR:
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/32968
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I702e26c3ad5b9d8347e73c6cd23efa38a3a3407e
Gerrit-Change-Number: 32968
Gerrit-PatchSet: 1
Gerrit-Owner: falconia <falcon(a)freecalypso.org>
Gerrit-MessageType: newchange