From f091db0f204f9c2acbccb74462b33e33babee832 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 19 Jan 2024 06:00:46 +0100 Subject: [PATCH] bearer_cap_set_radio() traverse all matches It's a minor technicality, but it seems the newly added API to iterate the codec_mapping can slightly improve this implementation: For some reason, the Bearer Capabilities should reflect whether any HR codec is possible with its listed Speech Versions. So far we looked only whether the first match for a given Speech Version in the global const codec_mapping is a HR codec. Instead, look through *all* entries for a Speech Version, and see if any one of them indicates HR. For example, an AMR-FR codec with a well adjusted mode-set can work with a half rate channel. Change-Id: Ic964af4bec21598836748279f3fee480e470738c --- src/libmsc/codec_mapping.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libmsc/codec_mapping.c b/src/libmsc/codec_mapping.c index a1f31db7d..90c8ee6cd 100644 --- a/src/libmsc/codec_mapping.c +++ b/src/libmsc/codec_mapping.c @@ -432,13 +432,13 @@ int bearer_cap_set_radio(struct gsm_mncc_bearer_cap *bearer_cap) if (bearer_cap->speech_ver[i] == -1) break; - m = codec_mapping_by_speech_ver(bearer_cap->speech_ver[i]); + codec_mapping_foreach (m) { + if (!codec_mapping_matches_speech_ver(m, bearer_cap->speech_ver[i])) + continue; - if (!m) - continue; - - if (m->frhr == CODEC_FRHR_HR) - hr_present = true; + if (m->frhr == CODEC_FRHR_HR) + hr_present = true; + } } if (hr_present)