[Asterisk-code-review] bridge softmix.c: Change remove destination streams() return... (asterisk[master])

Jenkins2 asteriskteam at digium.com
Tue Dec 19 10:37:54 CST 2017


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/7646 )

Change subject: bridge_softmix.c: Change remove_destination_streams() return meaning.
......................................................................

bridge_softmix.c: Change remove_destination_streams() return meaning.

The return value of remove_destination_streams() now means we removed a
stream from the topology by making it a dead stream.  Now we won't try to
request a topology change if we didn't remove any streams.

Change-Id: Icd91571d856a1d04299a24c411e325c1d9d5c61d
---
M bridges/bridge_softmix.c
1 file changed, 10 insertions(+), 4 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..7385736 100644
--- a/bridges/bridge_softmix.c
+++ b/bridges/bridge_softmix.c
@@ -697,10 +697,11 @@
 	return 0;
 }
 
-static void remove_destination_streams(struct ast_stream_topology *topology,
+static int remove_destination_streams(struct ast_stream_topology *topology,
 	const char *channel_name)
 {
 	int i;
+	int stream_removed = 0;
 
 	for (i = 0; i < ast_stream_topology_get_count(topology); ++i) {
 		struct ast_stream *stream;
@@ -709,8 +710,10 @@
 
 		if (is_video_dest(stream, channel_name, NULL)) {
 			ast_stream_set_state(stream, AST_STREAM_STATE_REMOVED);
+			stream_removed = 1;
 		}
 	}
+	return stream_removed;
 }
 
 static int sfu_topologies_on_leave(struct ast_bridge_channel *leaver, struct ast_bridge_channels_list *participants)
@@ -720,13 +723,16 @@
 
 	AST_LIST_TRAVERSE(participants, participant, entry) {
 		sc = participant->tech_pvt;
-		remove_destination_streams(sc->topology, ast_channel_name(leaver->chan));
+		if (!remove_destination_streams(sc->topology, ast_channel_name(leaver->chan))) {
+			continue;
+		}
 		ast_channel_request_stream_topology_change(participant->chan, sc->topology, NULL);
 	}
 
 	sc = leaver->tech_pvt;
-	remove_destination_streams(sc->topology, "");
-	ast_channel_request_stream_topology_change(leaver->chan, sc->topology, NULL);
+	if (remove_destination_streams(sc->topology, "")) {
+		ast_channel_request_stream_topology_change(leaver->chan, sc->topology, NULL);
+	}
 
 	return 0;
 }

-- 
To view, visit https://gerrit.asterisk.org/7646
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Icd91571d856a1d04299a24c411e325c1d9d5c61d
Gerrit-Change-Number: 7646
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/4731c83b/attachment-0001.html>


More information about the asterisk-code-review mailing list