[asterisk-dev] WebRTC SFU: support add video track dynamically

Xiemin Chen chenxiemin at gmail.com
Sun May 26 09:52:37 CDT 2019

First I add a new function compare_topology() which called by
handle_negotinated_sdp to check whether there's a new msid in the
pending_media_state to fire the  AST_CONTROL_STREAM_TOPOLOGY_SOURCE_CHANGED

    *changed |=

Then I add following code in sfu_topologies_on_source_change() to copy the
new stream topology to softmix_channel->topology for the next usage.

*+       sc = source->tech_pvt;+        ast_channel_lock(source->chan);
    res = append_source_streams(source_video,
bridge->softmix.send_sdp_label ? ast_channel_uniqueid(source->chan) :
NULL,                ast_channel_get_stream_topology(source->chan));++
 if (NULL != sc->topology)+        ast_stream_topology_free(sc->topology);+
      sc->topology =
      ast_channel_unlock(source->chan);-       if (res) {++       if (res
|| !sc->topology) {                goto cleanup;        }*

Then it seems to work for the dynamically stream add.

How about the dynamically stream removed? If I want to remove a stream from
the client, can I simply mark the stream as "a=inactive" in the offer sdp?


Joshua C. Colp <jcolp at digium.com> 于2019年5月10日周五 上午12:55写道:

> On Thu, May 9, 2019, at 1:46 PM, Xiemin Chen wrote:
> > A cannot see B's new video track,
> > A is not trigged a renegotiation progress after B's new video track was
> added.
> The code likely is not queueing up a AST_CONTROL_STREAM_TOPOLOGY_CHANGED
> frame then. That informs the bridge code the topology has changed and it
> needs to update everything. The bridge_softmix implementation isn't really
> written to handle this case though, so it still wouldn't reinvite all the
> like you mentioned before MAY work, although it also wasn't written for
> this specific case.
> --
> Joshua C. Colp
> Digium - A Sangoma Company | Senior Software Developer
> 445 Jan Davis Drive NW - Huntsville, AL 35806 - US
> Check us out at: www.digium.com & www.asterisk.org
> --
> _____________________________________________________________________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20190526/b807d6d4/attachment.html>

More information about the asterisk-dev mailing list