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

Don't let offers to receive simulcast overwrite existing [[SendEncodings]] #2758

Merged
merged 9 commits into from
Oct 13, 2022
89 changes: 58 additions & 31 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -1758,21 +1758,35 @@ <h4>
<li>
<p id="remote-rid-reneg">
If <var>remote</var> is <code>true</code>, and
<var>description</var> is of type {{RTCSdpType/"offer"}}
and contains a request to receive simulcast, and applying
<var>description</var> leads to modifying a
transceiver <var>transceiver</var>, and
<var>description</var> is of type
{{RTCSdpType/"offer"}}, then for each
[= media description =] requesting to receive simulcast
that already has an existing {{RTCRtpTransceiver}} object,
<var>transceiver</var>, associated with it, as described in
<span data-jsep="applying-a-remote-desc">[[!RFC8829]]</span>,
if none of the encodings in
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}
is non-empty, and not equal to the encodings that would
result from processing <var>description</var>, the
process of applying <var>description</var> fails. This
specification does not allow remotely initiated RID
renegotiation.
[=map/contain=] a {{RTCRtpCodingParameters/rid}} member
whose value matches any of the rids in the simulcast
attribute, then [= description fails | fail =] the
process of applying <var>description</var>.
<div class="note">
A change in rids values is tolerated in remote offers to
receive simulcast as long as at least one rid matches a
rid in the encodings that were previously negotiated, or
the offer is to no longer receive simulcast.
Mismatched or out-of-order rids result in layer removal,
and layer expansion is prevented in user agent answers.
This specification does not allow remotely initiated RID
renegotiation.
</div>
</p>
</li>
<li>
<p>
If the process to apply <var>description</var> fails for
If the <dfn data-lt="description fails"
id="fail-description">process to apply
<var>description</var> fails</dfn> for
any reason, then the user agent MUST queue a task that
runs the following steps:
</p>
Expand Down Expand Up @@ -2322,32 +2336,33 @@ <h4>
<li>
<p>
If the <var>description</var> is of type
{{RTCSdpType/"offer"}} and contains a request
{{RTCSdpType/"offer"}} and the
[= media description =] contains a request
to receive simulcast, use the order of the
rid values specified in the simulcast
attribute to create an
{{RTCRtpEncodingParameters}} dictionary for
each of the simulcast layers, populating the
{{RTCRtpCodingParameters/rid}} member
according to the corresponding rid value, and
let <var>sendEncodings</var> be the list
containing the created dictionaries.
Otherwise, let <var>sendEncodings</var> be an
empty list.
let <var>proposedSendEncodings</var> be the
list containing the created dictionaries.
Otherwise, let <var>proposedSendEncodings</var>
be an empty list.
</p>
</li>
<li>Let <var>supportedEncodings</var> be the
maximum number of encodings that the
implementation can support. If the length of
<var>sendEncodings</var> is greater than
<var>proposedSendEncodings</var> is greater than
<var>supportedEncodings</var>, truncate
<var>sendEncodings</var> so that its length is
<var>proposedSendEncodings</var> so that its length is
<var>supportedEncodings</var>.
</li>
<li>If <var>sendEncodings</var> is non-empty, set
each encoding's
<li>If <var>proposedSendEncodings</var> is non-empty,
set each encoding's
{{RTCRtpEncodingParameters/scaleResolutionDownBy}}
to <code>2^(length of <var>sendEncodings</var> -
to <code>2^(length of <var>proposedSendEncodings</var> -
encoding index - 1)</code>.
</li>
<li>
Expand All @@ -2363,13 +2378,25 @@ <h4>
<li>
<p>
If a suitable transceiver was found
(<var>transceiver</var> is set) and
<var>sendEncodings</var> is non-empty, set
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}
to <var>sendEncodings</var>, and set
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[LastReturnedParameters]]}}
to <code>null</code>.
(<var>transceiver</var> is set), and
<var>proposedSendEncodings</var> is non-empty,
run the following steps:
</p>
<ol>
<li class="needs-test">
<p>
If the length of
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}
is `1`, and the lone encoding
[=map/contains=] no
{{RTCRtpCodingParameters/rid}} member, set
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}
to <var>proposedSendEncodings</var>, and set
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[LastReturnedParameters]]}}
to <code>null</code>.
</p>
</li>
</ol>
</li>
<li>
<p>
Expand All @@ -2384,7 +2411,7 @@ <h4>
[= Create an RTCRtpSender =],
<var>sender</var>, from the [= media
description =] using
<var>sendEncodings</var>.
<var>proposedSendEncodings</var>.
</p>
</li>
<li data-tests=
Expand Down Expand Up @@ -2440,10 +2467,10 @@ <h4>
</li>
<li>
<p>
If <var>description</var> rejects any of
the offered layers, then remove the
dictionaries that correspond to rejected
layers from
If <var>description</var> is missing any of
the previously negototiated layers, then
remove the dictionaries that correspond to
the missing layers from
<var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}.
</p>
</li>
Expand Down