diff options
author | Pablo Neira Ayuso <pablo@gnumonks.org> | 2013-02-12 19:22:45 +0100 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@gnumonks.org> | 2013-02-12 19:29:42 +0100 |
commit | 92601d0a20990209c085723d94bf7d636fa9186d (patch) | |
tree | 22038afa1f88cd1858748fd3d2f8e29b52cd0679 | |
parent | c92810eccd491b9dfc7b1c2bb4dbc599ff04e9fe (diff) |
osmux: use ft instead of the cmr
The cmr is the requested codec for the other peer, the ft actually
contains the current codec mode. cmr may contain 15 which means
"don't care".
-rw-r--r-- | include/osmocom/netif/amr.h | 20 | ||||
-rw-r--r-- | src/amr.c | 22 | ||||
-rw-r--r-- | src/osmux.c | 8 |
3 files changed, 25 insertions, 25 deletions
diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h index 715d045..5e4ccd4 100644 --- a/include/osmocom/netif/amr.h +++ b/include/osmocom/netif/amr.h @@ -22,7 +22,7 @@ * According to: 3GPP TS 26.201 "AMR Wideband speech codec; Frame Structure", * version 5.0.0 (2001-03), 3rd Generation Partnership Project (3GPP): * - * Possible AMR-CMR values: + * Possible Frame type / CMR values: * * 0-8 for AMR-WB (from 6.60 kbit/s to 23.85 kbit/s) * 9 (SID) confort noise. @@ -67,15 +67,15 @@ static inline void *osmo_amr_get_payload(struct amr_hdr *amrh) return (uint8_t *)amrh + sizeof(struct amr_hdr); } -#define AMR_CMR_0 0 /* 4.75 */ -#define AMR_CMR_1 1 /* 5.15 */ -#define AMR_CMR_2 2 /* 5.90 */ -#define AMR_CMR_3 3 /* 6.70 */ -#define AMR_CMR_4 4 /* 7.40 */ -#define AMR_CMR_5 5 /* 7.95 */ -#define AMR_CMR_6 6 /* 10.2 */ -#define AMR_CMR_7 7 /* 12.2 */ -#define AMR_CMR_MAX 8 +#define AMR_FT_0 0 /* 4.75 */ +#define AMR_FT_1 1 /* 5.15 */ +#define AMR_FT_2 2 /* 5.90 */ +#define AMR_FT_3 3 /* 6.70 */ +#define AMR_FT_4 4 /* 7.40 */ +#define AMR_FT_5 5 /* 7.95 */ +#define AMR_FT_6 6 /* 10.2 */ +#define AMR_FT_7 7 /* 12.2 */ +#define AMR_FT_MAX 8 size_t osmo_amr_bytes(uint8_t amr_cmr); @@ -25,18 +25,18 @@ * 7 12.20 244 31 */ -static size_t amr_cmr_to_bytes[AMR_CMR_MAX] = { - [AMR_CMR_0] = 12, - [AMR_CMR_1] = 13, - [AMR_CMR_2] = 15, - [AMR_CMR_3] = 17, - [AMR_CMR_4] = 19, - [AMR_CMR_5] = 20, - [AMR_CMR_6] = 26, - [AMR_CMR_7] = 31, +static size_t amr_ft_to_bytes[AMR_FT_MAX] = { + [AMR_FT_0] = 12, + [AMR_FT_1] = 13, + [AMR_FT_2] = 15, + [AMR_FT_3] = 17, + [AMR_FT_4] = 19, + [AMR_FT_5] = 20, + [AMR_FT_6] = 26, + [AMR_FT_7] = 31, }; -size_t osmo_amr_bytes(uint8_t amr_cmr) +size_t osmo_amr_bytes(uint8_t amr_ft) { - return amr_cmr_to_bytes[amr_cmr]; + return amr_ft_to_bytes[amr_ft]; } diff --git a/src/osmux.c b/src/osmux.c index 2775bfa..c42ec2f 100644 --- a/src/osmux.c +++ b/src/osmux.c @@ -40,7 +40,7 @@ struct osmux_hdr *osmux_xfrm_output_pull(struct msgb *msg) osmuxh = (struct osmux_hdr *)msg->data; msgb_pull(msg, sizeof(struct osmux_hdr) + - (osmo_amr_bytes(osmuxh->amr_cmr) * (osmuxh->ctr+1))); + (osmo_amr_bytes(osmuxh->amr_ft) * (osmuxh->ctr+1))); } else if (msg->len > 0) { LOGP(DLMIB, LOGL_ERROR, "remaining %d bytes, broken osmuxhdr?\n", msg->len); @@ -61,7 +61,7 @@ osmux_rebuild_rtp(struct osmux_out_handle *h, out_msg = msgb_alloc(sizeof(struct rtp_hdr) + sizeof(struct amr_hdr) + - osmo_amr_bytes(osmuxh->amr_cmr), + osmo_amr_bytes(osmuxh->amr_ft), "OSMUX test"); if (out_msg == NULL) return NULL; @@ -116,8 +116,8 @@ int osmux_xfrm_output(struct osmux_hdr *osmuxh, struct osmux_out_handle *h, msg = osmux_rebuild_rtp(h, osmuxh, osmux_get_payload(osmuxh) + - i * osmo_amr_bytes(osmuxh->amr_cmr), - osmo_amr_bytes(osmuxh->amr_cmr)); + i * osmo_amr_bytes(osmuxh->amr_ft), + osmo_amr_bytes(osmuxh->amr_ft)); if (msg == NULL) continue; |