Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not clear how to set # of layers when answering an offer with a track #2014

Closed
alvestrand opened this issue Oct 24, 2018 · 7 comments
Closed
Assignees
Labels
Needs Test Needs a WPT test Ready for PR Simulcast Issue relating to Simulcast

Comments

@alvestrand
Copy link
Contributor

The process for reusing an m-line is only referenced in the spec under addTrack:

http://w3c.github.io/webrtc-pc/#dom-rtcpeerconnection-addtrack

In particular, it's not referenced under addTransceiver, which is our only API point for saying how many layers we wish to send.

This means that I don't know what decides the number of layers available for sending on a transceiver that was created as a result of an incoming offer.

@fippo
Copy link
Contributor

fippo commented Oct 24, 2018

@aboba aboba added the Simulcast Issue relating to Simulcast label Oct 24, 2018
@aboba
Copy link
Contributor

aboba commented Oct 25, 2018

@fippo @alvestrand This seems like quite an important question to answer. In a typical conference the SFU sends the Offer because it alone knows how many participants are in the conference. The SFU will typically not have simulcast sending configured in its Offer m-lines (because the browser typically won't support receiving simulcast). Yet the browser may be sending simulcast to the SFU, so it needs to be able to configure how many simulcast streams it will send in the Answer. Reading the MMUSIC RID draft, it would seem that the SFU can indicate how many simulcast streams it is willing to receive by including a=rid:x recv lines.

In such a situation, the application will receive a track event providing the transceiver that has been created as a result of applying the SFU's Offer in setRemoteDescription(). To configure that transceiver to send simulcast, the only viable mechanism is transceiver.sender.setParameters(). In such a situation, will transceiver.sender.getParameters() return information on the encodings that the SFU said it is able to receive (e.g. maximum number of simulcast encodings and rids for them)? transceiver.receiver.getParameters() provides minimal information on what was Offered (only the number of encodings to be received and the rid) so that doesn't seem relevant.

So it seems that the SFU would have to indicate a willingness to receive simulcast in its Offer for this to work. Section 5.4.1 says "This specification does not define how to configure createOffer to receive multiple RTP encodings." I believe this statement should be expanded to apply to createAnswer as well, since there is no receiver.setParameters() method. However, an SFU is not bound by that restriction.

Does this make any sense??

@alvestrand
Copy link
Contributor Author

adding a=rid:x lines in the offer from the SFU, and reflecting the number of RIDs in the transceiver configuration presented, would make sense. This requires modifying the setRemoteDescription() step that creates transceivers, I believe - this is a minimal change, and doesn't impact API surface. But someone still needs to write a test to go along with it.

@fippo
Copy link
Contributor

fippo commented Oct 25, 2018

We currently send offers including a=simulcast from our SFU to Firefox:

a=rid:hi recv
a=rid:mid recv
a=rid:lo recv
a=simulcast: recv rid=hi;mid;lo

Works fine and there must be a way to indicate support for receiving simulcast streams (rid should be covered by the extmap line). It is somewhat ugly since we still need to then call sender.setParameters with the target bitrates and scaledown ratios we want and basically have to hardcode the rids.
This wouldn't be drastically different from adding the transceiver before setRemoteDescription with the hardcoded rids though.

@aboba
Copy link
Contributor

aboba commented Oct 25, 2018

I would feel better about writing a PR for this if there was a section in JSEP that we could cite. Unfortunately, JSEP Section 5.2.1 (Initial Offers) only talks about a=rid send lines and JSEP Section 5.3.1 (Initial Answers) doesn't mention a=rid lines at all. So this case does not appear to be covered. Though since JSEP is going back to WG last call, we could raise the issue there... though this might be considered "unreasonable punishment" by the authors.

@aboba aboba self-assigned this Oct 25, 2018
@aboba aboba removed their assignment Jan 16, 2019
@aboba
Copy link
Contributor

aboba commented Jan 16, 2019

The ontrack event provides e.transceiver. transceiver.sender.getParameters() provides the send rid values as well as the # of layers.

@aboba aboba added the Needs Test Needs a WPT test label Jan 16, 2019
@amithilbuch
Copy link
Contributor

And you should use setParameters() (after getting them) to set parameters for all the layers (like scale_resolution_down_by ).
You should also be able to reduce the number of layers via a call to setParameters()
One reasonable way to achieve this without actually changing the number of layers is to mark a layer as inactive (paused) indefinitely.
You should not be able to increase the number of layers.

amithilbuch added a commit to amithilbuch/webrtc-pc that referenced this issue Jan 22, 2019
Added text to articulate the difference between the offerer who
calls addTransceiver to define the simulcast envelope and the
answerer who is passive and has the envelope set up for them in a
call to setRemoteDescription.
Fixes: w3c#2014.
amithilbuch added a commit to amithilbuch/webrtc-pc that referenced this issue Feb 1, 2019
Added text to articulate the difference between the offerer who
calls addTransceiver to define the simulcast envelope and the
answerer who is passive and has the envelope set up for them in a
call to setRemoteDescription.
Added steps to Set the RTCSessionDescription to indicate how the
the envelope should be set up or modified.

Fixes: w3c#2014.
amithilbuch added a commit to amithilbuch/webrtc-pc that referenced this issue Feb 1, 2019
Added text to articulate the difference between the offerer who
calls addTransceiver to define the simulcast envelope and the
answerer who is passive and has the envelope set up for them in a
call to setRemoteDescription.
Added steps to Set the RTCSessionDescription to indicate how the
the envelope should be set up or modified.

Fixes: w3c#2014.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs Test Needs a WPT test Ready for PR Simulcast Issue relating to Simulcast
Projects
None yet
Development

No branches or pull requests

4 participants