<p>Friendly Automation <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14496">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Benjamin Keith Ford: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Friendly Automation: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_channel: Don't queue unmapped frames.<br><br>If a frame is written to a channel in a bridge we<br>would normally queue this frame up and the channel<br>thread would then act upon it. If this frame had no<br>stream mapping on the channel it would then be<br>discarded.<br><br>This change adds a check before the queueing occurs<br>to determine if a mapping exists. If it does not<br>exist then the frame is not even queued at all. This<br>stops a frame duplication from happening and from<br>the channel thread having to wake up and deal with<br>it.<br><br>Change-Id: I17189b9b1dec45fc7e4490e8081d444a25a00bda<br>---<br>M main/bridge_channel.c<br>1 file changed, 17 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/main/bridge_channel.c b/main/bridge_channel.c</span><br><span>index 8566187..251dea7 100644</span><br><span>--- a/main/bridge_channel.c</span><br><span>+++ b/main/bridge_channel.c</span><br><span>@@ -1043,6 +1043,23 @@</span><br><span> return 0;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ if ((fr->frametype == AST_FRAME_VOICE || fr->frametype == AST_FRAME_VIDEO ||</span><br><span style="color: hsl(120, 100%, 40%);">+ fr->frametype == AST_FRAME_TEXT || fr->frametype == AST_FRAME_IMAGE ||</span><br><span style="color: hsl(120, 100%, 40%);">+ fr->frametype == AST_FRAME_RTCP) && fr->stream_num > -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ int num = -1;</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bridge_channel_lock(bridge_channel);</span><br><span style="color: hsl(120, 100%, 40%);">+ if (fr->stream_num < (int)AST_VECTOR_SIZE(&bridge_channel->stream_map.to_channel)) {</span><br><span style="color: hsl(120, 100%, 40%);">+ num = AST_VECTOR_GET(&bridge_channel->stream_map.to_channel, fr->stream_num);</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_bridge_channel_unlock(bridge_channel);</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ if (num == -1) {</span><br><span style="color: hsl(120, 100%, 40%);">+ /* We don't have a mapped stream so just discard this frame. */</span><br><span style="color: hsl(120, 100%, 40%);">+ return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+ }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> dup = ast_frdup(fr);</span><br><span> if (!dup) {</span><br><span> return -1;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14496">change 14496</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/+/14496"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 17 </div>
<div style="display:none"> Gerrit-Change-Id: I17189b9b1dec45fc7e4490e8081d444a25a00bda </div>
<div style="display:none"> Gerrit-Change-Number: 14496 </div>
<div style="display:none"> Gerrit-PatchSet: 3 </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-MessageType: merged </div>