fixeria has uploaded this change for review. (
https://gerrit.osmocom.org/c/osmo-bts/+/27762 )
Change subject: amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
......................................................................
amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()
Change-Id: I8febb60b0ad91903c7869871f41d1c123dbe5ce3
Related: SYS#5917, OS#4984
---
M src/common/amr.c
M tests/amr/amr_test.ok
2 files changed, 12 insertions(+), 9 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bts refs/changes/62/27762/1
diff --git a/src/common/amr.c b/src/common/amr.c
index 53ce24d..acf1c37 100644
--- a/src/common/amr.c
+++ b/src/common/amr.c
@@ -200,19 +200,22 @@
}
}
+ /* 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;
diff --git a/tests/amr/amr_test.ok b/tests/amr/amr_test.ok
index 6b42e09..f0d1830 100644
--- a/tests/amr/amr_test.ok
+++ b/tests/amr/amr_test.ok
@@ -152,9 +152,9 @@
Downlink, AMR AFS: fn_begin=99, CMI=1
amr_parse_mr_conf() <- 20 a5 0d 46 52 54
amr_parse_mr_conf() -> num_modes=4
- Mode[0] = 0/37/0
- Mode[1] = 2/53/1
- Mode[2] = 5/37/2
+ Mode[0] = 0/13/4
+ Mode[1] = 2/25/4
+ Mode[2] = 5/37/4
Mode[3] = 7/0/0
amr_parse_mr_conf() <- 20 ff 0d 46 52 54
amr_parse_mr_conf() <- ff ff 0d 46 52 54
--
To view, visit
https://gerrit.osmocom.org/c/osmo-bts/+/27762
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-bts
Gerrit-Branch: master
Gerrit-Change-Id: I8febb60b0ad91903c7869871f41d1c123dbe5ce3
Gerrit-Change-Number: 27762
Gerrit-PatchSet: 1
Gerrit-Owner: fixeria <vyanitskiy(a)sysmocom.de>
Gerrit-MessageType: newchange