From 9499ffa650443b22946a1c788fe351f57805a007 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Tue, 6 Feb 2024 16:44:33 +0100 Subject: [PATCH 01/15] Redefine SendCodecs and ReceiveCodecs to contain all supported codecs, revealing only those that are "enabled" at any given time. Fixes: #2925 --- webrtc.html | 73 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 32 deletions(-) diff --git a/webrtc.html b/webrtc.html index bec6ff19b..7d641ad19 100644 --- a/webrtc.html +++ b/webrtc.html @@ -2246,11 +2246,13 @@

  • - Set - transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}} - to the codecs that description - negotiates for receiving and which the user - agent is currently prepared to receive. + For each of the codecs that description negotiates for receiving: +

      +
    1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}}.
    2. +
    3. If the matching codec description is not found, abort these steps.
    4. +
    5. Set the "enabled" flag in the matching codec description to "true".
    6. +
    +

    If the direction is @@ -2299,13 +2301,15 @@

  • - Set - transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}} - to the codecs that description - negotiates for sending and which the user - agent is currently capable of sending, - and set - transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[LastReturnedParameters]]}} + For each of the codecs that description negotiates for sending, execute the following steps: +

      +
    1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}}.
    2. +
    3. If the matching codec description is not found, abort these steps.
    4. +
    5. Set the "enabled" flag in the matching codec description to "true".
    6. +
    +
  • +
  • + Set transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[LastReturnedParameters]]}} to null.

  • @@ -2573,11 +2577,12 @@

  • - Set - transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}} - to the codecs that description - negotiates for receiving and which the user - agent is currently prepared to receive. + For each of the codecs that description negotiates for receiving: +

      +
    1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}}.
    2. +
    3. If the matching codec description is not found, abort these steps.
    4. +
    5. Set the "enabled" flag in the matching codec description to "true".
    6. +

  • @@ -2590,11 +2595,12 @@

    1. - Set - transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}} - to the codecs that description - negotiates for sending and which the user - agent is currently capable of sending. + For each of the codecs that description negotiates for sending: +

        +
      1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}}.
      2. +
      3. If the matching codec description is not found, abort these steps.
      4. +
      5. Set the "enabled" flag in the matching codec description to "true".
      6. +

    2. @@ -3787,8 +3793,7 @@

      transceiver.{{RTCRtpTransceiver/direction}} is {{RTCRtpTransceiverDirection/"sendonly"}} or {{RTCRtpTransceiverDirection/"sendrecv"}}, - exclude any codecs not included in the - [=RTCRtpSender/list of implemented send codecs=] for + include all codecs in the transceiver's {{RTCRtpTransceiver/[[Sender]]}}'s {{RTCRtpSender/[[SendCodecs]]}} for which the "enabled" flag is "true". kind.

    3. @@ -3798,9 +3803,7 @@

      transceiver.{{RTCRtpTransceiver/direction}} is {{RTCRtpTransceiverDirection/"recvonly"}} or {{RTCRtpTransceiverDirection/"sendrecv"}}, - exclude any codecs not included in the - [=list of implemented receive codecs=] for - kind. + include all codecs in the transceiver's {{RTCRtpTransceiver/[[Receiver]]}}'s {{RTCRtpReceiver/[[ReceiveCodecs]]}} for which the "enabled" flag is "true".

    @@ -8851,8 +8854,10 @@

  • Let sender have a [[\SendCodecs]] internal - slot, representing a list of {{RTCRtpCodecParameters}} - dictionaries, and initialized to an empty list. + slot, representing a list where each element contains an {{RTCRtpCodecParameters}} + dictionary and an "enabled" boolean, and initialized to the + [=RTCRtpSender/list of implemented send codecs=], with the "enabled" flag + set in an implementation defined manner.

  • @@ -9232,8 +9237,9 @@

  • - {{RTCRtpParameters/codecs}} is set to the value of the - {{RTCRtpSender/[[SendCodecs]]}} internal slot. + {{RTCRtpParameters/codecs}} is set to the codecs from the + {{RTCRtpSender/[[SendCodecs]]}} internal slot where the + "enabled" flag is true.
  • {{RTCRtpParameters/rtcp}}.{{RTCRtcpParameters/cname}} is @@ -10265,7 +10271,9 @@

    Let receiver have a [[\ReceiveCodecs]] internal slot, representing a list of {{RTCRtpCodecParameters}} - dictionaries, and initialized to an empty list. + dictionaries, and initialized to an list containing all the codecs in the + list of implemented receive codecs for kind, and with the "enabled" flag + set in an implementation defined manner.

  • @@ -10427,6 +10435,7 @@

  • {{RTCRtpParameters/codecs}} is set to the value of the + "enabled" codecs from the {{RTCRtpReceiver/[[ReceiveCodecs]]}} internal slot.

    From acfa8adc8ba3e15a578e5b4bd0dfafc950e33016 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Thu, 15 Feb 2024 15:41:23 +0100 Subject: [PATCH 02/15] Add 'execute the following steps' --- webrtc.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/webrtc.html b/webrtc.html index 7d641ad19..80fa469a4 100644 --- a/webrtc.html +++ b/webrtc.html @@ -2246,7 +2246,7 @@

  • - For each of the codecs that description negotiates for receiving: + For each of the codecs that description negotiates for receiving, execute the following steps:

    1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}}.
    2. If the matching codec description is not found, abort these steps.
    3. @@ -2577,7 +2577,7 @@

    4. - For each of the codecs that description negotiates for receiving: + For each of the codecs that description negotiates for receiving, execute the following steps:

      1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Receiver]]}}.{{RTCRtpReceiver/[[ReceiveCodecs]]}}.
      2. If the matching codec description is not found, abort these steps.
      3. @@ -2595,7 +2595,7 @@

        1. - For each of the codecs that description negotiates for sending: + For each of the codecs that description negotiates for sending, execute the following steps:

          1. Locate the matching codec description in transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}}.
          2. If the matching codec description is not found, abort these steps.
          3. From a02178ed656cefd50e8a98a66752df688130b402 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Sun, 18 Feb 2024 22:03:08 +0100 Subject: [PATCH 03/15] Warn about the list being conceptual --- webrtc.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/webrtc.html b/webrtc.html index 80fa469a4..7be1bae65 100644 --- a/webrtc.html +++ b/webrtc.html @@ -8973,6 +8973,15 @@

            dictionaries representing the most optimistic view of the codecs the user agent supports for sending media of the given kind (video or audio).

            +

            + This conceptual list contains every combination of parameters that + the user agent is capable of processing. In practice, this would + be implemented as a piece of code that parses the parameters and + determines whether they are acceptable or not, but this is highly + codec dependent, so for the purpose of specification, we work with + a conceptual list containing all acceptable parameter combinations. +

            +

            The list of implemented header extensions for sending, given kind, is an [=implementation-defined=] list of @@ -10387,6 +10396,14 @@

            the codecs the user agent supports for receiving media of the given kind (video or audio).

            +

            + This conceptual list contains every combination of parameters that + the user agent is capable of processing. In practice, this would + be implemented as a piece of code that parses the parameters and + determines whether they are acceptable or not, but this is highly + codec dependent, so for the purpose of specification, we work with + a conceptual list containing all acceptable parameter combinations. +

            The list of implemented header extensions for receiving, given kind, is an [=implementation-defined=] list of From 0ae0d13bf71b6fe73433a423b42d02a046fa3fb5 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Thu, 22 Feb 2024 16:25:13 +0100 Subject: [PATCH 04/15] Update webrtc.html --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index 7be1bae65..b12df3cc5 100644 --- a/webrtc.html +++ b/webrtc.html @@ -10279,7 +10279,7 @@

          4. Let receiver have a [[\ReceiveCodecs]] - internal slot, representing a list of {{RTCRtpCodecParameters}} + internal slot, representing a list of tuples, each containing a {{RTCRtpCodecParameters}} dictionaries, and initialized to an list containing all the codecs in the list of implemented receive codecs for kind, and with the "enabled" flag set in an implementation defined manner. From 7d73f7eb9b9d0b2f2a3e1711141892ca5322f7f2 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Thu, 22 Feb 2024 16:25:40 +0100 Subject: [PATCH 05/15] Update webrtc.html --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index b12df3cc5..5750c105a 100644 --- a/webrtc.html +++ b/webrtc.html @@ -8854,7 +8854,7 @@

          5. Let sender have a [[\SendCodecs]] internal - slot, representing a list where each element contains an {{RTCRtpCodecParameters}} + slot, representing a list of tuples, each containing an {{RTCRtpCodecParameters}} dictionary and an "enabled" boolean, and initialized to the [=RTCRtpSender/list of implemented send codecs=], with the "enabled" flag set in an implementation defined manner. From 46fbc87430f69b626ef3d54758e3fa39ac0f7577 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 23 Feb 2024 13:32:40 +0100 Subject: [PATCH 06/15] Link "tuple" concept --- webrtc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc.html b/webrtc.html index 5750c105a..4d7c98c51 100644 --- a/webrtc.html +++ b/webrtc.html @@ -8854,7 +8854,7 @@

          6. Let sender have a [[\SendCodecs]] internal - slot, representing a list of tuples, each containing an {{RTCRtpCodecParameters}} + slot, representing a list of [=tuple=]s, each containing an {{RTCRtpCodecParameters}} dictionary and an "enabled" boolean, and initialized to the [=RTCRtpSender/list of implemented send codecs=], with the "enabled" flag set in an implementation defined manner. @@ -10279,7 +10279,7 @@

          7. Let receiver have a [[\ReceiveCodecs]] - internal slot, representing a list of tuples, each containing a {{RTCRtpCodecParameters}} + internal slot, representing a list of [=tuple=]s, each containing a {{RTCRtpCodecParameters}} dictionaries, and initialized to an list containing all the codecs in the list of implemented receive codecs for kind, and with the "enabled" flag set in an implementation defined manner. From fd0ddb748fe0baf1210b1b6dbe5280b7aba0f3d2 Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 23 Feb 2024 13:52:11 +0100 Subject: [PATCH 07/15] Update amendments.json --- amendments.json | 16 ++++++++++++++++ webrtc.html | 2 +- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/amendments.json b/amendments.json index 841277e61..b2c95dbf6 100644 --- a/amendments.json +++ b/amendments.json @@ -310,6 +310,13 @@ "type": "correction", "status": "candidate", "id": 24 + }, + { + "description": "Redefine SendCodecs and ReceiveCodecs", + "pr": 2935, + "type": "addition", + "status": "candidate", + "id": 41 } ], "webidl-rtcrtpencodingparameters": [ @@ -549,4 +556,13 @@ "id": 40 } ] + "create-receiver-algo": [ + { + "description": "Redefine SendCodecs and ReceiveCodecs", + "pr": 2935, + "type": "addition", + "status": "candidate", + "id": 41 + } + ], } diff --git a/webrtc.html b/webrtc.html index 4d7c98c51..f5b93e658 100644 --- a/webrtc.html +++ b/webrtc.html @@ -10197,7 +10197,7 @@

            To create an RTCRtpReceiver with a string, kind, run the following steps:

            -
              +
              1. Let receiver be a new {{RTCRtpReceiver}} object. From 59c796f5915207bafe4ac541ee7f2c880cc80dce Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 23 Feb 2024 13:54:31 +0100 Subject: [PATCH 08/15] Fix commas --- amendments.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amendments.json b/amendments.json index b2c95dbf6..2aa39c49a 100644 --- a/amendments.json +++ b/amendments.json @@ -555,7 +555,7 @@ "status": "candidate", "id": 40 } - ] + ], "create-receiver-algo": [ { "description": "Redefine SendCodecs and ReceiveCodecs", @@ -564,5 +564,5 @@ "status": "candidate", "id": 41 } - ], + ] } From 988bf424cecfbddd59697185a3cab582eb42e6ec Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Tue, 28 Nov 2023 11:39:31 +0100 Subject: [PATCH 09/15] make setCodecPreferences only look at receive codecs --- webrtc.html | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/webrtc.html b/webrtc.html index f5b93e658..afccc1319 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11207,7 +11207,7 @@

                The {{setCodecPreferences}} method overrides the default - codec preferences used by the user agent. When + receive codec preferences used by the user agent. When generating a session description using either {{RTCPeerConnection/createOffer}} or {{RTCPeerConnection/createAnswer}}, the user agent @@ -11245,8 +11245,6 @@

                {{setCodecPreferences}} will reject attempts to set codecs [= codec match | not matching =] codecs found in - {{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind) - or {{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind), where kind is the kind of the {{RTCRtpTransceiver}} on which the method is called. @@ -11302,10 +11300,8 @@

              2. If the intersection between codecs and - {{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpParameters/codecs}} - or the intersection between codecs and {{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpParameters/codecs}} - only contains RTX, RED or FEC codecs or is an empty set, + only contains RTX, RED, FEC codecs or Comfort Noise codecs or is an empty set, throw {{InvalidModificationError}}. This ensures that we always have something to offer, regardless of transceiver.{{RTCRtpTransceiver/direction}}. @@ -11313,9 +11309,7 @@

              3. - Let codecCapabilities be the union of - {{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpParameters/codecs}} - and + Let codecCapabilities be {{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpParameters/codecs}}.

              4. @@ -11381,7 +11375,7 @@

              - If set, the offerer's codec preferences will decide the order + If set, the offerer's receive codec preferences will decide the order of the codecs in the offer. If the answerer does not have any codec preferences then the same order will be used in the answer. However, if the answerer also has codec preferences, From 0946871a1afd13c6e9fd386f02bb3652a3affe38 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 1 Feb 2024 13:50:32 +0100 Subject: [PATCH 10/15] try amendment --- amendments.json | 17 ++++++++++++++++- base-rec.html | 2 +- webrtc.html | 2 +- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/amendments.json b/amendments.json index 2aa39c49a..5829ad329 100644 --- a/amendments.json +++ b/amendments.json @@ -539,7 +539,7 @@ ], "dom-datachannel-binarytype-desc": [ { - "description": "Fix binaryType setter requriements", + "description": "Fix binaryType setter requirements", "pr": 2909, "type": "correction", "status": "candidate", @@ -564,5 +564,20 @@ "status": "candidate", "id": 41 } + ], + "setcodecpreferences-receive": [ + { + "description": "setCodecPreferences only takes into account receive codecs", + "pr": 2926, + "type": "correction", + "status": "candidate", + "tests": [ + "webrtc/RTCRtpTransceiver-setCodecPreferences.html" + ], + "testUpdates": [ + "web-platform-tests/wpt#44318" + ], + "id": 40 + } ] } diff --git a/base-rec.html b/base-rec.html index e22bc886b..3a793ef05 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11033,7 +11033,7 @@

            -
            +
            setCodecPreferences
            diff --git a/webrtc.html b/webrtc.html index afccc1319..231abee40 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11201,7 +11201,7 @@

          -
          +
          setCodecPreferences
          From 090c77b6895ef0ec203d767f39440ebc59cd6fe0 Mon Sep 17 00:00:00 2001 From: Dominique Hazael-Massieux Date: Thu, 1 Feb 2024 18:13:20 +0100 Subject: [PATCH 11/15] Assign id of changed markup more granularly Ensure generation of valid markup --- base-rec.html | 4 +++- webrtc.html | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/base-rec.html b/base-rec.html index 3a793ef05..4800fb3ed 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11033,10 +11033,11 @@

        -
        +
        setCodecPreferences
        +

        The setCodecPreferences method overrides the default codec preferences used by the user agent. When @@ -11101,6 +11102,7 @@

        When setCodecPreferences() in invoked, the user agent MUST run the following steps:

        +

        1. diff --git a/webrtc.html b/webrtc.html index 231abee40..55c0bf848 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11201,10 +11201,11 @@

        -
        +
        setCodecPreferences
        +

        The {{setCodecPreferences}} method overrides the default receive codec preferences used by the user agent. When @@ -11332,6 +11333,7 @@

      +

      The codec match algorithm given two {{RTCRtpCodec}} first and second is as follows: From 008968a634e7f0b034f116c45246e717e1c756d8 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Thu, 18 Jan 2024 16:14:59 +0100 Subject: [PATCH 12/15] add test coverage annotation for sdp munging fixes #2907 --- webrtc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc.html b/webrtc.html index 55c0bf848..8304893a6 100644 --- a/webrtc.html +++ b/webrtc.html @@ -4244,7 +4244,7 @@

    5. + "RTCPeerConnection-setLocalDescription-offer.html,legacy/munge-dont.html">

      If type is {{RTCSdpType/"offer"}}, and sdp is not the empty string and not @@ -4256,7 +4256,7 @@

    6. + "RTCPeerConnection-setLocalDescription-answer.html,legacy/munge-dont.html">

      If type is {{RTCSdpType/"answer"}} or {{RTCSdpType/"pranswer"}}, and sdp is From 7932c68fb163c304d907c3ac4681355588487601 Mon Sep 17 00:00:00 2001 From: Philipp Hancke Date: Tue, 20 Feb 2024 20:11:19 +0100 Subject: [PATCH 13/15] remove setCodecPreferences note already covered by JSEP fixes #2933 --- webrtc.html | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/webrtc.html b/webrtc.html index 8304893a6..947c6b27e 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11250,17 +11250,6 @@

      where kind is the kind of the {{RTCRtpTransceiver}} on which the method is called.

      -

      - Due to a recommendation in [[!SDP]], calls to - {{RTCPeerConnection/createAnswer}} SHOULD use only the common - subset of the codec preferences and the codecs that appear in - the offer. For example, if codec preferences are "C, B, A", - but only codecs "A, B" were offered, the answer should only - contain codecs "B, A". However, [[!RFC8829]] allows adding codecs that - were not in the offer, so implementations can behave - differently. -

      When {{setCodecPreferences()}} is invoked, the user agent MUST run the following steps: From 842ff68a66d7159efc330003955573d1f8e8db0c Mon Sep 17 00:00:00 2001 From: Harald Alvestrand Date: Fri, 23 Feb 2024 13:54:31 +0100 Subject: [PATCH 14/15] Fix commas --- amendments.json | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/amendments.json b/amendments.json index 5829ad329..c88d2e04b 100644 --- a/amendments.json +++ b/amendments.json @@ -579,5 +579,14 @@ ], "id": 40 } + ], + "create-receiver-algo": [ + { + "description": "Redefine SendCodecs and ReceiveCodecs", + "pr": 2935, + "type": "addition", + "status": "candidate", + "id": 41 + } ] } From c2d1b55d593cfb099331b7199327fa5dc73c35f7 Mon Sep 17 00:00:00 2001 From: Dominique Hazael-Massieux Date: Fri, 23 Feb 2024 15:14:21 +0100 Subject: [PATCH 15/15] Add id of changed section to base recommendation --- base-rec.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base-rec.html b/base-rec.html index 4800fb3ed..99d8426da 100644 --- a/base-rec.html +++ b/base-rec.html @@ -10116,7 +10116,7 @@

      5.3 To create an RTCRtpReceiver with a string, kind, run the following steps:

      -
        +
        1. Let receiver be a new RTCRtpReceiver object.