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

Queue two tasks upon finishing ICE gathering, and fire gatheringstatechange & icegatheringstatechange in same task #2894

Merged
merged 11 commits into from
Mar 29, 2024
109 changes: 75 additions & 34 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11898,92 +11898,100 @@ <h3>
</div>
<p>
When the [= ICE Agent =] indicates that it began gathering a [=
generation =] of candidates for an {{RTCIceTransport}}, the user
generation =] of candidates for an {{RTCIceTransport}} <var>transport</var>
associated with an {{RTCPeerConnection}} <var>connection</var>, the user
agent MUST queue a task that runs the following steps:
</p>
<ol class=algorithm>
<li class="no-test-needed">
<li>
<p>
Let <var>connection</var> be the {{RTCPeerConnection}} object
associated with this [= ICE Agent =].
If <var>connection</var>.{{RTCPeerConnection/[[IsClosed]]}} is
<code>true</code>, abort these steps.
</p>
</li>
<li>
<p>
If <var>connection</var>.{{RTCPeerConnection/[[IsClosed]]}} is
<code>true</code>, abort these steps.
Set <var>transport</var>.{{RTCIceTransport/[[IceGathererState]]}} to
{{RTCIceGathererState/gathering}}.
</p>
</li>
<li class="no-test-needed">
<li>
<p>
Let <var>transport</var> be the {{RTCIceTransport}} for which
candidate gathering began.
Set <var>connection</var>.{{RTCPeerConnection/[[IceGatheringState]]}}
to the value of deriving a new state value as described by the
{{RTCIceGatheringState}} enum.
</p>
</li>
<li>
<p>
Set <var>transport</var>.{{RTCIceTransport/[[IceGathererState]]}} to
{{RTCIceGathererState/gathering}}.
Let <var>connectionIceGatheringStateChanged</var> be
<code>true</code> if
<var>connection</var>.{{RTCPeerConnection/[[IceGatheringState]]}}
changed in the previous step, otherwise <code>false</code>.
</p>
</li>
<li>
<p>Do not read or modify state beyond this point.</p>
</li>
<li>
<p>
[= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at
<var>transport</var>.
</p>
</li>
<li class="needs-test">
<li data-tests="protocol/candidate-exchange.https.html">
<p>
<a>Update the ICE gathering state</a> of <var>connection</var>.
If <var>connectionIceGatheringStateChanged</var> is
<code>true</code>, [= fire an event =] named
{{RTCPeerConnection/icegatheringstatechange}} at <var>connection</var>.
</p>
</li>
</ol>
<p>
When the [= ICE Agent =] is finished gathering a [= generation =] of
candidates for an {{RTCIceTransport}}, and those candidates have been
surfaced to the application, the user agent MUST queue a task that
runs the following steps:
candidates for an {{RTCIceTransport}} <var>transport</var> associated
with an {{RTCPeerConnection}} <var>connection</var>, and those candidates have been
surfaced to the application, the user agent MUST queue two tasks.
The first task MUST run the following steps:
</p>
<ol class=algorithm>
<li class="no-test-needed">
<p>
Let <var>connection</var> be the {{RTCPeerConnection}} object
associated with this [= ICE Agent =].
</p>
</li>
<li>
<p>
If <var>connection</var>.{{RTCPeerConnection/[[IsClosed]]}} is
<code>true</code>, abort these steps.
</p>
</li>
<li class="no-test-needed">
<p>
Let <var>transport</var> be the {{RTCIceTransport}} for which
candidate gathering finished.
</p>
</li>
<li>
<p>
Let <var>newCandidate</var> be the result of [= creating an
Let <var>endOfGatheringCandidate</var> be the result of [= creating an
RTCIceCandidate =] with a new dictionary whose
{{RTCIceCandidateInit/sdpMid}} and
{{RTCIceCandidateInit/sdpMLineIndex}} are set to the values
associated with this {{RTCIceTransport}},
{{RTCIceCandidateInit/usernameFragment}} is set to the username
fragment of the [= generation =] of candidates for which
gathering finished, and {{RTCIceCandidateInit/candidate}} is set
to an empty string.
gathering finished, and {{RTCIceCandidateInit/candidate}} is set to `""`.
</p>
</li>
<li>
<p>
[= Fire an event =] named {{RTCPeerConnection/icecandidate}} using the
{{RTCPeerConnectionIceEvent}} interface with the candidate
attribute set to <var>newCandidate</var> at
attribute set to <var>endOfGatheringCandidate</var> at
<var>connection</var>.
</p>
</li>
</ol>
<p>
The second task MUST run the following steps:
</p>
<ol class=algorithm>
<li>
<p>
If <var>connection</var>.{{RTCPeerConnection/[[IsClosed]]}} is
<code>true</code>, abort these steps.
</p>
</li>
<li>
<p>
If another [= generation =] of candidates is still being
Expand All @@ -12000,17 +12008,50 @@ <h3>
{{RTCIceGathererState/complete}}.
</p>
</li>
<li>
<p>
Set <var>connection</var>.{{RTCPeerConnection/[[IceGatheringState]]}}
to the value of deriving a new state value as described by the
{{RTCIceGatheringState}} enum.
</p>
</li>
<li>
<p>
Let <var>connectionIceGatheringStateChanged</var> be
<code>true</code> if
<var>connection</var>.{{RTCPeerConnection/[[IceGatheringState]]}}
changed in the previous step, otherwise <code>false</code>.
</p>
</li>
<li>
<p>Do not read or modify state beyond this point.</p>
</li>
<li>
<p>
[= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at
<var>transport</var>.
</p>
</li>
<li>
<li data-tests="protocol/candidate-exchange.https.html">
<p>
<a>Update the ICE gathering state</a> of <var>connection</var>.
If <var>connectionIceGatheringStateChanged</var> is
<code>true</code>, [= fire an event =] named
{{RTCPeerConnection/icegatheringstatechange}} at <var>connection</var>.
</p>
</li>
<li data-tests="RTCPeerConnection-iceGatheringState.html">
<p>
[= Fire an event =]
named {{RTCPeerConnection/icecandidate}} using the
{{RTCPeerConnectionIceEvent}} interface with the candidate
attribute set to <code>null</code> at <var>connection</var>.
</p>
<div class="note">
The null candidate event is fired to ensure legacy
compatibility. New code should monitor the gathering state of
{{RTCIceTransport}} and/or {{RTCPeerConnection}}.
</div>
</li>
</ol>
<p>
When the [= ICE Agent =] indicates that a new ICE candidate is
Expand Down