<p>George Joseph has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/8555">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">channel.c: Allow generic plc then channel formats are equal<br><br>If the two formats on a channel are equal, we don't transcode and since<br>the generic plc needs slin to work, it doesn't get invoked.<br><br>* A new configuration option "genericplc_on_equal_codecs" was added<br> to the "plc" section of codecs.conf to allow generic packet loss<br> concealment even if no transcoding was originally needed.<br> Transcoding via SLIN is forced in this case.<br><br>ASTERISK-27743<br><br>Change-Id: I0577026a179dea34232e63123254b4e0508378f4<br>---<br>M CHANGES<br>M configs/samples/codecs.conf.sample<br>M include/asterisk/options.h<br>M main/asterisk.c<br>M main/channel.c<br>5 files changed, 32 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/55/8555/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/CHANGES b/CHANGES<br>index 0f4ced2..09a7659 100644<br>--- a/CHANGES<br>+++ b/CHANGES<br>@@ -101,6 +101,13 @@<br> --- Functionality changes from Asterisk 15.3.0 to Asterisk 15.4.0 ------------<br> ------------------------------------------------------------------------------<br> <br>+Core<br>+------------------<br>+ * A new configuration option "genericplc_on_equal_codecs" was added to the<br>+ "plc" section of codecs.conf to allow generic packet loss concealment even<br>+ if no transcoding was originally needed. Transcoding via SLIN is forced<br>+ in this case.<br>+<br> res_pjproject<br> ------------------<br> * Added the "cache_pools" option to pjproject.conf. Disabling the option<br>diff --git a/configs/samples/codecs.conf.sample b/configs/samples/codecs.conf.sample<br>index 8457fb5..8c9ce66 100644<br>--- a/configs/samples/codecs.conf.sample<br>+++ b/configs/samples/codecs.conf.sample<br>@@ -64,8 +64,15 @@<br> [plc]<br> ; for all codecs which do not support native PLC<br> ; this determines whether to perform generic PLC<br>-; there is a minor performance penalty for this<br>+; there is a minor performance penalty for this.<br>+; By default plc is applied only when the 2 codecs<br>+; in a channel are different.<br> genericplc => true<br>+; Apply generic plc to channels even if the 2 codecs<br>+; are the same. This forces transcoding via slin so<br>+; the performance impact should be considered.<br>+; Ignored if genericplc is not also enabled.<br>+genericplc_on_equal_codecs => false<br> <br> ; Generate custom formats for formats requiring attributes.<br> ; After defining the custom format, the name used in defining<br>diff --git a/include/asterisk/options.h b/include/asterisk/options.h<br>index 78f596a..fc366ca 100644<br>--- a/include/asterisk/options.h<br>+++ b/include/asterisk/options.h<br>@@ -98,6 +98,8 @@<br> AST_OPT_FLAG_LOCK_CONFIG_DIR = (1 << 29),<br> /*! Generic PLC */<br> AST_OPT_FLAG_GENERIC_PLC = (1 << 30),<br>+ /*! Generic PLC onm equal codecs */<br>+ AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS = (1 << 31),<br> };<br> <br> /*! These are the options that set by default when Asterisk starts */<br>@@ -134,6 +136,7 @@<br> #define ast_opt_lock_confdir ast_test_flag(&ast_options, AST_OPT_FLAG_LOCK_CONFIG_DIR)<br> #define ast_opt_generic_plc ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC)<br> #define ast_opt_ref_debug ast_test_flag(&ast_options, AST_OPT_FLAG_REF_DEBUG)<br>+#define ast_opt_generic_plc_on_equal_codecs ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS)<br> <br> /*! Maximum log level defined by PJPROJECT. */<br> #define MAX_PJ_LOG_MAX_LEVEL 6<br>diff --git a/main/asterisk.c b/main/asterisk.c<br>index bec992f..9f17611 100644<br>--- a/main/asterisk.c<br>+++ b/main/asterisk.c<br>@@ -606,6 +606,7 @@<br> ast_cli(a->fd, " Transcode via SLIN: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSCODE_VIA_SLIN) ? "Enabled" : "Disabled");<br> ast_cli(a->fd, " Transmit silence during rec: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_TRANSMIT_SILENCE) ? "Enabled" : "Disabled");<br> ast_cli(a->fd, " Generic PLC: %s\n", ast_test_flag(&ast_options, AST_OPT_FLAG_GENERIC_PLC) ? "Enabled" : "Disabled");<br>+ 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");<br> ast_cli(a->fd, " Min DTMF duration:: %u\n", option_dtmfminduration);<br> #if !defined(LOW_MEMORY)<br> ast_cli(a->fd, " Cache media frames: %s\n", ast_opt_cache_media_frames ? "Enabled" : "Disabled");<br>diff --git a/main/channel.c b/main/channel.c<br>index 2779aa8..8b6023d 100644<br>--- a/main/channel.c<br>+++ b/main/channel.c<br>@@ -6487,8 +6487,10 @@<br> * to use SLINEAR between channels, but only if there is<br> * no direct conversion available. If generic PLC is<br> * desired, then transcoding via SLINEAR is a requirement<br>+ * even if the formats are teh same.<br> */<br>- if (ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL<br>+ if ((ast_format_cmp(best_dst_fmt, best_src_fmt) == AST_FORMAT_CMP_NOT_EQUAL<br>+ || (ast_opt_generic_plc && ast_opt_generic_plc_on_equal_codecs))<br> && (ast_opt_generic_plc || ast_opt_transcode_via_slin)) {<br> int use_slin = (ast_format_cache_is_slinear(best_src_fmt)<br> || ast_format_cache_is_slinear(best_dst_fmt)) ? 1 : 0;<br>@@ -7594,6 +7596,16 @@<br> if (!strcasecmp(var->name, "genericplc")) {<br> ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC);<br> }<br>+ else if (!strcasecmp(var->name, "genericplc_on_equal_codecs")) {<br>+ ast_set2_flag(&ast_options, ast_true(var->value), AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);<br>+ }<br>+ }<br>+<br>+ /*<br>+ * Force on_equal_codecs to false if generic_plc is false.<br>+ */<br>+ if (!ast_opt_generic_plc) {<br>+ ast_set2_flag(&ast_options, 0, AST_OPT_FLAG_GENERIC_PLC_ON_EQUAL_CODECS);<br> }<br> ast_config_destroy(cfg);<br> return 0;<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8555">change 8555</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8555"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I0577026a179dea34232e63123254b4e0508378f4 </div>
<div style="display:none"> Gerrit-Change-Number: 8555 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>