diff options
author | Mychaela N. Falconia <falcon@freecalypso.org> | 2023-05-25 19:05:58 +0000 |
---|---|---|
committer | falconia <falcon@freecalypso.org> | 2023-05-26 16:05:23 +0000 |
commit | 1160cabefb2326aaf7f17573ef36859c9bce0d38 (patch) | |
tree | 68faf0640c12c74c98f8f91a33aff2544a49227d | |
parent | 208127986e92cdf18b108ad61e0e9c6cee892096 (diff) |
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
-rw-r--r-- | TODO-RELEASE | 2 | ||||
-rw-r--r-- | src/common/rtp_input_preen.c | 18 |
2 files changed, 19 insertions, 1 deletions
diff --git a/TODO-RELEASE b/TODO-RELEASE index 88ad00d1..676f1484 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 90ff6da8..e5cef6ff 100644 --- a/src/common/rtp_input_preen.c +++ b/src/common/rtp_input_preen.c @@ -81,6 +81,22 @@ input_preen_efr(const uint8_t *rtp_pl, unsigned rtp_pl_len) 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 @@ rtp_payload_input_preen(struct gsm_lchan *lchan, const uint8_t *rtp_pl, 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: |