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

Handle ICE state and candidate pair changes in the same task #2444

Merged
merged 5 commits into from Jan 23, 2020
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
133 changes: 76 additions & 57 deletions webrtc.html
Expand Up @@ -8132,10 +8132,14 @@ <h3><dfn>RTCIceTransport</dfn> Interface</h3>
</li>
</ol>

<p>When the [= ICE Agent =] indicates that the
{{RTCIceTransportState}} for an
{{RTCIceTransport}} has changed, the user agent MUST queue
a task that runs the following steps:</p>
<p>The {{RTCIceTransportState}} of an {{RTCIceTransport}} may change
because a candidate pair with a usable connection was found and selected
or it may change without the selected candidate pair changing - the
selected pair and {{RTCIceTransportState}} are related and are handled in
the same task:</p>
<p>When the [= ICE Agent =] indicates that an {{RTCIceTransport}} has
changed the selected candidate pair, the {{RTCIceTransportState}} or
jan-ivar marked this conversation as resolved.
Show resolved Hide resolved
both, the user agent MUST queue a task that runs the following steps:</p>
<ol>
<li class="no-test-needed">
<p>Let <var>connection</var> be the
Expand All @@ -8151,79 +8155,94 @@ <h3><dfn>RTCIceTransport</dfn> Interface</h3>
whose state is changing.</p>
</li>
<li>
<p>Set <var>transport</var>.<a>[[\IceTransportState]]</a> to the new
indicated {{RTCIceTransportState}}.</p>
<p>Let <var>selectedCandidatePairChanged</var> be
<code>false</code>.</p>
</li>
<li>
<p>Set <var>connection</var>'s [= ICE connection state =] to the
value of deriving a new state value as described by the
{{RTCIceConnectionState}} enum.</p>
<p>Let <var>transportIceConnectionStateChanged</var> be
<code>false</code>.</p>
</li>
<li>
<p>Let <var>iceConnectionStateChanged</var> be <code>true</code> if
the <a>ice connection state</a> changed in the previous step,
otherwise <code>false</code>.</p>
<p>Let <var>connectionIceConnectionStateChanged</var> be
<code>false</code>.</p>
</li>
<li>
<p>Set <var>connection</var>'s [= connection state =] to the value of
deriving a new state value as described by the
{{RTCPeerConnectionState}} enum.</p>
<p>Let <var>connectionStateChanged</var> be <code>false</code>.</p>
</li>
<li>
<p>Let <var>connectionStateChanged</var> be <code>true</code> if
the [= connection state =] changed in the previous step, otherwise
<code>false</code>.</p>
<p>If <var>transport</var>'s selected candidate pair is changing, run
the following steps:</p>
<ol>
<li>
<p>Let <var>newCandidatePair</var> be a newly created
{{RTCIceCandidatePair}} representing the indicated pair if one is
selected, and <code>null</code> otherwise.</p>
</li>
<li data-tests="RTCIceTransport.html">
<p>Set <var>transport</var>.<a>[[\SelectedCandidatePair]]</a>
to <var>newCandidatePair</var>.</p>
</li>
<li>
<p>Set <var>selectedCandidatePairChanged</var> to
<code>true</code>.</p>
</li>
</ol>
</li>
<li>
<p>If <var>transport</var>'s {{RTCIceTransportState}} is changing, run
the following steps:</p>
<ol>
<li>
<p>Set <var>transport</var>.<a>[[\IceTransportState]]</a> to the
new indicated {{RTCIceTransportState}}.</p>
</li>
<li>
<p>Set <var>transportIceConnectionStateChanged</var> to
<code>true</code>.</p>
</li>
<li>
<p>Set <var>connection</var>'s [= ICE connection state =] to the
value of deriving a new state value as described by the
{{RTCIceConnectionState}} enum.</p>
</li>
<li>
<p>If the <a>ice connection state</a> changed in the previous
step, set <var>connectionIceConnectionStateChanged</var> to
<code>true</code>.</p>
</li>
<li>
<p>Set <var>connection</var>'s [= connection state =] to the value
of deriving a new state value as described by the
{{RTCPeerConnectionState}} enum.</p>
</li>
<li>
<p>If the [= connection state =] changed in the previous step, set
<var>connectionStateChanged</var> to <code>true</code>.</p>
</li>
</ol>
</li>
<li>
<p>[= Fire an event =] named {{statechange}} at
<p>If <var>selectedCandidatePairChanged</var> is <code>true</code>,
[= fire an event =] named {{selectedcandidatepairchange}} at
<var>transport</var>.</p>
</li>
<li>
<p>If <var>transportIceConnectionStateChanged</var> is
<code>true</code>, [= fire an event =] named {{statechange}} at
<var>transport</var>.</p>
</li>
<li data-tests="RTCIceConnectionState-candidate-pair.https.html,RTCPeerConnection-getStats.https.html,RTCPeerConnection-iceConnectionState-disconnected.https.html,RTCPeerConnection-iceConnectionState.https.html,RTCPeerConnection-track-stats.https.html">
<p>If <var>iceConnectionStateChanged</var> is <code>true</code>,
[= fire an event =] named
{{iceconnectionstatechange}} at
<var>connection</var>.</p>
<p>If <var>connectionIceConnectionStateChanged</var> is
<code>true</code>, [= fire an event =] named
{{iceconnectionstatechange}} at <var>connection</var>.</p>
</li>
<li>
<p>If <var>connectionStateChanged</var> is <code>true</code>,
[= fire an event =] named
{{connectionstatechange}} at
[= fire an event =] named {{connectionstatechange}} at
<var>connection</var>.</p>
</li>
</ol>

<p>When the [= ICE Agent =] indicates that the selected candidate pair
for an {{RTCIceTransport}} has changed, the user agent
MUST queue a task that runs the following steps:</p>
<ol>
<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>.<a>[[\IsClosed]]</a> is
<code>true</code>, abort these steps.</p>
</li>
<li class="no-test-needed">
<p>Let <var>transport</var> be the {{RTCIceTransport}}
whose selected candidate pair is changing.</p>
</li>
<li>
<p>Let <var>newCandidatePair</var> be a newly created
{{RTCIceCandidatePair}} representing the indicated
pair if one is selected, and <code>null</code> otherwise.</p>
</li>
<li data-tests="RTCIceTransport.html">
<p>Set <var>transport</var>.<a>[[\SelectedCandidatePair]]</a>
to <var>newCandidatePair</var>.</p>
</li>
<li>
<p>[= Fire an event =] named
{{selectedcandidatepairchange}} at
<var>transport</var>.</p>
</li>
</ol>
<p>An {{RTCIceTransport}} object has the following internal slots:</p>
<ul>
<li><dfn>[[\IceTransportState]]</dfn> initialized to
Expand Down