aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-02-27 12:17:02 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-03-01 09:12:20 +0100
commit0fe9b3664a8d0b74d5e1c67593b350d67de3f98f (patch)
treefcffd779321005375fcd1139e0a53f6445ad8d45 /include/osmocom
parent05db1909c8c299a58538b664d60c2ce2b0993cbe (diff)
AMR: add define constants for AMR payload length
AMR uses different payload sizes, those sizes are well defined in RFC 3267. Lets add define constants and replace the magic values with the define constants. Also correct the value for AMR_FT_SID in amr_ft_to_bytes from 6 to 5 (39bits / 8 = 4.875 bytes ==> 5 byte, see also RFC 3267, chapter 3.6) Change-Id: I65b5da920d58015b875d6dcf17aacdc04b58955e
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/netif/amr.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h
index 5b48bcb..1f048b1 100644
--- a/include/osmocom/netif/amr.h
+++ b/include/osmocom/netif/amr.h
@@ -83,6 +83,18 @@ static inline void *osmo_amr_get_payload(struct amr_hdr *amrh)
#define AMR_FT_SID 8 /* SID */
#define AMR_FT_MAX 9
+/* AMR voice frame length (in bytes, rounded),
+ * See also RFC 3267, chapter 3.6 */
+#define AMR_FT_0_LEN 12 /* 4.75 */
+#define AMR_FT_1_LEN 13 /* 5.15 */
+#define AMR_FT_2_LEN 15 /* 5.90 */
+#define AMR_FT_3_LEN 17 /* 6.70 */
+#define AMR_FT_4_LEN 19 /* 7.40 */
+#define AMR_FT_5_LEN 20 /* 7.95 */
+#define AMR_FT_6_LEN 26 /* 10.2 */
+#define AMR_FT_7_LEN 31 /* 12.2 */
+#define AMR_FT_SID_LEN 5 /* SID */
+
int osmo_amr_ft_valid(uint8_t amr_ft);
size_t osmo_amr_bytes(uint8_t amr_cmr);