<p>Richard Mudgett has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.asterisk.org/7644">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix.c: Don't match dead streams.<br><br>* Made is_video_source() and is_video_dest() not match dead streams.<br><br>* Optimized is_video_dest() to reduce duplicated code.<br><br>Change-Id: I4e7ab762c7ee98395e78e6516399f57a2609b9a1<br>---<br>M bridges/bridge_softmix.c<br>1 file changed, 12 insertions(+), 16 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/44/7644/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c<br>index 8de88f2..c8dd8ea 100644<br>--- a/bridges/bridge_softmix.c<br>+++ b/bridges/bridge_softmix.c<br>@@ -418,8 +418,9 @@<br> */<br> static int is_video_source(const struct ast_stream *stream)<br> {<br>- if (ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO &&<br>- strncmp(ast_stream_get_name(stream), SOFTBRIDGE_VIDEO_DEST_PREFIX,<br>+ if (ast_stream_get_state(stream) != AST_STREAM_STATE_REMOVED<br>+ && ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO<br>+ && strncmp(ast_stream_get_name(stream), SOFTBRIDGE_VIDEO_DEST_PREFIX,<br> SOFTBRIDGE_VIDEO_DEST_LEN)) {<br> return 1;<br> }<br>@@ -448,40 +449,35 @@<br> char *dest_video_name;<br> size_t dest_video_name_len;<br> <br>- if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_VIDEO) {<br>+ if (ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED<br>+ || ast_stream_get_type(stream) != AST_MEDIA_TYPE_VIDEO) {<br> return 0;<br> }<br> <br> dest_video_name_len = SOFTBRIDGE_VIDEO_DEST_LEN + 1;<br>-<br> if (!ast_strlen_zero(source_channel_name)) {<br> dest_video_name_len += strlen(source_channel_name) + 1;<br> if (!ast_strlen_zero(source_stream_name)) {<br> dest_video_name_len += strlen(source_stream_name) + 1;<br> }<br>- }<br>- dest_video_name = ast_alloca(dest_video_name_len);<br> <br>- if (!ast_strlen_zero(source_channel_name)) {<br>+ dest_video_name = ast_alloca(dest_video_name_len);<br> if (!ast_strlen_zero(source_stream_name)) {<br>+ /* We are looking for an exact stream name */<br> snprintf(dest_video_name, dest_video_name_len, "%s%c%s%c%s",<br> SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,<br> source_channel_name, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,<br> source_stream_name);<br> return !strcmp(ast_stream_get_name(stream), dest_video_name);<br>- } else {<br>- snprintf(dest_video_name, dest_video_name_len, "%s%c%s",<br>- SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,<br>- source_channel_name);<br>- return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);<br> }<br>+ snprintf(dest_video_name, dest_video_name_len, "%s%c%s",<br>+ SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,<br>+ source_channel_name);<br> } else {<br>- snprintf(dest_video_name, dest_video_name_len, "%s",<br>- SOFTBRIDGE_VIDEO_DEST_PREFIX);<br>- return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);<br>+ dest_video_name = SOFTBRIDGE_VIDEO_DEST_PREFIX;<br> }<br> <br>- return 0;<br>+ return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);<br> }<br> <br> static int append_source_streams(struct ast_stream_topology *dest,<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/7644">change 7644</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/7644"/><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: I4e7ab762c7ee98395e78e6516399f57a2609b9a1 </div>
<div style="display:none"> Gerrit-Change-Number: 7644 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Richard Mudgett <rmudgett@digium.com> </div>