osmith has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-bsc/+/31544 )
Change subject: codec_pref: split test_codec_support_bts_rate ......................................................................
codec_pref: split test_codec_support_bts_rate
Move the check for the rate into an extra function, so it can be used for CSD without checking a speech codec at the same time.
Related: OS#4393 Change-Id: Iea8a23ef3c66ed556110038fe9f3bc7f6eef3e96 --- M src/osmo-bsc/codec_pref.c 1 file changed, 35 insertions(+), 18 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-bsc refs/changes/44/31544/1
diff --git a/src/osmo-bsc/codec_pref.c b/src/osmo-bsc/codec_pref.c index a64425a..0cf98c6 100644 --- a/src/osmo-bsc/codec_pref.c +++ b/src/osmo-bsc/codec_pref.c @@ -174,37 +174,41 @@ return false; }
-/* Check if the given permitted speech value is supported by the BTS - * (vty option bts->codec-support). */ -static bool test_codec_support_bts(const struct gsm_bts *bts, uint8_t perm_spch) +static bool test_codec_support_bts_rate(const struct gsm_bts *bts, const bool full_rate) { - struct gsm_bts_trx *trx; - const struct bts_codec_conf *bts_codec = &bts->codec; unsigned int i; - bool full_rate; - int rc; + struct gsm_bts_trx *trx; enum gsm_phys_chan_config pchan; - bool rate_match = false;
- /* Check if the BTS provides a physical channel that matches the - * bandwidth of the desired codec. */ - rc = full_rate_from_perm_spch(&full_rate, perm_spch); - if (rc < 0) - return false; llist_for_each_entry(trx, &bts->trx_list, list) { for (i = 0; i < TRX_NR_TS; i++) { pchan = trx->ts[i].pchan_from_config; if (pchan == GSM_PCHAN_OSMO_DYN) - rate_match = true; + return true; else if (full_rate && pchan == GSM_PCHAN_TCH_F) - rate_match = true; + return true; else if (full_rate && pchan == GSM_PCHAN_TCH_F_PDCH) - rate_match = true; + return true; else if (!full_rate && pchan == GSM_PCHAN_TCH_H) - rate_match = true; + return true; } } - if (!rate_match) + + return false; +} + +/* Check if the given permitted speech value is supported by the BTS + * (vty option bts->codec-support). */ +static bool test_codec_support_bts(const struct gsm_bts *bts, uint8_t perm_spch) +{ + const struct bts_codec_conf *bts_codec = &bts->codec; + bool full_rate; + int rc; + + /* Check if the BTS provides a physical channel that matches the + * bandwidth of the desired codec. */ + rc = full_rate_from_perm_spch(&full_rate, perm_spch); + if (rc < 0 || !test_codec_support_bts_rate(bts, full_rate)) return false;
/* Check codec support */