<p>Pirmin Walthert has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14208">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">res_rtp_asterisk: prevent loop when receive buffer is flushed by a<br>received packet that is also in receive buffer with NACK<br><br>When the receive buffer was flushed by a received packet while the<br>it already contained a packet with the same sequence number,<br>asterisk never left the while loop which tried to order the packets.<br>Prevent this by making sure that the packet is only inserted once.<br><br>Change-Id: Idaa376101bc1ac880047c49feb6faee773e718b3<br>---<br>M res/res_rtp_asterisk.c<br>1 file changed, 10 insertions(+), 7 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/08/14208/1</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 739b17b..1d44c92 100644</span><br><span>--- a/res/res_rtp_asterisk.c</span><br><span>+++ b/res/res_rtp_asterisk.c</span><br><span>@@ -7825,7 +7825,7 @@</span><br><span>                        struct ast_rtp_rtcp_nack_payload *payload;</span><br><span> </span><br><span>                       /* If the packet we received is the one we are expecting at this point then add it in */</span><br><span style="color: hsl(0, 100%, 40%);">-                        if (rtp->expectedrxseqno == seqno) {</span><br><span style="color: hsl(120, 100%, 40%);">+                       if (rtp->expectedrxseqno == seqno && !inserted) {</span><br><span>                                 frame = ast_frdup(ast_rtp_interpret(instance, srtp, &addr, read_area, res, prev_seqno));</span><br><span>                                 if (frame) {</span><br><span>                                         AST_LIST_INSERT_TAIL(&frames, frame, frame_list);</span><br><span>@@ -7843,12 +7843,15 @@</span><br><span> </span><br><span>                  payload = (struct ast_rtp_rtcp_nack_payload *)ast_data_buffer_remove(rtp->recv_buffer, rtp->expectedrxseqno);</span><br><span>                  if (payload) {</span><br><span style="color: hsl(0, 100%, 40%);">-                          frame = ast_frdup(ast_rtp_interpret(instance, srtp, &addr, payload->buf, payload->size, prev_seqno));</span><br><span style="color: hsl(0, 100%, 40%);">-                         if (frame) {</span><br><span style="color: hsl(0, 100%, 40%);">-                                    AST_LIST_INSERT_TAIL(&frames, frame, frame_list);</span><br><span style="color: hsl(0, 100%, 40%);">-                                   prev_seqno = rtp->expectedrxseqno;</span><br><span style="color: hsl(0, 100%, 40%);">-                                   ast_debug(2, "Emptying queue and returning packet with sequence number '%d' from RTP instance '%p'\n",</span><br><span style="color: hsl(0, 100%, 40%);">-                                                frame->seqno, instance);</span><br><span style="color: hsl(120, 100%, 40%);">+                           //if the expectedrxseqno equals seqno this is an error or a duplicated packet...</span><br><span style="color: hsl(120, 100%, 40%);">+                              if (rtp->expectedrxseqno != seqno) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                       frame = ast_frdup(ast_rtp_interpret(instance, srtp, &addr, payload->buf, payload->size, prev_seqno));</span><br><span style="color: hsl(120, 100%, 40%);">+                                       if (frame) {</span><br><span style="color: hsl(120, 100%, 40%);">+                                          AST_LIST_INSERT_TAIL(&frames, frame, frame_list);</span><br><span style="color: hsl(120, 100%, 40%);">+                                         prev_seqno = rtp->expectedrxseqno;</span><br><span style="color: hsl(120, 100%, 40%);">+                                         ast_debug(2, "Emptying queue and returning packet with sequence number '%d' from RTP instance '%p'\n",</span><br><span style="color: hsl(120, 100%, 40%);">+                                                      frame->seqno, instance);</span><br><span style="color: hsl(120, 100%, 40%);">+                                   }</span><br><span>                            }</span><br><span>                            ast_free(payload);</span><br><span>                   }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14208">change 14208</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/+/14208"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Idaa376101bc1ac880047c49feb6faee773e718b3 </div>
<div style="display:none"> Gerrit-Change-Number: 14208 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pirmin Walthert <infos@nappsoft.ch> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>