[Asterisk-code-review] bridge softmix.c: Don't match dead streams. (asterisk[15])
Richard Mudgett
asteriskteam at digium.com
Mon Dec 18 18:51:13 CST 2017
Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/7643
Change subject: bridge_softmix.c: Don't match dead streams.
......................................................................
bridge_softmix.c: Don't match dead streams.
* Made is_video_source() and is_video_dest() not match dead streams.
* Optimized is_video_dest() to reduce duplicated code.
Change-Id: I4e7ab762c7ee98395e78e6516399f57a2609b9a1
---
M bridges/bridge_softmix.c
1 file changed, 12 insertions(+), 16 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/43/7643/1
diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c
index 8de88f2..c8dd8ea 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -418,8 +418,9 @@
*/
static int is_video_source(const struct ast_stream *stream)
{
- if (ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO &&
- strncmp(ast_stream_get_name(stream), SOFTBRIDGE_VIDEO_DEST_PREFIX,
+ if (ast_stream_get_state(stream) != AST_STREAM_STATE_REMOVED
+ && ast_stream_get_type(stream) == AST_MEDIA_TYPE_VIDEO
+ && strncmp(ast_stream_get_name(stream), SOFTBRIDGE_VIDEO_DEST_PREFIX,
SOFTBRIDGE_VIDEO_DEST_LEN)) {
return 1;
}
@@ -448,40 +449,35 @@
char *dest_video_name;
size_t dest_video_name_len;
- if (ast_stream_get_type(stream) != AST_MEDIA_TYPE_VIDEO) {
+ if (ast_stream_get_state(stream) == AST_STREAM_STATE_REMOVED
+ || ast_stream_get_type(stream) != AST_MEDIA_TYPE_VIDEO) {
return 0;
}
dest_video_name_len = SOFTBRIDGE_VIDEO_DEST_LEN + 1;
-
if (!ast_strlen_zero(source_channel_name)) {
dest_video_name_len += strlen(source_channel_name) + 1;
if (!ast_strlen_zero(source_stream_name)) {
dest_video_name_len += strlen(source_stream_name) + 1;
}
- }
- dest_video_name = ast_alloca(dest_video_name_len);
- if (!ast_strlen_zero(source_channel_name)) {
+ dest_video_name = ast_alloca(dest_video_name_len);
if (!ast_strlen_zero(source_stream_name)) {
+ /* We are looking for an exact stream name */
snprintf(dest_video_name, dest_video_name_len, "%s%c%s%c%s",
SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,
source_channel_name, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,
source_stream_name);
return !strcmp(ast_stream_get_name(stream), dest_video_name);
- } else {
- snprintf(dest_video_name, dest_video_name_len, "%s%c%s",
- SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,
- source_channel_name);
- return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);
}
+ snprintf(dest_video_name, dest_video_name_len, "%s%c%s",
+ SOFTBRIDGE_VIDEO_DEST_PREFIX, SOFTBRIDGE_VIDEO_DEST_SEPARATOR,
+ source_channel_name);
} else {
- snprintf(dest_video_name, dest_video_name_len, "%s",
- SOFTBRIDGE_VIDEO_DEST_PREFIX);
- return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);
+ dest_video_name = SOFTBRIDGE_VIDEO_DEST_PREFIX;
}
- return 0;
+ return !strncmp(ast_stream_get_name(stream), dest_video_name, dest_video_name_len - 1);
}
static int append_source_streams(struct ast_stream_topology *dest,
--
To view, visit https://gerrit.asterisk.org/7643
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I4e7ab762c7ee98395e78e6516399f57a2609b9a1
Gerrit-Change-Number: 7643
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171218/812f6a27/attachment-0001.html>
More information about the asterisk-code-review
mailing list