aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPhilipp Maier <pmaier@sysmocom.de>2019-03-20 15:41:47 +0100
committerPhilipp Maier <pmaier@sysmocom.de>2019-03-20 15:45:05 +0100
commite380b38e287753a035b005a75b09ad9bcbae5977 (patch)
tree496300b4c734731c6c3fee80577b72e6d6a1645d
parentb3e34435b3bde227805c8dcac39c28e57144e500 (diff)
amr: use sizeof(struct amr_hdr) when working with amr header lengthHEADmaster
The header of an AMR header payload is 2 bytes long. At the moment we use just a constant of 2 when we refer to the header length, but we have a struct amr_hdr defined. Lets use sizeof(struct amr_hdr) to make it more clear that we are refering to the header length. Change-Id: Ic7ca04b99a97d7d3b91717b0c3e6c55ef3001a3e
-rw-r--r--src/amr.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/amr.c b/src/amr.c
index 9c63f60..5609c46 100644
--- a/src/amr.c
+++ b/src/amr.c
@@ -82,7 +82,7 @@ bool osmo_amr_is_oa(uint8_t *payload, unsigned int payload_len)
unsigned int frame_len;
/* Broken payload? */
- if (!payload || payload_len < 2)
+ if (!payload || payload_len < sizeof(struct amr_hdr))
return false;
/* In octet aligned mode, padding bits are specified to be
@@ -106,7 +106,7 @@ bool osmo_amr_is_oa(uint8_t *payload, unsigned int payload_len)
if(!osmo_amr_ft_valid(oa_hdr->ft))
return false;
frame_len = osmo_amr_bytes(oa_hdr->ft);
- if (frame_len != payload_len - 2)
+ if (frame_len != payload_len - sizeof(struct amr_hdr))
return false;
return true;
@@ -119,7 +119,7 @@ bool osmo_amr_is_oa(uint8_t *payload, unsigned int payload_len)
int osmo_amr_oa_to_bwe(uint8_t *payload, unsigned int payload_len)
{
struct amr_hdr *oa_hdr = (struct amr_hdr *)payload;
- unsigned int frame_len = payload_len - 2;
+ unsigned int frame_len = payload_len - sizeof(struct amr_hdr);
unsigned int i;
/* This implementation is not capable to handle multi-frame