From 2915d3aba8f52e34a7fd258fbd4182fddfa42879 Mon Sep 17 00:00:00 2001 From: Dragos Oancea Date: Fri, 7 May 2021 14:17:15 +0000 Subject: [PATCH] [mod_amrwb] add cfg setting mode-set-overwrite (it will answer with just one mode-set value) - fixes audio quality issues in mod_conference with some UEs. --- conf/testing/autoload_configs/amrwb.conf.xml | 2 ++ conf/vanilla/autoload_configs/amrwb.conf.xml | 2 ++ src/mod/codecs/mod_amrwb/mod_amrwb.c | 6 +++++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/conf/testing/autoload_configs/amrwb.conf.xml b/conf/testing/autoload_configs/amrwb.conf.xml index 0bd8e6b733..1163ffd1a6 100644 --- a/conf/testing/autoload_configs/amrwb.conf.xml +++ b/conf/testing/autoload_configs/amrwb.conf.xml @@ -18,5 +18,7 @@ + + diff --git a/conf/vanilla/autoload_configs/amrwb.conf.xml b/conf/vanilla/autoload_configs/amrwb.conf.xml index 0bd8e6b733..1163ffd1a6 100644 --- a/conf/vanilla/autoload_configs/amrwb.conf.xml +++ b/conf/vanilla/autoload_configs/amrwb.conf.xml @@ -18,5 +18,7 @@ + + diff --git a/src/mod/codecs/mod_amrwb/mod_amrwb.c b/src/mod/codecs/mod_amrwb/mod_amrwb.c index ef7891cde6..8be5f4d541 100644 --- a/src/mod/codecs/mod_amrwb/mod_amrwb.c +++ b/src/mod/codecs/mod_amrwb/mod_amrwb.c @@ -88,6 +88,7 @@ static struct { switch_byte_t volte; switch_byte_t adjust_bitrate; switch_byte_t force_oa; /*force OA when originating*/ + switch_byte_t mode_set_overwrite; int debug; } globals; @@ -273,7 +274,7 @@ static switch_status_t switch_amrwb_init(switch_codec_t *codec, switch_codec_fla } } - if (context->enc_modes) { + if (context->enc_modes && !globals.mode_set_overwrite) { /* choose the highest mode (bitrate) for high audio quality. */ for (i = SWITCH_AMRWB_MODES-2; i > -1; i--) { if (context->enc_modes & (1 << i)) { @@ -572,6 +573,9 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_amrwb_load) if (!strcasecmp(var, "force-oa")) { globals.force_oa = (switch_byte_t) atoi(val); } + if (!strcasecmp(var, "mode-set-overwrite")) { + globals.mode_set_overwrite = (switch_byte_t) atoi(val); + } } } }