From 7c3a703ed66c66654dc285e7a4b38f72604ae761 Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Thu, 18 Apr 2024 15:37:06 +0200 Subject: [PATCH 1/4] Use RTCIceCandidatePair interface in RTCIceTransport. Addresses: w3c/webrtc-pc#2930. As an interface, RTCIceCandidatePair can be used as an attribute of other interfaces. So simplify RTCIceCandidatePairEvent by having a single candidatePair attribute instead of individual local and remote candidates. --- index.html | 58 +++++++++++++++++------------------------------------- 1 file changed, 18 insertions(+), 40 deletions(-) diff --git a/index.html b/index.html index ee9db06..0ed36ba 100644 --- a/index.html +++ b/index.html @@ -586,10 +586,9 @@

  • - Let |candidatePair:RTCIceCandidatePair| be a new {{RTCIceCandidatePair}} dictionary - with its {{RTCIceCandidatePair/local}} and {{RTCIceCandidatePair/remote}} members - initialized to new {{RTCIceCandidate}}s representing the local and remote part of the - [= formed =] pair respectively. + Let |candidatePair:RTCIceCandidatePair| be the result of [= creating an RTCIceCandidatePair =] with + |local:RTCIceCandidate| and |remote:RTCIceCandidate|, representing the local and remote candidates of the [= formed =] + pair respectively.

  • @@ -612,8 +611,8 @@

    [= Fire an event =] named {{RTCIceTransport/icecandidatepairadd}} at |transport|, using {{RTCIceCandidatePairEvent}}, - with the {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes - initialized to the local and remote candidates, respectively, of |candidatePair|. + with the {{RTCIceCandidatePairEvent/candidatePair}} attribute + initialized to |candidatePair|.

  • @@ -654,9 +653,8 @@

    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|. + {{Event/cancelable}} attribute initialized to true, and the {{RTCIceCandidatePairEvent/candidatePair}} attribute + initialized to |candidatePair|.

  • @@ -720,9 +718,8 @@

    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/candidatePair}} attribute + initialized to |candidatePair|.

  • @@ -972,7 +969,7 @@

    Methods

    1. - [= Fire an event =] named {{RTCIceTransport/icecandidatepairremove}} at |transport|, using {{RTCIceCandidatePairEvent}}, with the {{Event/cancelable}} attribute initialized to false, and the {{RTCIceCandidatePairEvent/local}} and {{RTCIceCandidatePairEvent/remote}} attributes initialized to the {{RTCIceCandidatePair/local}} and {{RTCIceCandidatePair/remote}} candidates, respectively, of candidatePair. + [= Fire an event =] named {{RTCIceTransport/icecandidatepairremove}} at |transport|, using {{RTCIceCandidatePairEvent}}, with the {{Event/cancelable}} attribute initialized to false, and the {{RTCIceCandidatePairEvent/candidatePair}} attribute initialized to |candidatePair|.

    2. @@ -998,15 +995,15 @@

      RTCIceCandidatePairEvent

      - The {{RTCIceTransport/icecandidatepairadd}} and {{RTCIceTransport/icecandidatepairremove}} events use the + The {{RTCIceTransport/icecandidatepairadd}}, {{RTCIceTransport/icecandidatepairnominate}} 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;
      +    readonly attribute RTCIceCandidatePair candidatePair;
         };

      Constructors

      @@ -1019,21 +1016,11 @@

      Constructors

      Attributes

      - local of type {{RTCIceCandidate}}, readonly + candidatePair of type {{RTCIceCandidatePair}}, readonly

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

      -
      -
      - remote of type {{RTCIceCandidate}}, readonly -
      -
      -

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

      @@ -1042,27 +1029,18 @@

      Attributes

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

      Dictionary RTCIceCandidatePairEventInit Members

      - local of type {{RTCIceCandidate}}, required -
      -
      -

      - The local {{RTCIceCandidate}} of the candidate pair announced by the event. -

      -
      -
      - remote of type {{RTCIceCandidate}}, required + candidatePair of type {{RTCIceCandidatePair}}, required

      - The remote {{RTCIceCandidate}} of the candidate pair announced by the event. + The candidate pair announced by the event.

      From 83d5a3c1d141b320e95766d0e67dc61cf3ecfe7c Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:08:33 +0200 Subject: [PATCH 2/4] Compare RTCIceCandidatePair identity instead of match algo. An application only acquires objects of RTCIceCandidatePair through RTCIceTransport events and getSelectedCandidatePair(). So simplify input validation where RTCIceCandidatePair is used as an argument by directly comparing object identity instead of using the candidate pair match algorithm. --- index.html | 36 ++++++------------------------------ 1 file changed, 6 insertions(+), 30 deletions(-) diff --git a/index.html b/index.html index 0ed36ba..94adcfa 100644 --- a/index.html +++ b/index.html @@ -598,8 +598,7 @@

    3. - [=Assert=]: |candidatePair| does not [= candidate pair match | match =] any - item in |transport|.{{RTCIceTransport/[[CandidatePairs]]}} + [=Assert=]: |transport|.{{RTCIceTransport/[[CandidatePairs]]}} does not [= list/contain =] |candidatePair|.

    4. @@ -851,8 +850,7 @@

      Methods

    5. - If |candidatePair| does not [= candidate pair match | match =] any item in [=this=]. - {{RTCIceTransport/[[CandidatePairs]]}}, [= exception/throw =] a {{NotFoundError}}. + If [=this=].{{RTCIceTransport/[[CandidatePairs]]}} does not [= list/contain =] |candidatePair|, [= exception/throw =] a {{NotFoundError}}.

    6. @@ -941,15 +939,13 @@

      Methods

    7. - If |candidatePair| does not [= candidate pair match | match =] any item in [=this=]. - {{RTCIceTransport/[[CandidatePairs]]}}, [= exception/throw =] a {{NotFoundError}}. + If [=this=].{{RTCIceTransport/[[CandidatePairs]]}} does not [= list/contain =] |candidatePair|, [= exception/throw =] a {{NotFoundError}}.

    8. - [= list/Remove =] the item in - [=this=].{{RTCIceTransport/[[CandidatePairs]]}} that - [= candidate pair match | matches =] |candidatePair|. + [= list/Remove =] |candidatePair| from + [=this=].{{RTCIceTransport/[[CandidatePairs]]}}.

    9. @@ -1048,7 +1044,7 @@

      Dictionary RTCIceCandidatePairEventInit Members

      - The candidate match algorithm given two {{RTCIceCandidate}} |first:RTCIceCandidate| and + The candidate match algorithm given two {{RTCIceCandidate}} |first:RTCIceCandidate| and |second:RTCIceCandidate| is as follows:

        @@ -1099,26 +1095,6 @@

        Dictionary RTCIceCandidatePairEventInit Members

      -

      - The candidate pair match algorithm given two {{RTCIceCandidatePair}} |first:RTCIceCandidatePair| and |second:RTCIceCandidatePair| is as follows: -

      -
        -
      1. -

        - If |first|.{{RTCIceCandidatePair/local}} does not [= candidate match | match =] |second|.{{RTCIceCandidatePair/local}}, return false. -

        -
      2. -
      3. -

        - If |first|.{{RTCIceCandidatePair/remote}} does not [= candidate match | match =] |second|.{{RTCIceCandidatePair/remote}}, return false. -

        -
      4. -
      5. -

        - Return true. -

        -
      6. -

      From cd26c2a88a5d082423f6a5b5f9b0f3e5ff908b7e Mon Sep 17 00:00:00 2001 From: Sameer Vijaykar <194338+sam-vi@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:28:13 +0200 Subject: [PATCH 3/4] Modify the change of selected pair algo in RTCIceTransport. This ensures that each candidate pair has a unique identity, simplifying the validation of RTCIceCandidatePair arguments to RTCIceTransport methods. --- index.html | 115 +++++++++++++++++++++++++++++------------------------ 1 file changed, 63 insertions(+), 52 deletions(-) diff --git a/index.html b/index.html index 94adcfa..e8cbd34 100644 --- a/index.html +++ b/index.html @@ -1043,58 +1043,69 @@

      Dictionary RTCIceCandidatePairEventInit Members

      -

      - The candidate match algorithm given two {{RTCIceCandidate}} |first:RTCIceCandidate| and - |second:RTCIceCandidate| is as follows: -

      -
        -
      1. -

        - If |first|.{{RTCIceCandidate/candidate}} is not [= string/identical to =] |second|.{{RTCIceCandidate/candidate}}, return false. -

        -
      2. -
      3. -

        - If either (but not both) of |first|.{{RTCIceCandidate/sdpMid}} and |second|.{{RTCIceCandidate/sdpMid}} is - null, return false. -

        -
      4. -
      5. -

        - If neither of |first|.{{RTCIceCandidate/sdpMid}} and |second|.{{RTCIceCandidate/sdpMid}} is null, and |first|.{{RTCIceCandidate/sdpMid}} is not [= string/identical to =] - |second|.{{RTCIceCandidate/sdpMid}}, return false. -

        -
      6. -
      7. -

        - If either (but not both) of |first|.{{RTCIceCandidate/sdpMLineIndex}} and |second|.{{RTCIceCandidate/sdpMLineIndex}} is - null, return false. -

        -
      8. -
      9. -

        - If neither of |first|.{{RTCIceCandidate/sdpMLineIndex}} and |second|.{{RTCIceCandidate/sdpMLineIndex}} is null and |first|.{{RTCIceCandidate/sdpMLineIndex}} is not equal to - |second|.{{RTCIceCandidate/sdpMLineIndex}}, return false. -

        -
      10. -
      11. -

        - If either (but not both) of |first|.{{RTCIceCandidate/usernameFragment}} and |second|.{{RTCIceCandidate/usernameFragment}} is - null, return false. -

        -
      12. -
      13. -

        - If neither of |first|.{{RTCIceCandidate/usernameFragment}} and |second|.{{RTCIceCandidate/usernameFragment}} is null and |first|.{{RTCIceCandidate/usernameFragment}} is not [= string/identical to =] - |second|.{{RTCIceCandidate/usernameFragment}}, return false. -

        -
      14. -
      15. -

        - Return true. -

        -
      16. -
      +
      +

      Modifications to existing procedures

      +

      + In the steps to [=RTCIceTransport/change the selected candidate pair and state=], if the selected candidate pair was changed, modify the first step to the following: +

      +
        +
      1. + Let newCandidatePair be the [= list/item =] [= list/contained =] in |this|.{{RTCIceTransport/[[CandidatePairs]]}} whose {{RTCIceCandidatePair/local}} and {{RTCIceCandidatePair/remote}} attributes respectively [= candidate match | match =] the local and remote candidates of the indicated pair if one is selected, and null otherwise. +
      2. +
      +

      + The candidate match algorithm given two {{RTCIceCandidate}} |first:RTCIceCandidate| and + |second:RTCIceCandidate| is as follows: +

      +
        +
      1. +

        + If |first|.{{RTCIceCandidate/candidate}} is not [= string/identical to =] |second|.{{RTCIceCandidate/candidate}}, return false. +

        +
      2. +
      3. +

        + If either (but not both) of |first|.{{RTCIceCandidate/sdpMid}} and |second|.{{RTCIceCandidate/sdpMid}} is + null, return false. +

        +
      4. +
      5. +

        + If neither of |first|.{{RTCIceCandidate/sdpMid}} and |second|.{{RTCIceCandidate/sdpMid}} is null, and |first|.{{RTCIceCandidate/sdpMid}} is not [= string/identical to =] + |second|.{{RTCIceCandidate/sdpMid}}, return false. +

        +
      6. +
      7. +

        + If either (but not both) of |first|.{{RTCIceCandidate/sdpMLineIndex}} and |second|.{{RTCIceCandidate/sdpMLineIndex}} is + null, return false. +

        +
      8. +
      9. +

        + If neither of |first|.{{RTCIceCandidate/sdpMLineIndex}} and |second|.{{RTCIceCandidate/sdpMLineIndex}} is null and |first|.{{RTCIceCandidate/sdpMLineIndex}} is not equal to + |second|.{{RTCIceCandidate/sdpMLineIndex}}, return false. +

        +
      10. +
      11. +

        + If either (but not both) of |first|.{{RTCIceCandidate/usernameFragment}} and |second|.{{RTCIceCandidate/usernameFragment}} is + null, return false. +

        +
      12. +
      13. +

        + If neither of |first|.{{RTCIceCandidate/usernameFragment}} and |second|.{{RTCIceCandidate/usernameFragment}} is null and |first|.{{RTCIceCandidate/usernameFragment}} is not [= string/identical to =] + |second|.{{RTCIceCandidate/usernameFragment}}, return false. +

        +
      14. +
      15. +

        + Return true. +

        +
      16. +
      +

      From 56a6071e3f2a2cd97b4399638d28b665e9e64c30 Mon Sep 17 00:00:00 2001 From: Dominique Hazael-Massieux Date: Tue, 15 Oct 2024 13:25:38 +0200 Subject: [PATCH 4/4] Fix markup typo (unrelated to this PR) --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index e8cbd34..46cca09 100644 --- a/index.html +++ b/index.html @@ -457,7 +457,6 @@

      Dictionary {{RTCResolutionRestriction}} Members

      restrictions are orientation agnostic, see note below. When scaling is applied, both dimensions of the frame MUST be downscaled using the same factor.

      -

      The restrictions being orientation agnostic means that they will automatically be adjusted to the orientation of the frame being @@ -466,6 +465,7 @@

      Dictionary {{RTCResolutionRestriction}} Members

      720x1280 is specified, both always result in the exact same scaling factor regardless of the orientation of the frame.

      +