[Asterisk-code-review] bridge softmix.c: Don't match dead streams. (asterisk[master])
Jenkins2
asteriskteam at digium.com
Tue Dec 19 11:12:23 CST 2017
Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7644 )
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(-)
Approvals:
Corey Farrell: Looks good to me, but someone else must approve
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
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/7644
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I4e7ab762c7ee98395e78e6516399f57a2609b9a1
Gerrit-Change-Number: 7644
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
Gerrit-Reviewer: Corey Farrell <git at cfware.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20171219/bc8d8031/attachment.html>
More information about the asterisk-code-review
mailing list