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 @@

5.6 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 RTCIceTransport, the user agent MUST queue a task that runs the following steps: @@ -11826,6 +11827,7 @@

5.6

+

When the ICE Agent indicates that a new ICE candidate is available for an RTCIceTransport, 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 @@

-
-

- Update the ICE gathering state -

-

- To update the ICE - gathering state of an {{RTCPeerConnection}} instance - connection, the user agent MUST queue a task that runs - the following steps: -

-
    -
  1. -

    - If connection.{{RTCPeerConnection/[[IsClosed]]}} is - true, abort these steps. -

    -
  2. -
  3. -

    - Let newState be the value of deriving a new state - value as described by the {{RTCIceGatheringState}} enum. -

    -
  4. -
  5. -

    - If connection.{{RTCPeerConnection/[[IceGatheringState]]}} is equal - to newState, abort these steps. -

    -
  6. -
  7. -

    - Set connection.{{RTCPeerConnection/[[IceGatheringState]]}} to - newState. -

    -
  8. -
  9. -

    - [= Fire an event =] named {{RTCPeerConnection/icegatheringstatechange}} at - connection. -

    -
  10. -
  11. -

    - If newState is - {{RTCIceGatheringState/"complete"}}, [= fire an event =] - named {{RTCPeerConnection/icecandidate}} using the - {{RTCPeerConnectionIceEvent}} interface with the candidate - attribute set to null at connection. -

    -
    - The null candidate event is fired to ensure legacy - compatibility. New code should monitor the gathering state of - {{RTCIceTransport}} and/or {{RTCPeerConnection}}. -
    -
  12. -
-

Set the session description @@ -11913,103 +11856,128 @@

{{RTCIceTransport/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 {{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:

    -
  1. +
  2. - Let connection be the {{RTCPeerConnection}} object - associated with this [= ICE Agent =]. + If connection.{{RTCPeerConnection/[[IsClosed]]}} is + true, abort these steps.

  3. - If connection.{{RTCPeerConnection/[[IsClosed]]}} is - true, abort these steps. + Set transport.{{RTCIceTransport/[[IceGathererState]]}} to + {{RTCIceGathererState/gathering}}.

  4. -
  5. +
  6. - 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.

  7. - Set transport.{{RTCIceTransport/[[IceGathererState]]}} to - {{RTCIceGathererState/gathering}}. + Let connectionIceGatheringStateChanged be + true if + connection.{{RTCPeerConnection/[[IceGatheringState]]}} + changed in the previous step, otherwise false.

  8. +
  9. +

    Do not read or modify state beyond this point.

    +
  10. [= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at transport.

  11. -
  12. +
  13. - 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:

    -
  1. -

    - Let connection be the {{RTCPeerConnection}} object - associated with this [= ICE Agent =]. -

    -
  2. If connection.{{RTCPeerConnection/[[IsClosed]]}} is true, abort these steps.

  3. -
  4. +
  5. - 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.

  6. - 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. +

    +
  7. +
  8. +

    + 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 `""`.

  9. [= Fire an event =] named {{RTCPeerConnection/icecandidate}} using the {{RTCPeerConnectionIceEvent}} interface with the candidate - attribute set to newCandidate at + attribute set to endOfGatheringCandidate at connection.

  10. +
+

+ 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: +

+
+ Other [= generation | generations =] of candidates might still be gathering + if an ICE restart was initiated while the ICE agent is still gathering the + previous [= generation =] of candidates. +
+
  1. - If another [= generation =] of candidates is still being - gathered, abort these steps. + If connection.{{RTCPeerConnection/[[IsClosed]]}} is + true, abort these steps.

    -
    - This may occur if an ICE restart is initiated while the ICE agent - is still gathering the previous [= generation =] of candidates. -
  2. @@ -12017,18 +11985,52 @@

    {{RTCIceGathererState/complete}}.

  3. +
  4. +

    + Set connection.{{RTCPeerConnection/[[IceGatheringState]]}} + to the value of deriving a new state value as described by the + {{RTCIceGatheringState}} enum. +

    +
  5. +
  6. +

    + Let connectionIceGatheringStateChanged be + true if + connection.{{RTCPeerConnection/[[IceGatheringState]]}} + changed in the previous step, otherwise false. +

    +
  7. +
  8. +

    Do not read or modify state beyond this point.

    +
  9. [= Fire an event =] named {{RTCIceTransport/gatheringstatechange}} at transport.

  10. -
  11. +
  12. - Update the ICE gathering state of connection. + If connectionIceGatheringStateChanged is + true, [= fire an event =] named + {{RTCPeerConnection/icegatheringstatechange}} at connection.

  13. +
  14. +

    + [= Fire an event =] + named {{RTCPeerConnection/icecandidate}} using the + {{RTCPeerConnectionIceEvent}} interface with the candidate + attribute set to null at connection. +

    +
    + The null candidate event is fired to ensure legacy + compatibility. New code should monitor the gathering state of + {{RTCIceTransport}} and/or {{RTCPeerConnection}}. +
    +
+

When the [= ICE Agent =] indicates that a new ICE candidate is available for an {{RTCIceTransport}}, either by taking one from the