From e0f69a69f6a20df35fdb1ad01c2cd606a27cf862 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:13:21 +0200 Subject: [PATCH 1/9] Add candidatepairnominate event. --- index.html | 83 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 83 insertions(+) diff --git a/index.html b/index.html index 5435267..c1a18e2 100644 --- a/index.html +++ b/index.html @@ -74,6 +74,10 @@

Terminology

The terms [= event =], [= event handlers =] and [= event handler event types =] are defined in [[!HTML]].

+

+ The process of nominating a candidate pair is defined in + [[RFC8445]] Section 8.1.1. +

@@ -704,6 +708,64 @@

The {{RTCIceTransport}} interface is defined in [[WEBRTC]]. This document extends that interface to allow an application to observe and affect certain actions that an ICE agent [[RFC5245]] performs.

+

+ The [= ICE agent =] performs connectivity checks to identify valid candidate pairs on which it is possible to send and + receive media and data. In order to conclude ICE processing, the [= ICE agent =] {{nominates}} a valid candidate pair + as the selected candidate pair. Prior to nomination, any valid candidate pair may be used to exchange packets. Once a + candidate pair is nominated successfully, only the selected candidate pair may be used to exchange packets. Changing + the selected candidate pair after a successful nomination requires an ICE restart. +

+

+ When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, the [= user agent =] + MUST [= queue a task =] to nominate a candidate pair: +

+
    +
  1. +

    + Let |connection:RTCPeerConnection| be the {{RTCPeerConnection}} object associated with this [= ICE agent =]. +

    +
  2. +
  3. +

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

    +
  4. +
  5. +

    + Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this candidate pair. +

    +
  6. +
  7. +

    + Let |candidatePair:RTCIceCandidatePair| be the candidate pair which is being {{nominated}}. +

    +
  8. +
  9. +

    + Let |accepted:boolean| be the result of [= fire an event | firing an event =] named + {{RTCIceTransport/icecandidatepairnominate}} at |transport|, using {{RTCIceCandidatePairEvent}}, with the + {{Event/cancelable}} attribute initialized to true, and the {{RTCIceCandidatePairEvent/local}} and + {{RTCIceCandidatePairEvent/remote}} attributes initialized to the local and remote candidates, respectively, of + |candidatePair|. +

    +
  10. +
  11. +

    + If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and instead + to continue to perform connectivity checks. The [= ICE agent =] may exchange packets using the candidate pair + indicated by |candidatePair| unless instructed to use another candidate pair with + setSelectedCandidatePair. +

    +
  12. +
  13. +

    + Otherwise, instruct the [= ICE agent =] to {{nominate}} the candidate pair indicated by |candidatePair|. If the + nomination succeeds, |candidatePair| will become the selected candidate pair and be exclusively used for + exchanging packets. Changing the selected candidate pair will require an ICE restart. +

    +
  14. +

When the [= ICE agent =] has picked a candidate pair to remove, the [= user agent =] MUST [= queue a task =] to remove a candidate pair:

@@ -756,6 +818,7 @@

partial interface RTCIceTransport { attribute EventHandler onicecandidatepairadd; attribute EventHandler onicecandidatepairremove; + attribute EventHandler onicecandidatepairnominate; };

Attributes

@@ -785,6 +848,18 @@

Attributes

the [= user agent =] MUST run the steps to [= remove a candidate pair =].

+
+ onicecandidatepairnominate of type {{EventHandler}} +
+
+

+ The event type of this event handler is {{icecandidatepairnominate}}. +

+

+ When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, but before the + nomination takes place, the [= user agent =] MUST run the steps to [= nominate a candidate pair =]. +

+
@@ -1300,6 +1375,14 @@

Event summary

The [= ICE agent =] has picked a candidate pair to remove, and unless the operation is canceled by invoking the preventDefault() method on the event, it will be removed. + + icecandidatepairnominate + {{RTCIceCandidatePairEvent}} + + The [= ICE agent =] has picked a valid candidate pair to {{nominate}}, and unless the operation is canceled by + invoking the preventDefault() method on the event, it will be {{nominated}}. + +
From 609a8e741d8d56886377757b9379190e89695345 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Mon, 4 Sep 2023 13:58:13 +0200 Subject: [PATCH 2/9] Add setSelectedCandidatePair method. --- index.html | 130 +++++++++++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 122 insertions(+), 8 deletions(-) diff --git a/index.html b/index.html index c1a18e2..b663eb7 100644 --- a/index.html +++ b/index.html @@ -755,14 +755,104 @@

If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and instead to continue to perform connectivity checks. The [= ICE agent =] may exchange packets using the candidate pair indicated by |candidatePair| unless instructed to use another candidate pair with - setSelectedCandidatePair. + {{RTCIceTransport/setSelectedCandidatePair}}. +

+ +
  • +

    + Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= ICE + agent =] to {{nominate}} the candidate pair indicated by |candidatePair|. +

    +
  • + +

    + When the [= ICE agent =] indicates that the {{nomination}} process has concluded, the [= user agent =] MUST queue a task + that runs + the following steps: +

    +
      +
    1. +

      + Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this [= ICE agent =]. +

      +
    2. +
    3. +

      + If the nomination is successful, continue to the steps for a change in the selected candidate pair. +

      +
    4. +
    5. +

      + If the nomination fails, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to false. The selected + candidate pair has not changed in this case. +

      +
    6. +
    +

    + If the application defers the {{nomination}} of a candidate pair by cancelling the + {{RTCIceTransport/icecandidatepairnominate}} event, it may select a different candidate pair to exchange packets by + calling + {{RTCIceTransport/setSelectedCandidatePair}}. When the method is called, the [= user agent =] MUST run the steps to + change the selected candidate pair: +

    +
      +
    1. +

      + Let |connection:RTCPeerConnection| be the {{RTCPeerConnection}} object associated with this [= ICE agent =]. +

      +
    2. +
    3. +

      + If connection.{{RTCPeerConnection/[[IsClosed]]}} is + true, [= exception/throw =] an {{InvalidStateError}}. +

      +
    4. +
    5. +

      + Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this candidate pair.

    6. - Otherwise, instruct the [= ICE agent =] to {{nominate}} the candidate pair indicated by |candidatePair|. If the - nomination succeeds, |candidatePair| will become the selected candidate pair and be exclusively used for - exchanging packets. Changing the selected candidate pair will require an ICE restart. + If transport.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"controlled"}}, [= exception/throw =] a + {{NotAllowedError}}. +

      +
    7. +
    8. +

      + If transport.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"unknown"}}, [= exception/throw =] an + {{InvalidStateError}}. +

      +
    9. +
    10. +

      + If transport.{{RTCIceTransport/[[CandidatePairNominated]]}} is true, [= exception/throw =] + an {{InvalidStateError}}. +

      +
    11. +
    12. +

      + If |transport|.{{RTCIceTransport/[[IceTransportState]]}} is either of + {{RTCIceTransportState/"new"}}, {{RTCIceTransportState/"failed"}} or {{RTCIceTransportState/"closed"}}, [= exception/throw =] + an {{InvalidStateError}}. +

      +
    13. +
    14. +

      + Let |candidatePair:RTCIceCandidatePair| be the candidate pair which is being set as the selected candidate pair. +

      +
    15. +
    16. +

      + If |candidatePair| does not describe a candidate pair formed for this {{RTCIceTransport}} and sent in + {{RTCIceTransport/onicecandidatepairadd}}, [= exception/throw =] a {{NotFoundError}}. +

      +
    17. +
    18. +

      + Instruct the [= ICE agent =] to use |candidatePair| to send and receive packets, and continue to the steps for a + change in the selected candidate pair (leading up to + {{RTCIceTransport/onselectedcandidatepairchange}}).

    @@ -814,11 +904,20 @@

    +

    + The {{RTCIceTransport}} object is extended by adding the following internal slot: +

    +
           partial interface RTCIceTransport {
             attribute EventHandler onicecandidatepairadd;
             attribute EventHandler onicecandidatepairremove;
             attribute EventHandler onicecandidatepairnominate;
    +        undefined setSelectedCandidatePair(RTCIceCandidatePair candidatePair);
           };

    Attributes

    @@ -859,10 +958,25 @@

    Attributes

    When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, but before the nomination takes place, the [= user agent =] MUST run the steps to [= nominate a candidate pair =].

    - - -
    -
    + + +
    +
    +

    Methods

    +
    +
    + setSelectedCandidatePair +
    +
    +

    + The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets will be + sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] must run the + steps to [= change the selected candidate pair =]. +

    +
    +
    +
    +

    RTCIceCandidatePairEvent

    From a2c2cac1568f2d40db7a3d0b3b8e403f886f5c48 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Mon, 4 Sep 2023 16:11:35 +0200 Subject: [PATCH 3/9] Make a note of nomination after selection. --- index.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index b663eb7..c0c4844 100644 --- a/index.html +++ b/index.html @@ -717,7 +717,7 @@

    When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, the [= user agent =] - MUST [= queue a task =] to nominate a candidate pair: + MUST [= queue a task =] to nominate a candidate pair:

    1. @@ -856,6 +856,9 @@

    +

    + After changing the selected candidate pair, the [= ICE agent =] may attempt to [= nominate the candidate pair =] as well to conclude ICE processing. The application may cancel the nomination to allow further changes to the selected candidate pair. +

    When the [= ICE agent =] has picked a candidate pair to remove, the [= user agent =] MUST [= queue a task =] to remove a candidate pair:

    From 3a815e69da49570b692f8551b29382bad06b6610 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Mon, 4 Sep 2023 16:19:37 +0200 Subject: [PATCH 4/9] Only allow cancelling remove pre-nomination. --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index c0c4844..31cf078 100644 --- a/index.html +++ b/index.html @@ -886,7 +886,7 @@

  • - Let |cancelable:boolean| be true if the candidate pair is being removed in order to free an unused candidate, and false otherwise. + Let |cancelable:boolean| be true if |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} is false and the candidate pair is being removed in order to free an unused candidate, and false otherwise.

  • From 9565680d0c6dd99c0b9c77bc334a8400e5320544 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Tue, 5 Sep 2023 11:57:18 +0200 Subject: [PATCH 5/9] Fix formatting and section IDs. --- index.html | 143 +++++++++++++++++++++++++++++++---------------------- 1 file changed, 85 insertions(+), 58 deletions(-) diff --git a/index.html b/index.html index 31cf078..9a6393a 100644 --- a/index.html +++ b/index.html @@ -709,15 +709,20 @@

    application to observe and affect certain actions that an ICE agent [[RFC5245]] performs.

    - The [= ICE agent =] performs connectivity checks to identify valid candidate pairs on which it is possible to send and - receive media and data. In order to conclude ICE processing, the [= ICE agent =] {{nominates}} a valid candidate pair - as the selected candidate pair. Prior to nomination, any valid candidate pair may be used to exchange packets. Once a + The [= ICE agent =] performs connectivity checks to identify valid candidate pairs on which it is possible to send + and + receive media and data. In order to conclude ICE processing, the [= ICE agent =] {{nominates}} a valid candidate + pair + as the selected candidate pair. Prior to nomination, any valid candidate pair may be used to exchange packets. Once + a candidate pair is nominated successfully, only the selected candidate pair may be used to exchange packets. Changing the selected candidate pair after a successful nomination requires an ICE restart.

    - When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, the [= user agent =] - MUST [= queue a task =] to nominate a candidate pair: + When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, the [= user + agent =] + MUST [= queue a task =] to nominate a + candidate pair:

    1. @@ -752,21 +757,24 @@

    2. - If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and instead + If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and + instead to continue to perform connectivity checks. The [= ICE agent =] may exchange packets using the candidate pair indicated by |candidatePair| unless instructed to use another candidate pair with {{RTCIceTransport/setSelectedCandidatePair}}. -

      +

    3. - Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= ICE + Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= + ICE agent =] to {{nominate}} the candidate pair indicated by |candidatePair|.

    - When the [= ICE agent =] indicates that the {{nomination}} process has concluded, the [= user agent =] MUST queue a task + When the [= ICE agent =] indicates that the {{nomination}} process has concluded, the [= user agent =] MUST queue a + task that runs the following steps:

    @@ -826,14 +834,16 @@

  • - If transport.{{RTCIceTransport/[[CandidatePairNominated]]}} is true, [= exception/throw =] + If transport.{{RTCIceTransport/[[CandidatePairNominated]]}} is true, [= exception/throw + =] an {{InvalidStateError}}.

  • If |transport|.{{RTCIceTransport/[[IceTransportState]]}} is either of - {{RTCIceTransportState/"new"}}, {{RTCIceTransportState/"failed"}} or {{RTCIceTransportState/"closed"}}, [= exception/throw =] + {{RTCIceTransportState/"new"}}, {{RTCIceTransportState/"failed"}} or {{RTCIceTransportState/"closed"}}, [= + exception/throw =] an {{InvalidStateError}}.

  • @@ -857,10 +867,13 @@

    - After changing the selected candidate pair, the [= ICE agent =] may attempt to [= nominate the candidate pair =] as well to conclude ICE processing. The application may cancel the nomination to allow further changes to the selected candidate pair. + After changing the selected candidate pair, the [= ICE agent =] may attempt to [= nominate the candidate pair =] as + well to conclude ICE processing. The application may cancel the nomination to allow further changes to the selected + candidate pair.

    - When the [= ICE agent =] has picked a candidate pair to remove, the [= user agent =] MUST [= queue a task =] to remove a candidate pair: + When the [= ICE agent =] has picked a candidate pair to remove, the [= user agent =] MUST [= queue a task =] to remove a candidate pair:

    1. @@ -886,19 +899,25 @@

    2. - Let |cancelable:boolean| be true if |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} is false and the candidate pair is being removed in order to free an unused candidate, and false otherwise. + Let |cancelable:boolean| be true if |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} is + false and the candidate pair is being removed in order to free an unused candidate, and + false otherwise.

    3. Let |accepted:boolean| be the result of [= fire an event | firing an event =] named {{RTCIceTransport/icecandidatepairremove}} at |transport|, using {{RTCIceCandidatePairEvent}}, with the - {{Event/cancelable}} attribute initialized to cancelable, and the {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes initialized to the local and remote candidates, respectively, of |candidatePair|. + {{Event/cancelable}} attribute initialized to cancelable, and the {{RTCIceCandidatePairEvent/local}} + and {{RTCIceCandidatePairEvent/remote}} attributes initialized to the local and remote candidates, respectively, + of |candidatePair|.

    4. - If |accepted| is false, instruct the [= ICE agent =] to not remove the candidate pair indicated by |candidatePair|, and instead continue to send and respond to ICE connectivity checks on the candidate pair as before. + If |accepted| is false, instruct the [= ICE agent =] to not remove the candidate pair indicated by + |candidatePair|, and instead continue to send and respond to ICE connectivity checks on the candidate pair as + before.

    5. @@ -916,13 +935,13 @@

    6. -      partial interface RTCIceTransport {
      -        attribute EventHandler onicecandidatepairadd;
      -        attribute EventHandler onicecandidatepairremove;
      -        attribute EventHandler onicecandidatepairnominate;
      -        undefined setSelectedCandidatePair(RTCIceCandidatePair candidatePair);
      -      };
      -
      + partial interface RTCIceTransport { + attribute EventHandler onicecandidatepairadd; + attribute EventHandler onicecandidatepairremove; + attribute EventHandler onicecandidatepairnominate; + undefined setSelectedCandidatePair(RTCIceCandidatePair candidatePair); + }; +

      Attributes

      @@ -935,7 +954,8 @@

      Attributes

      When the [= ICE agent =] has formed a candidate pair, the [= user agent =] MUST queue a task to [= fire an event =] named {{icecandidatepairadd}} using the {{RTCIceCandidatePairEvent}} interface, with the - {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes set to the local and remote candidates, respectively, of the formed candidate pair. + {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes set to the local and + remote candidates, respectively, of the formed candidate pair.

      @@ -958,49 +978,54 @@

      Attributes

      The event type of this event handler is {{icecandidatepairnominate}}.

      - When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, but before the + When the [= ICE agent =] has picked a candidate pair to {{nominate}} as the selected candidate pair, but + before + the nomination takes place, the [= user agent =] MUST run the steps to [= nominate a candidate pair =].

      - -
      -
      -
      -

      Methods

      -
      -
      - setSelectedCandidatePair -
      -
      -

      - The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets will be - sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] must run the - steps to [= change the selected candidate pair =]. -

      -
      -
      -
      -
      + + +
      +
      +

      Methods

      +
      +
      + setSelectedCandidatePair +
      +
      +

      + The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets + will be + sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] must run + the + steps to [= change the selected candidate pair =]. +

      +
      +
      +
      +

      RTCIceCandidatePairEvent

      - The {{RTCIceTransport/icecandidatepairadd}} and {{RTCIceTransport/icecandidatepairremove}} events use the {{RTCIceCandidatePairEvent}} interface. + The {{RTCIceTransport/icecandidatepairadd}} and {{RTCIceTransport/icecandidatepairremove}} events use the + {{RTCIceCandidatePairEvent}} interface.

      [Exposed=Window]
      -interface RTCIceCandidatePairEvent : Event {
      -  constructor(DOMString type, RTCIceCandidatePairEventInit eventInitDict);
      -  readonly attribute RTCIceCandidate local;
      -  readonly attribute RTCIceCandidate remote;
      -};
      -
      + interface RTCIceCandidatePairEvent : Event { + constructor(DOMString type, RTCIceCandidatePairEventInit eventInitDict); + readonly attribute RTCIceCandidate local; + readonly attribute RTCIceCandidate remote; + }; +

      Constructors

      RTCIceCandidatePairEvent.constructor()
      -
      +

      Attributes

      @@ -1008,7 +1033,8 @@

      Attributes

      - The {{local}} attribute represents the local {{RTCIceCandidate}} of the candidate pair associated with the event. + The {{local}} attribute represents the local {{RTCIceCandidate}} of the candidate pair associated with the + event.

      @@ -1016,7 +1042,8 @@

      Attributes

      - The {{remote}} attribute represents the remote {{RTCIceCandidate}} of the candidate pair associated with the event. + The {{remote}} attribute represents the remote {{RTCIceCandidate}} of the candidate pair associated with + the event.

      @@ -1024,10 +1051,10 @@

      Attributes

      -dictionary RTCIceCandidatePairEventInit : EventInit {
      -  required RTCIceCandidate local;
      -  required RTCIceCandidate remote;
      -};
      + dictionary RTCIceCandidatePairEventInit : EventInit { + required RTCIceCandidate local; + required RTCIceCandidate remote; + };

      Dictionary RTCIceCandidatePairEventInit Members

      Date: Tue, 5 Sep 2023 14:41:15 +0200 Subject: [PATCH 6/9] Guard setSelected with ProposalPending slot. This avoids a race condition where an application might cause state to change from within an event handler. --- index.html | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 9a6393a..6d50e77 100644 --- a/index.html +++ b/index.html @@ -746,6 +746,11 @@

      Let |candidatePair:RTCIceCandidatePair| be the candidate pair which is being {{nominated}}.

      +
    7. +

      + Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to true. +

      +
    8. Let |accepted:boolean| be the result of [= fire an event | firing an event =] named @@ -755,6 +760,11 @@

      |candidatePair|.

    9. +
    10. +

      + Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to false. +

      +
    11. If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and @@ -820,6 +830,11 @@

      Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this candidate pair.

    12. +
    13. +

      + If |transport|.{{RTCIceTransport/[[ProposalPending]]}} is true, [= exception/throw =] an {{InvalidStateError}}. +

      +
    14. If transport.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"controlled"}}, [= exception/throw =] a @@ -904,6 +919,11 @@

      false otherwise.

    15. +
    16. +

      + Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to true. +

      +
    17. Let |accepted:boolean| be the result of [= fire an event | firing an event =] named @@ -913,6 +933,11 @@

      of |candidatePair|.

    18. +
    19. +

      + Set |transport|.{{RTCIceTransport/[[ProposalPending]]}} to false. +

      +
    20. If |accepted| is false, instruct the [= ICE agent =] to not remove the candidate pair indicated by @@ -927,11 +952,14 @@

    - The {{RTCIceTransport}} object is extended by adding the following internal slot: + The {{RTCIceTransport}} object is extended by adding the following internal slots:

    • - [[\CandidatePairNominated]] initialized to false. + [[\CandidatePairNominated]] initialized to false. +
    • +
    • + [[\ProposalPending]] initialized to false.
    @@ -996,7 +1024,7 @@ 

    Methods

    The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets will be - sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] must run + sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] MUST run the steps to [= change the selected candidate pair =].

    From cb4a936dfab29a8cfc093daeb573aa68478a0947 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Tue, 5 Sep 2023 14:53:38 +0200 Subject: [PATCH 7/9] Fix boolean literal references. --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 6d50e77..d7b227e 100644 --- a/index.html +++ b/index.html @@ -691,7 +691,7 @@

    {{RTCRtpSender}} {{RTCRtpSender/setParameters()}} modifications to existing
    • For each setParameterOptions.encodingOptions indexed by i, - if setParameterOptions.encodingOptions[i].keyFrame is set to true, + if setParameterOptions.encodingOptions[i].keyFrame is set to true, request that the encoder associated with parameters.encodings[i] generates a key frame.

    @@ -755,7 +755,7 @@

    Let |accepted:boolean| be the result of [= fire an event | firing an event =] named {{RTCIceTransport/icecandidatepairnominate}} at |transport|, using {{RTCIceCandidatePairEvent}}, with the - {{Event/cancelable}} attribute initialized to true, and the {{RTCIceCandidatePairEvent/local}} and + {{Event/cancelable}} attribute initialized to true, and the {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes initialized to the local and remote candidates, respectively, of |candidatePair|.

    @@ -776,7 +776,7 @@

  • - Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= + Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= ICE agent =] to {{nominate}} the candidate pair indicated by |candidatePair|.

    From 2778d5f4d149d9eba9d43e61a45a28681ae29607 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Wed, 6 Sep 2023 13:52:39 +0200 Subject: [PATCH 8/9] Relax the check for previous nomination on setSelected. --- index.html | 43 +++---------------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) diff --git a/index.html b/index.html index d7b227e..ba5ee4f 100644 --- a/index.html +++ b/index.html @@ -776,33 +776,7 @@

  • - Otherwise, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to true and instruct the [= - ICE - agent =] to {{nominate}} the candidate pair indicated by |candidatePair|. -

    -
  • - -

    - When the [= ICE agent =] indicates that the {{nomination}} process has concluded, the [= user agent =] MUST queue a - task - that runs - the following steps: -

    -
      -
    1. -

      - Let |transport:RTCIceTransport| be the {{RTCIceTransport}} object associated with this [= ICE agent =]. -

      -
    2. -
    3. -

      - If the nomination is successful, continue to the steps for a change in the selected candidate pair. -

      -
    4. -
    5. -

      - If the nomination fails, set |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} to false. The selected - candidate pair has not changed in this case. + Otherwise, instruct the [= ICE agent =] to {{nominate}} the candidate pair indicated by |candidatePair|.

    @@ -847,13 +821,6 @@

    {{InvalidStateError}}.

    -
  • -

    - If transport.{{RTCIceTransport/[[CandidatePairNominated]]}} is true, [= exception/throw - =] - an {{InvalidStateError}}. -

    -
  • If |transport|.{{RTCIceTransport/[[IceTransportState]]}} is either of @@ -914,8 +881,7 @@

  • - Let |cancelable:boolean| be true if |transport|.{{RTCIceTransport/[[CandidatePairNominated]]}} is - false and the candidate pair is being removed in order to free an unused candidate, and + Let |cancelable:boolean| be true if the candidate pair is being removed in order to free an unused candidate, and false otherwise.

  • @@ -952,12 +918,9 @@

    - The {{RTCIceTransport}} object is extended by adding the following internal slots: + The {{RTCIceTransport}} object is extended by adding the following internal slot:

      -
    • - [[\CandidatePairNominated]] initialized to false. -
    • [[\ProposalPending]] initialized to false.
    • From e0e07a570184761d50cd903f58b3ec4deb4acb1c Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Wed, 6 Sep 2023 14:44:11 +0200 Subject: [PATCH 9/9] Allow setSelected on the controlled side. If nomination is being deferred, either side is allowed to send on a pair of their choosing. Only nomination is the exclusive prerogative the controlling agent. --- index.html | 51 +++++++++++++++++---------------------------------- 1 file changed, 17 insertions(+), 34 deletions(-) diff --git a/index.html b/index.html index ba5ee4f..752c2dd 100644 --- a/index.html +++ b/index.html @@ -710,12 +710,11 @@

      The [= ICE agent =] performs connectivity checks to identify valid candidate pairs on which it is possible to send - and - receive media and data. In order to conclude ICE processing, the [= ICE agent =] {{nominates}} a valid candidate - pair - as the selected candidate pair. Prior to nomination, any valid candidate pair may be used to exchange packets. Once - a - candidate pair is nominated successfully, only the selected candidate pair may be used to exchange packets. Changing + and receive media and data. In order to conclude ICE processing, the [= ICE agent =] {{nominates}} a valid candidate + pair as the selected candidate pair. Prior to nomination, any valid candidate pair may be used to send and receive data. + Once + a candidate pair is nominated successfully, only the selected candidate pair will be used to send and receive data. + Changing the selected candidate pair after a successful nomination requires an ICE restart.

      @@ -767,9 +766,8 @@

    • - If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and - instead - to continue to perform connectivity checks. The [= ICE agent =] may exchange packets using the candidate pair + If |accepted| is false, instruct the [= ICE agent =] to not {{nominate}} |candidatePair|, and instead to + continue to perform connectivity checks. The [= ICE agent =] may continue to send data using the candidate pair indicated by |candidatePair| unless instructed to use another candidate pair with {{RTCIceTransport/setSelectedCandidatePair}}.

      @@ -782,10 +780,9 @@

      If the application defers the {{nomination}} of a candidate pair by cancelling the - {{RTCIceTransport/icecandidatepairnominate}} event, it may select a different candidate pair to exchange packets by - calling - {{RTCIceTransport/setSelectedCandidatePair}}. When the method is called, the [= user agent =] MUST run the steps to - change the selected candidate pair: + {{RTCIceTransport/icecandidatepairnominate}} event, it may select a different candidate pair to send data by calling + {{RTCIceTransport/setSelectedCandidatePair}}. When the method is called, the [= user agent =] MUST run the steps to change the selected candidate pair:

      1. @@ -809,18 +806,6 @@

        If |transport|.{{RTCIceTransport/[[ProposalPending]]}} is true, [= exception/throw =] an {{InvalidStateError}}.

      2. -
      3. -

        - If transport.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"controlled"}}, [= exception/throw =] a - {{NotAllowedError}}. -

        -
      4. -
      5. -

        - If transport.{{RTCIceTransport/[[IceRole]]}} is {{RTCIceRole/"unknown"}}, [= exception/throw =] an - {{InvalidStateError}}. -

        -
      6. If |transport|.{{RTCIceTransport/[[IceTransportState]]}} is either of @@ -842,14 +827,14 @@

      7. - Instruct the [= ICE agent =] to use |candidatePair| to send and receive packets, and continue to the steps for a - change in the selected candidate pair (leading up to - {{RTCIceTransport/onselectedcandidatepairchange}}). + Instruct the [= ICE agent =] to use |candidatePair| to send data, and continue to the steps for a change in the selected + candidate pair (leading up to {{RTCIceTransport/onselectedcandidatepairchange}}).

      - After changing the selected candidate pair, the [= ICE agent =] may attempt to [= nominate the candidate pair =] as + After changing the selected candidate pair, the controlling [= ICE agent =] may attempt to [= nominate the candidate + pair =] as well to conclude ICE processing. The application may cancel the nomination to allow further changes to the selected candidate pair.

      @@ -985,11 +970,9 @@

      Methods

      - The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, packets - will be - sent and received on the provided candidate pair. When this method is invoked, the [= user agent =] MUST run - the - steps to [= change the selected candidate pair =]. + The {{setSelectedCandidatePair}} method attempts to change the selected candidate pair. If successful, data will be sent + on the provided candidate pair. When this method is invoked, the [= user agent =] MUST run the steps to [= change the + selected candidate pair =].