<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14530">View Change</a></p><div style="white-space:pre-wrap">Approvals:
  Kevin Harwell: Looks good to me, approved
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Friendly Automation: Approved for Submit

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: Don't assume setting retrans props means to enable.<br><br>The "value" passed in when setting an RTP property determines<br>whether it should be enabled or disabled. The RTP send and<br>receive retrans props did not examine this to know if the<br>buffers should be enabled. They assumed they always should be.<br><br>This change makes it so that the "value" passed in is<br>respected.<br><br>ASTERISK-28939<br><br>Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 22 insertions(+), 3 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/res/res_rtp_asterisk.c b/res/res_rtp_asterisk.c</span><br><span>index 134eebc..6004a2f 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -8136,10 +8136,29 @@</span><br><span>        } else if (property == AST_RTP_PROPERTY_ASYMMETRIC_CODEC) {</span><br><span>          rtp->asymmetric_codec = value;</span><br><span>    } else if (property == AST_RTP_PROPERTY_RETRANS_SEND) {</span><br><span style="color: hsl(0, 100%, 40%);">-         rtp->send_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_SEND_BUFFER_SIZE);</span><br><span style="color: hsl(120, 100%, 40%);">+              if (value) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  if (!rtp->send_buffer) {</span><br><span style="color: hsl(120, 100%, 40%);">+                           rtp->send_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_SEND_BUFFER_SIZE);</span><br><span style="color: hsl(120, 100%, 40%);">+                      }</span><br><span style="color: hsl(120, 100%, 40%);">+             } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      if (rtp->send_buffer) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            ast_data_buffer_free(rtp->send_buffer);</span><br><span style="color: hsl(120, 100%, 40%);">+                            rtp->send_buffer = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+                   }</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span>    } else if (property == AST_RTP_PROPERTY_RETRANS_RECV) {</span><br><span style="color: hsl(0, 100%, 40%);">-         rtp->recv_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_RECV_BUFFER_SIZE);</span><br><span style="color: hsl(0, 100%, 40%);">-                AST_VECTOR_INIT(&rtp->missing_seqno, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+               if (value) {</span><br><span style="color: hsl(120, 100%, 40%);">+                  if (!rtp->recv_buffer) {</span><br><span style="color: hsl(120, 100%, 40%);">+                           rtp->recv_buffer = ast_data_buffer_alloc(ast_free_ptr, DEFAULT_RTP_RECV_BUFFER_SIZE);</span><br><span style="color: hsl(120, 100%, 40%);">+                              AST_VECTOR_INIT(&rtp->missing_seqno, 0);</span><br><span style="color: hsl(120, 100%, 40%);">+                       }</span><br><span style="color: hsl(120, 100%, 40%);">+             } else {</span><br><span style="color: hsl(120, 100%, 40%);">+                      if (rtp->recv_buffer) {</span><br><span style="color: hsl(120, 100%, 40%);">+                            ast_data_buffer_free(rtp->recv_buffer);</span><br><span style="color: hsl(120, 100%, 40%);">+                            rtp->recv_buffer = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+                           AST_VECTOR_FREE(&rtp->missing_seqno);</span><br><span style="color: hsl(120, 100%, 40%);">+                  }</span><br><span style="color: hsl(120, 100%, 40%);">+             }</span><br><span>    }</span><br><span> }</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14530">change 14530</a>. To unsubscribe, or for help writing mail filters, 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/c/asterisk/+/14530"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: certified/16.8 </div>
<div style="display:none"> Gerrit-Change-Id: I9244cdbdc5fd065c7f6b02cbfa572bc55c7123dc </div>
<div style="display:none"> Gerrit-Change-Number: 14530 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Friendly Automation </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>