amr: fix parsing of threshold and hysteresis in amr_parse_mr_conf()

Change-Id: I8febb60b0ad91903c7869871f41d1c123dbe5ce3
Related: SYS#5917, OS#4984
This commit is contained in:
Vadim Yanitskiy 2022-04-12 22:22:24 +03:00
parent 4765a5d195
commit 56585bb351
2 changed files with 12 additions and 9 deletions

View File

@ -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;

View File

@ -152,9 +152,9 @@ Downlink, AMR AFS: fn_begin=95, CMI=0
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