<p>Joshua Colp <strong>submitted</strong> this change.</p><p><a href="https://gerrit.asterisk.org/c/asterisk/+/14929">View Change</a></p><div style="white-space:pre-wrap">Approvals:
Kevin Harwell: Looks good to me, but someone else must approve
Benjamin Keith Ford: Looks good to me, but someone else must approve
Joshua Colp: Looks good to me, approved; Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">bridge_softmix/sfu_topologies_on_join: Ignore topology change failures<br><br>When a channel joins a bridge, we do topology change requests on all<br>existing channels to add the new participant to them. However the<br>announcer channel will return an error because it doesn't support<br>topology in the first place. Unfortunately, there doesn't seem to be a<br>reliable way to tell if the error is expected or not so the error is<br>ignored for all channels. If the request fails on a "real" channel,<br>that channel just won't get the new participant's video.<br><br>Change-Id: Ic95db4683f27d224c1869fe887795d6b9fdea4f0<br>---<br>M bridges/bridge_softmix.c<br>1 file changed, 24 insertions(+), 19 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/bridges/bridge_softmix.c b/bridges/bridge_softmix.c</span><br><span>index 8d2d67c..5acd794 100644</span><br><span>--- a/bridges/bridge_softmix.c</span><br><span>+++ b/bridges/bridge_softmix.c</span><br><span>@@ -621,16 +621,16 @@</span><br><span> static void sfu_topologies_on_join(struct ast_bridge *bridge,</span><br><span> struct ast_bridge_channel *joiner)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">- struct ast_stream_topology *joiner_video = NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+ RAII_VAR(struct ast_stream_topology *, joiner_video, NULL, ast_stream_topology_free);</span><br><span> struct ast_bridge_channels_list *participants = &bridge->channels;</span><br><span> struct ast_bridge_channel *participant;</span><br><span> int res;</span><br><span> struct softmix_channel *sc;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_ENTER(3, "%s: \n", ast_channel_name(joiner->chan));</span><br><span> </span><br><span> joiner_video = ast_stream_topology_alloc();</span><br><span> if (!joiner_video) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "%s: Couldn't alloc topology\n", ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- return;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_LOG_RTN(LOG_ERROR, "%s: Couldn't alloc topology\n", ast_channel_name(joiner->chan));</span><br><span> }</span><br><span> </span><br><span> sc = joiner->tech_pvt;</span><br><span>@@ -643,30 +643,30 @@</span><br><span> ast_channel_unlock(joiner->chan);</span><br><span> </span><br><span> if (res || !sc->topology) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "%s: Couldn't append source streams\n", ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- goto cleanup;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_LOG_RTN(LOG_ERROR, "%s: Couldn't append source streams\n", ast_channel_name(joiner->chan));</span><br><span> }</span><br><span> </span><br><span> AST_LIST_TRAVERSE(participants, participant, entry) {</span><br><span> if (participant == joiner) {</span><br><span> continue;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s: Appending existing participant %s\n", ast_channel_name(joiner->chan),</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_name(participant->chan));</span><br><span> ast_channel_lock(participant->chan);</span><br><span> res = append_source_streams(sc->topology, ast_channel_name(participant->chan),</span><br><span> bridge->softmix.send_sdp_label ? ast_channel_uniqueid(participant->chan) : NULL,</span><br><span> ast_channel_get_stream_topology(participant->chan));</span><br><span> ast_channel_unlock(participant->chan);</span><br><span> if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "%s/%s: Couldn't append source streams\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_LOG_RTN(LOG_ERROR, "%s/%s: Couldn't append source streams\n",</span><br><span> ast_channel_name(participant->chan), ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- goto cleanup;</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s: Requesting topology change.\n", ast_channel_name(joiner->chan));</span><br><span> res = ast_channel_request_stream_topology_change(joiner->chan, sc->topology, NULL);</span><br><span> if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(3, "%s: Couldn't request topology change\n", ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- goto cleanup;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_LOG_RTN(LOG_ERROR, "%s: Couldn't request topology change\n", ast_channel_name(joiner->chan));</span><br><span> }</span><br><span> </span><br><span> AST_LIST_TRAVERSE(participants, participant, entry) {</span><br><span>@@ -675,21 +675,22 @@</span><br><span> }</span><br><span> </span><br><span> sc = participant->tech_pvt;</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s: Appending joiner %s\n", ast_channel_name(participant->chan),</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_channel_name(joiner->chan));</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> if (append_all_streams(sc->topology, joiner_video)) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_log(LOG_ERROR, "%s/%s: Couldn't apopend streams\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_LOG_RTN(LOG_ERROR, "%s/%s: Couldn't append streams\n",</span><br><span> ast_channel_name(participant->chan), ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- goto cleanup;</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s: Requesting topology change\n", ast_channel_name(participant->chan));</span><br><span> res = ast_channel_request_stream_topology_change(participant->chan, sc->topology, NULL);</span><br><span> if (res) {</span><br><span style="color: hsl(0, 100%, 40%);">- ast_debug(3, "%s/%s: Couldn't request topology change\n",</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s/%s: Couldn't request topology change\n",</span><br><span> ast_channel_name(participant->chan), ast_channel_name(joiner->chan));</span><br><span style="color: hsl(0, 100%, 40%);">- goto cleanup;</span><br><span> }</span><br><span> }</span><br><span> </span><br><span style="color: hsl(0, 100%, 40%);">-cleanup:</span><br><span style="color: hsl(0, 100%, 40%);">- ast_stream_topology_free(joiner_video);</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT();</span><br><span> }</span><br><span> </span><br><span> /*! \brief Function called when a channel is joined into the bridge */</span><br><span>@@ -706,15 +707,16 @@</span><br><span> int pos_id;</span><br><span> int is_announcement = 0;</span><br><span> int samplerate_change;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_ENTER(3, "%s:\n", ast_channel_name(bridge_channel->chan));</span><br><span> </span><br><span> softmix_data = bridge->tech_pvt;</span><br><span> if (!softmix_data) {</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN_VALUE(-1, "No tech_pvt\n");</span><br><span> }</span><br><span> </span><br><span> /* Create a new softmix_channel structure and allocate various things on it */</span><br><span> if (!(sc = ast_calloc(1, sizeof(*sc)))) {</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN_VALUE(-1, "Couldn't alloc tech_pvt\n");</span><br><span> }</span><br><span> </span><br><span> samplerate_change = softmix_data->internal_rate;</span><br><span>@@ -739,7 +741,7 @@</span><br><span> "Could not allocate enough memory.\n", bridge->uniqueid,</span><br><span> ast_channel_name(bridge_channel->chan));</span><br><span> ast_free(sc);</span><br><span style="color: hsl(0, 100%, 40%);">- return -1;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN_VALUE(-1, "Couldn't do binaural join\n");</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span>@@ -768,7 +770,7 @@</span><br><span> }</span><br><span> </span><br><span> softmix_poke_thread(softmix_data);</span><br><span style="color: hsl(0, 100%, 40%);">- return 0;</span><br><span style="color: hsl(120, 100%, 40%);">+ SCOPE_EXIT_RTN_VALUE(0);</span><br><span> }</span><br><span> </span><br><span> static int remove_destination_streams(struct ast_stream_topology *topology,</span><br><span>@@ -2329,6 +2331,9 @@</span><br><span> ast_trace(-1, "%s: Stream %d:%s changed state from %s to %s\n", ast_channel_name(bridge_channel->chan),</span><br><span> index, ast_stream_get_name(old_stream), ast_stream_state2str(ast_stream_get_state(old_stream)),</span><br><span> ast_stream_state2str(ast_stream_get_state(new_stream)));</span><br><span style="color: hsl(120, 100%, 40%);">+ } else {</span><br><span style="color: hsl(120, 100%, 40%);">+ ast_trace(-1, "%s: Stream %d:%s didn't do anything\n", ast_channel_name(bridge_channel->chan),</span><br><span style="color: hsl(120, 100%, 40%);">+ index, ast_stream_get_name(old_stream));</span><br><span> }</span><br><span> SCOPE_EXIT();</span><br><span> }</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/c/asterisk/+/14929">change 14929</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/+/14929"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: asterisk </div>
<div style="display:none"> Gerrit-Branch: 16 </div>
<div style="display:none"> Gerrit-Change-Id: Ic95db4683f27d224c1869fe887795d6b9fdea4f0 </div>
<div style="display:none"> Gerrit-Change-Number: 14929 </div>
<div style="display:none"> Gerrit-PatchSet: 2 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.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: Joshua Colp <jcolp@sangoma.com> </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>
<div style="display:none"> Gerrit-MessageType: merged </div>