Added support for simulcast and TWCC to Duktape and Lua plugins #2409
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This patch adds support for both simulcast and TWCC (transport-wide CC, i.e., sender side bandwidth estimation) negotiation to the Duktape and Lua plugins. This was made possible thanks to a generous sponsorship by our good friends at Voicenter, so make sure to properly thank them if you needed these features in your scripts! ❤️
In case you want to start using the simulcast features in a Duktape/Lua script, while negotiation and RTP management is automatic there's a couple of things you'll need to do:
setSubstream(id, substream)
andsetTemporalLayer(id, temporal)
methods from your scripts to configure which layer you're interested in: by default both plugins will assume you'll want the highest quality (2
, even though the maximum temporal layer is really1
right now). Notice that it's up to you to ask for a keyframe after a layer change request, which you can do using the already existingsendPli(id)
request.substreamChanged(id, substream)
andtemporalLayerChanged(id, temporal)
callbacks: this is especially useful when you want to be aware of when a layer change request was actually done (which may not be right away, e.g., if a keyframe was missing), and/or to notify users about when things change (which is what we do in our demos, for instance).You can find an example of how those new methods and callbacks are used in Duktape's
echotest.js
and Lua'sechotest.lua
scripts, which will work nicely with the existing EchoTest demo if you have it connect to those plugins rather than the C EchoTest one.For what concerns TWCC, instead, we now automatically negotiate a few RTP extensions in both plugins, namely
mid
,rid
andrepaired-rid
: the TWCC RTP extension is also negotiated by default, but you can disable it by passingdisableTwcc: true
when callinggenerateAnswer()
. I'd always suggest negotiating it, as it will make publisher streams more stable, but if for some reason you'd rather disable it, that's the way to do it.I only tested this with the EchoTest demo, since that's the script available in both plugins, and it seems to be working as expected. Looking forward to your feedback to see if there's anything that needs to be fixed, tweaked or improved: the sooner that happens, the sooner we can merge!