diff --git a/amendments.json b/amendments.json index 94b017e70..7ab71c073 100644 --- a/amendments.json +++ b/amendments.json @@ -734,6 +734,21 @@ "id": 36 } ], + "rtcicetransport-gathering": [ + { + "description": "Queue two tasks upon finishing ICE gathering, and fire gatheringstatechange & icegatheringstatechange in same task", + "pr": 2894, + "tests": [ + "webrtc/RTCPeerConnection-iceGatheringState.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#44687" + ], + "type": "correction", + "status": "candidate", + "id": 37 + } + ], "closing-procedure": [ { "description": "Prevent GC of non-closed RTCDataChannels", diff --git a/base-rec.html b/base-rec.html index 99d8426da..755938ad3 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11711,6 +11711,7 @@
state
will be updated accordingly, as opposed to
being represented by a new object.
+
When the ICE Agent indicates that it began gathering a generation of candidates for an
, the user
agent MUST queue a task that runs the following steps:
@@ -11826,6 +11827,7 @@ RTCIceTransport
When the ICE Agent indicates that a new ICE candidate is
available for an
, either by taking one from the
diff --git a/webrtc.html b/webrtc.html
index 5b4b11ea2..6a7b802d2 100644
--- a/webrtc.html
+++ b/webrtc.html
@@ -1611,63 +1611,6 @@ RTCIceTransport
- To update the ICE - gathering state of an {{RTCPeerConnection}} instance - connection, the user agent MUST queue a task that runs - the following steps: -
-
- If connection.{{RTCPeerConnection/[[IsClosed]]}} is
- true
, abort these steps.
-
- Let newState be the value of deriving a new state - value as described by the {{RTCIceGatheringState}} enum. -
-- If connection.{{RTCPeerConnection/[[IceGatheringState]]}} is equal - to newState, abort these steps. -
-- Set connection.{{RTCPeerConnection/[[IceGatheringState]]}} to - newState. -
-- [= Fire an event =] named {{RTCPeerConnection/icegatheringstatechange}} at - connection. -
-
- If newState is
- {{RTCIceGatheringState/"complete"}}, [= fire an event =]
- named {{RTCPeerConnection/icecandidate}} using the
- {{RTCPeerConnectionIceEvent}} interface with the candidate
- attribute set to null
at connection.
-
When the [= ICE Agent =] indicates that it began gathering a [= - generation =] of candidates for an {{RTCIceTransport}}, the user + generation =] of candidates for an {{RTCIceTransport}} transport + associated with an {{RTCPeerConnection}} connection, the user agent MUST queue a task that runs the following steps:
- Let connection be the {{RTCPeerConnection}} object
- associated with this [= ICE Agent =].
+ If connection.{{RTCPeerConnection/[[IsClosed]]}} is
+ true
, abort these steps.
- If connection.{{RTCPeerConnection/[[IsClosed]]}} is
- true
, abort these steps.
+ Set transport.{{RTCIceTransport/[[IceGathererState]]}} to
+ {{RTCIceGathererState/gathering}}.
- Let transport be the {{RTCIceTransport}} for which - candidate gathering began. + Set connection.{{RTCPeerConnection/[[IceGatheringState]]}} + to the value of deriving a new state value as described by the + {{RTCIceGatheringState}} enum.
- Set transport.{{RTCIceTransport/[[IceGathererState]]}} to
- {{RTCIceGathererState/gathering}}.
+ Let connectionIceGatheringStateChanged be
+ true
if
+ connection.{{RTCPeerConnection/[[IceGatheringState]]}}
+ changed in the previous step, otherwise false
.
Do not read or modify state beyond this point.
+[= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at transport.
- Update the ICE gathering state of connection.
+ If connectionIceGatheringStateChanged is
+ true
, [= fire an event =] named
+ {{RTCPeerConnection/icegatheringstatechange}} at connection.
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}} transport associated + with an {{RTCPeerConnection}} connection, and those candidates have been + surfaced to the application, the user agent MUST queue a task to run the following + steps:
- Let connection be the {{RTCPeerConnection}} object - associated with this [= ICE Agent =]. -
-
If connection.{{RTCPeerConnection/[[IsClosed]]}} is
true
, abort these steps.
- Let transport be the {{RTCIceTransport}} for which
- candidate gathering finished.
+ If connection.{{RTCPeerConnection/[[PendingLocalDescription]]}} is
+ not null
, and represents the ICE [= generation =]
+ for which gathering finished, add
+ `a=end-of-candidates` to
+ connection.{{RTCPeerConnection/[[PendingLocalDescription]]}}.sdp.
- Let newCandidate be the result of [= creating an
+ If connection.{{RTCPeerConnection/[[CurrentLocalDescription]]}} is
+ not null
, and represents the ICE [= generation =]
+ for which gathering finished, add
+ `a=end-of-candidates` to
+ connection.{{RTCPeerConnection/[[CurrentLocalDescription]]}}.sdp.
+
+ Let endOfGatheringCandidate 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 `""`.
[= Fire an event =] named {{RTCPeerConnection/icecandidate}} using the {{RTCPeerConnectionIceEvent}} interface with the candidate - attribute set to newCandidate at + attribute set to endOfGatheringCandidate at connection.
+ When the [= ICE Agent =] has queued the above task, and no other + [= generation | generations =] of candidates is being gathered, the user agent + MUST also queue a second task to run the following steps: +
+
- If another [= generation =] of candidates is still being
- gathered, abort these steps.
+ If connection.{{RTCPeerConnection/[[IsClosed]]}} is
+ true
, abort these steps.
@@ -12017,18 +11985,52 @@
+ Set connection.{{RTCPeerConnection/[[IceGatheringState]]}} + to the value of deriving a new state value as described by the + {{RTCIceGatheringState}} enum. +
+
+ Let connectionIceGatheringStateChanged be
+ true
if
+ connection.{{RTCPeerConnection/[[IceGatheringState]]}}
+ changed in the previous step, otherwise false
.
+
Do not read or modify state beyond this point.
+[= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at transport.
- Update the ICE gathering state of connection.
+ If connectionIceGatheringStateChanged is
+ true
, [= fire an event =] named
+ {{RTCPeerConnection/icegatheringstatechange}} at connection.
+ [= Fire an event =]
+ named {{RTCPeerConnection/icecandidate}} using the
+ {{RTCPeerConnectionIceEvent}} interface with the candidate
+ attribute set to null
at connection.
+
When the [= ICE Agent =] indicates that a new ICE candidate is available for an {{RTCIceTransport}}, either by taking one from the