diff options
author | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-12 22:22:24 +0300 |
---|---|---|
committer | Vadim Yanitskiy <vyanitskiy@sysmocom.de> | 2022-04-13 18:04:20 +0300 |
commit | 56585bb3516855cf64325fb05b299ca2fcc6d540 (patch) | |
tree | ed75159208b0b87f5824f22cb8220322c1bfe97a /src | |
parent | 4765a5d1951cc8cb6bbd4a2cd9cd51189f3f68fa (diff) |
amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
Diffstat (limited to 'src')
-rw-r--r-- | src/common/amr.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/common/amr.c b/src/common/amr.c index 53ce24d6..acf1c370 100644 --- a/src/common/amr.c +++ b/src/common/amr.c @@ -200,19 +200,22 @@ int amr_parse_mr_conf(struct amr_multirate_conf *amr_mrc, } } + /* skip the first two octets of the IE */ + mr_conf += 2; + if (num_codecs >= 2) { - amr_mrc->bts_mode[0].threshold = mr_conf[1] & 0x3F; - amr_mrc->bts_mode[0].hysteresis = mr_conf[2] >> 4; + amr_mrc->bts_mode[0].threshold = mr_conf[0] & 0x3F; + amr_mrc->bts_mode[0].hysteresis = mr_conf[1] >> 4; } if (num_codecs >= 3) { amr_mrc->bts_mode[1].threshold = - ((mr_conf[2] & 0xF) << 2) | (mr_conf[3] >> 6); - amr_mrc->bts_mode[1].hysteresis = (mr_conf[3] >> 2) & 0xF; + ((mr_conf[1] & 0xF) << 2) | (mr_conf[2] >> 6); + amr_mrc->bts_mode[1].hysteresis = (mr_conf[2] >> 2) & 0xF; } if (num_codecs >= 4) { amr_mrc->bts_mode[2].threshold = - ((mr_conf[3] & 0x3) << 4) | (mr_conf[4] >> 4); - amr_mrc->bts_mode[2].hysteresis = mr_conf[4] & 0xF; + ((mr_conf[2] & 0x3) << 4) | (mr_conf[3] >> 4); + amr_mrc->bts_mode[2].hysteresis = mr_conf[3] & 0xF; } return num_codecs; |