summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorJenkins2 <jenkins2@gerrit.asterisk.org>2018-03-20 11:16:52 -0500
committerGerrit Code Review <gerrit2@gerrit.digium.api>2018-03-20 11:16:52 -0500
commitf863f1f91bfcaa2b8a184a5edbfaf7b52930bdf8 (patch)
tree4688f591fecb7eb453c66c37d8b24d645be3f31b /main
parent05ac34fe85d2a3b320143ef5dd69c28a3569b966 (diff)
parent5d097f82367f61bdae7d799c7815e69ba089d6d6 (diff)
Merge "channel.c: Allow generic plc then channel formats are equal"
Diffstat (limited to 'main')
-rw-r--r--main/asterisk.c1
-rw-r--r--main/channel.c10
-rw-r--r--main/plc.c9
3 files changed, 17 insertions, 3 deletions
diff --git a/main/asterisk.c b/main/asterisk.c
index 7a4424d22..36b1b54a1 100644
--- a/main/asterisk.c
+++ b/main/asterisk.c
@@ -599,6 +599,7 @@ static char *handle_show_settings(struct ast_cli_entry *e, int cmd, struct ast_c
ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");
+ ast_cli(a->fd, " Generic PLC on equal codecs: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS) ? "Enabled" : "Disabled");
ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration);
#if !defined(LOW_MEMORY)
ast_cli(a->fd, " Cache media frames: %s\n", ast_opt_cache_media_frames ? "Enabled" : "Disabled");
diff --git a/main/channel.c b/main/channel.c
index c7847cbd4..8325f19c3 100644
--- a/main/channel.c
+++ b/main/channel.c
@@ -6485,11 +6485,15 @@ static int ast_channel_make_compatible_helper(struct ast_channel *from, struct a
* to use SLINEAR between channels, but only if there is
* no direct conversion available. If generic PLC is
* desired, then transcoding via SLINEAR is a requirement
+ * even if the formats are the same.
*/
- if (ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL
- && (ast_opt_generic_plc || ast_opt_transcode_via_slin)) {
+ if (ast_opt_generic_plc_on_equal_codecs
+ || (ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL
+ && (ast_opt_generic_plc || ast_opt_transcode_via_slin))) {
+
int use_slin = (ast_format_cache_is_slinear(best_src_fmt)
- || ast_format_cache_is_slinear(best_dst_fmt)) ? 1 : 0;
+ || ast_format_cache_is_slinear(best_dst_fmt))
+ ? 1 : ast_opt_generic_plc_on_equal_codecs;
if (use_slin || ast_translate_path_steps(best_dst_fmt, best_src_fmt) != 1) {
int best_sample_rate = (ast_format_get_sample_rate(best_src_fmt) > ast_format_get_sample_rate(best_dst_fmt)) ?
diff --git a/main/plc.c b/main/plc.c
index 847ce65b0..369d285a5 100644
--- a/main/plc.c
+++ b/main/plc.c
@@ -262,10 +262,19 @@ static int reload_module(void)
for (var = ast_variable_browse(cfg, "plc"); var; var = var->next) {
if (!strcasecmp(var->name, "genericplc")) {
ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC);
+ } else if (!strcasecmp(var->name, "genericplc_on_equal_codecs")) {
+ ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
}
}
ast_config_destroy(cfg);
+ /*
+ * Force on_equal_codecs to false if generic_plc is false.
+ */
+ if (!ast_opt_generic_plc) {
+ ast_set2_flag(&ast_options, 0, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);
+ }
+
return 0;
}