[webrtc-pc] setParameters: check for number of encodings

aboba has just created a new issue for https://github.com/w3c/webrtc-pc:

== setParameters: check for number of encodings ==
The following code (from Simulcast Playground by Fippo) run without issue on Firefox: 

`navigator.mediaDevices.getUserMedia({video: {wіdth: 1280, height: 720}})
.then(stream => {
    show(stream, false);
    const sender = pc1.addTrack(stream.getTracks()[0], stream);
    sender.setParameters({encodings: [
        {rid: "hi", maxBitrate: bitrates[0]},
        {rid: "mid", maxBitrate: bitrates[1], scaleResolutionDownBy: 2},
        {rid: "lo", maxBitrate: bitrates[2], scaleResolutionDownBy: 4},
    ]});
    return pc1.createOffer();
})`

Yet, in Section 5.2, setParameters contains the following checks:

Validate parameters by running the following steps:

    Let encodings be parameters.encodings.
    Let codecs be parameters.codecs.
    Let N be the number of RTCRtpEncodingParameters stored in sender's internal [[SendEncodings]] slot.
    If any of the following conditions are met, return a promise rejected with a newly created InvalidModificationError:
        encodings.length is different from N.
        encodings has been re-ordered. 

These checks would (wrongly) result in an InvalidModificationError in the above code snippet. 
The problem that the check is (incorrectly) trying to find is an attempt to change the number of encodings *after* negotiation.  That would set negotiation-needed, which is not permitted in setParameters.  But prior to calling sLD, setParameters should be able to change the 'simulcast envelope'. 




Please view or discuss this issue at https://github.com/w3c/webrtc-pc/issues/2016 using your GitHub account

Received on Saturday, 27 October 2018 17:54:10 UTC