This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Max gerrit-no-reply at lists.osmocom.orgReview at https://gerrit.osmocom.org/959 AMR: add function to check speech frames Add convenience function osmo_amr_is_speech() to check if given AMR frame is speech frame: non-speech frames often require special processing. Change-Id: Ifaab02a2f581acc302b367d34fd2fc28a4d1e2e3 --- M include/osmocom/codec/codec.h M src/codec/gsm690.c 2 files changed, 22 insertions(+), 0 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/59/959/1 diff --git a/include/osmocom/codec/codec.h b/include/osmocom/codec/codec.h index f7a8ad9..305fad9 100644 --- a/include/osmocom/codec/codec.h +++ b/include/osmocom/codec/codec.h @@ -44,6 +44,7 @@ bool osmo_fr_check_sid(uint8_t *rtp_payload, size_t payload_len); bool osmo_hr_check_sid(uint8_t *rtp_payload, size_t payload_len); +bool osmo_amr_is_speech(enum osmo_amr_type ft); int osmo_amr_rtp_enc(uint8_t *payload, uint8_t cmr, enum osmo_amr_type ft, enum osmo_amr_quality bfi); int osmo_amr_rtp_dec(const uint8_t *payload, int payload_len, uint8_t *cmr, diff --git a/src/codec/gsm690.c b/src/codec/gsm690.c index 0f4bf8f..fc1ca3d 100644 --- a/src/codec/gsm690.c +++ b/src/codec/gsm690.c @@ -235,6 +235,27 @@ { 0, NULL }, }; +/*! \brief Check if given AMR Frame Type is a speech frame + * \param[in] ft AMR Frame Type + * \returns true if AMR with given Frame Type contains voice, false otherwise + */ +bool osmo_amr_is_speech(enum osmo_amr_type ft) +{ + switch (ft) { + case AMR_4_75: + case AMR_5_15: + case AMR_5_90: + case AMR_6_70: + case AMR_7_40: + case AMR_7_95: + case AMR_10_2: + case AMR_12_2: + return true; + default: + return false; + } +} + /*! \brief Decode various AMR parameters from RTP payload (RFC 4867) acording to * 3GPP TS 26.101 * \param[in] rtppayload Payload from RTP packet -- To view, visit https://gerrit.osmocom.org/959 To unsubscribe, visit https://gerrit.osmocom.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ifaab02a2f581acc302b367d34fd2fc28a4d1e2e3 Gerrit-PatchSet: 1 Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Owner: Max <msuraev at sysmocom.de>