falconia has submitted this change. ( 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/rtp_input_preen.c 2 files changed, 39 insertions(+), 1 deletion(-) Approvals: laforge: Looks good to me, but someone else must approve pespin: Looks good to me, approved Jenkins Builder: Verified 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/rtp_input_preen.c b/src/common/rtp_input_preen.c index 90ff6da..e5cef6f 100644 --- a/src/common/rtp_input_preen.c +++ b/src/common/rtp_input_preen.c @@ -81,6 +81,22 @@ return PL_DECISION_ACCEPT; } +static enum pl_input_decision +input_preen_hr(const uint8_t *rtp_pl, unsigned rtp_pl_len) +{ + switch (rtp_pl_len) { + case GSM_HR_BYTES: + /* RTP input matches our internal format - we are good */ + return PL_DECISION_ACCEPT; + case GSM_HR_BYTES_RTP_RFC5993: + /* Strip ToC octet, leaving only "pure" TS 101 318 payload. */ + return PL_DECISION_STRIP_HDR_OCTET; + default: + /* invalid payload */ + return PL_DECISION_DROP; + } +} + enum pl_input_decision rtp_payload_input_preen(struct gsm_lchan *lchan, const uint8_t *rtp_pl, unsigned rtp_pl_len) @@ -102,7 +118,7 @@ if (lchan->type == GSM_LCHAN_TCH_F) return input_preen_fr(rtp_pl, rtp_pl_len); else - return PL_DECISION_ACCEPT; /* FIXME: next patch in the series */ + return input_preen_hr(rtp_pl, rtp_pl_len); case GSM48_CMODE_SPEECH_EFR: return input_preen_efr(rtp_pl, rtp_pl_len); 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: 5 Gerrit-Owner: falconia <fal...@freecalypso.org> Gerrit-Reviewer: Jenkins Builder Gerrit-Reviewer: dexter <pma...@sysmocom.de> Gerrit-Reviewer: falconia <fal...@freecalypso.org> Gerrit-Reviewer: laforge <lafo...@osmocom.org> Gerrit-Reviewer: pespin <pes...@sysmocom.de> Gerrit-MessageType: merged