From c757b5f3ccc382f29959d40bf3e03e9846c72031 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 12:50:38 +0100 Subject: [PATCH 01/14] Allow level-id to be different in codec match --- webrtc.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index c91b05ccf..48c527c37 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11472,7 +11472,9 @@

and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], or if they both [=map/exist=] and first.{{RTCRtpCodec/sdpFmtpLine}} is different from second.{{RTCRtpCodec/sdpFmtpLine}}, return - false. + false. In this step, the user agent MUST consider two FMTP lines + identical if the "media format" is the same but the highest complying bitstream + levels differ.

  • From 2473be452628ec0c2626c3b62124d8f8c0529de0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 12:52:08 +0100 Subject: [PATCH 02/14] grammar --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index 48c527c37..4bd5cc342 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11474,7 +11474,7 @@

    is different from second.{{RTCRtpCodec/sdpFmtpLine}}, return false. In this step, the user agent MUST consider two FMTP lines identical if the "media format" is the same but the highest complying bitstream - levels differ. + level differs.

  • From 68f15e1684822672e98a43a96742cae010190647 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 13:00:46 +0100 Subject: [PATCH 03/14] Update amendments --- amendments.json | 10 ++++++++++ base-rec.html | 1 + webrtc.html | 2 ++ 3 files changed, 13 insertions(+) diff --git a/amendments.json b/amendments.json index 8aa3098a3..98eb97998 100644 --- a/amendments.json +++ b/amendments.json @@ -1242,5 +1242,15 @@ "web-platform-tests/wpt#48361" ] } + ], + "codec-match-without-level-id": [ + { + "description": "Two codecs are considered the same even if level-id is not", + "type": "correction", + "status": "candidate", + "difftype": "modify", + "id": 51, + "pr": 3023 + } ] } diff --git a/base-rec.html b/base-rec.html index 4c06e7f62..75c03320f 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11174,6 +11174,7 @@

    +
    Note

    If set, the offerer's codec preferences will decide the order of the codecs in the offer. If the answerer does not have any diff --git a/webrtc.html b/webrtc.html index 4bd5cc342..e869688fc 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11467,6 +11467,7 @@

  • +

    If either (but not both) of first.{{RTCRtpCodec/sdpFmtpLine}} and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], @@ -11476,6 +11477,7 @@

    identical if the "media format" is the same but the highest complying bitstream level differs.

    +

  • From d13745028e0de0a84ab2e7769273b85bd9376bed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 13:02:01 +0100 Subject: [PATCH 04/14] Not testable? --- amendments.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/amendments.json b/amendments.json index 98eb97998..40aa301fb 100644 --- a/amendments.json +++ b/amendments.json @@ -1250,7 +1250,8 @@ "status": "candidate", "difftype": "modify", "id": 51, - "pr": 3023 + "pr": 3023, + "testUpdates": "not-testable" } ] } From 0aea1b3f6fc8ca4cf437a128105e9835ae82d8d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 13:06:59 +0100 Subject: [PATCH 05/14] Trial and error --- base-rec.html | 3 +-- webrtc.html | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/base-rec.html b/base-rec.html index 75c03320f..0410df437 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11173,8 +11173,7 @@

  • -
    -
    +
    Note

    If set, the offerer's codec preferences will decide the order of the codecs in the offer. If the answerer does not have any diff --git a/webrtc.html b/webrtc.html index e869688fc..3c438c7e9 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11438,7 +11438,7 @@

    -
    +

    The codec dictionary match algorithm given two {{RTCRtpCodec}} dictionaries first and second is as follows: @@ -11467,7 +11467,6 @@

  • -

    If either (but not both) of first.{{RTCRtpCodec/sdpFmtpLine}} and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], @@ -11477,7 +11476,6 @@

    identical if the "media format" is the same but the highest complying bitstream level differs.

    -

  • From 7197ba05faa7092bc9b9245155f01f9e3a8096b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 13:10:19 +0100 Subject: [PATCH 06/14] .. --- base-rec.html | 3 ++- webrtc.html | 6 ++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/base-rec.html b/base-rec.html index 0410df437..75c03320f 100644 --- a/base-rec.html +++ b/base-rec.html @@ -11173,7 +11173,8 @@

  • -
    +
    +
    Note

    If set, the offerer's codec preferences will decide the order of the codecs in the offer. If the answerer does not have any diff --git a/webrtc.html b/webrtc.html index 3c438c7e9..b5a5992c2 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11438,11 +11438,12 @@

    -
    +

    The codec dictionary match algorithm given two {{RTCRtpCodec}} dictionaries first and second is as follows:

    +
    1. @@ -11467,6 +11468,7 @@

    2. +

      If either (but not both) of first.{{RTCRtpCodec/sdpFmtpLine}} and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], @@ -11476,6 +11478,7 @@

      identical if the "media format" is the same but the highest complying bitstream level differs.

      +

    3. @@ -11483,7 +11486,6 @@

    -

    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 From 5fb55254f99a993ee2a7b5626728e81152f8df95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 13:25:15 +0100 Subject: [PATCH 07/14] Order and default --- webrtc.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webrtc.html b/webrtc.html index b5a5992c2..0d93d92f9 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11474,8 +11474,10 @@

    and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], or if they both [=map/exist=] and first.{{RTCRtpCodec/sdpFmtpLine}} is different from second.{{RTCRtpCodec/sdpFmtpLine}}, return - false. In this step, the user agent MUST consider two FMTP lines - identical if the "media format" is the same but the highest complying bitstream + false. Two FMTP lines are the same as long as they convey the same + information, including omitting parameters with well defined defaults or using + different order. In this step, the user agent MUST consider two FMTP lines + identical if the "media format" are the same but the highest complying bitstream level differs.

    From a81bd7e75c39aae35b4403ba1e2f2e62d4f7f25d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 15:44:02 +0100 Subject: [PATCH 08/14] Rewording and grammar fix --- webrtc.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/webrtc.html b/webrtc.html index 0d93d92f9..4c9aff2c3 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11476,8 +11476,8 @@

    is different from second.{{RTCRtpCodec/sdpFmtpLine}}, return false. Two FMTP lines are the same as long as they convey the same information, including omitting parameters with well defined defaults or using - different order. In this step, the user agent MUST consider two FMTP lines - identical if the "media format" are the same but the highest complying bitstream + different order. In this step, the user agent MUST NOT consider two FMTP lines + different if "media format" is the same but the highest complying bitstream level differs.

    From 46142bdd0be339cdf6e1ffac3c60490204c1be87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 21 Nov 2024 15:44:53 +0100 Subject: [PATCH 09/14] nit --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index 4c9aff2c3..6a61491c9 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11477,7 +11477,7 @@

    false. Two FMTP lines are the same as long as they convey the same information, including omitting parameters with well defined defaults or using different order. In this step, the user agent MUST NOT consider two FMTP lines - different if "media format" is the same but the highest complying bitstream + different if "media format" is the same and only the highest complying bitstream level differs.

    From 3636bc6c4eaf31526cdeadb25f4cfc4691ece5ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Fri, 22 Nov 2024 10:34:33 +0100 Subject: [PATCH 10/14] Significant rework of PR --- webrtc.html | 83 +++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 19 deletions(-) diff --git a/webrtc.html b/webrtc.html index 6a61491c9..63f5e7c83 100644 --- a/webrtc.html +++ b/webrtc.html @@ -2818,9 +2818,9 @@

  • For each encoding in transceiver.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendEncodings]]}}, - if encoding.{{RTCRtpEncodingParameters/codec}} does not - [= codec dictionary match | match =] any entry in codecs, - [=map/remove=] encoding[{{RTCRtpEncodingParameters/codec}}].

    + if encoding.{{RTCRtpEncodingParameters/codec}} does not match any entry in + codecs, using the [= codec dictionary match =] algorithm with ignoreLevels + set to true, [=map/remove=] encoding.{{RTCRtpEncodingParameters/codec}}.

  • @@ -9084,7 +9084,8 @@

  • Any encoding in encodings [=map/exists|contains=] a codec - [= codec dictionary match | not found =] in choosableCodecs. + not found in choosableCodecs, using the [= codec dictionary match =] + algorithm with ignoreLevels set to true.
  • @@ -9789,8 +9790,16 @@

    codec of type RTCRtpCodec
    -

    Optional value selecting which codec is used for this encoding's - RTP stream. If absent, the user agent can chose to use any negotiated codec.

    +

    + Optional value selecting which codec is used for this encoding's + RTP stream. If absent, the user agent can chose to use any negotiated codec. +

    +

    + When {{codec}} is set and {{RTCRtpSender/[[SendCodecs]]}} have been negotiated, + the user agent SHOULD use the first {{RTCRtpSender/[[SendCodecs]]}} matching + {{codec}} for sending, according to the [= codec dictionary match =] algorithm + with ignoreLevels set to true. +

    @@ -11393,7 +11402,7 @@

  • - Remove any [= codec dictionary match | duplicate =] values in + Remove any [= codec dictionary match | duplicate values =] in codecs, ensuring that the first occurrence of each value remains in place.

    @@ -11439,9 +11448,11 @@

  • -

    The codec dictionary match algorithm - given two {{RTCRtpCodec}} dictionaries - first and second is as follows: +

    + The codec dictionary match algorithm given two + {{RTCRtpCodec}} dictionaries first and second, and + an ignoreLevels boolean defaulting to false if not + specified, is as follows:

      @@ -11468,19 +11479,53 @@

    1. -

      If either (but not both) of first.{{RTCRtpCodec/sdpFmtpLine}} and second.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =], - or if they both [=map/exist=] and first.{{RTCRtpCodec/sdpFmtpLine}} - is different from second.{{RTCRtpCodec/sdpFmtpLine}}, return - false. Two FMTP lines are the same as long as they convey the same - information, including omitting parameters with well defined defaults or using - different order. In this step, the user agent MUST NOT consider two FMTP lines - different if "media format" is the same and only the highest complying bitstream - level differs. + return false.

      -
      +
    2. +
    3. +

      + If both first.{{RTCRtpCodec/sdpFmtpLine}} and + second.{{RTCRtpCodec/sdpFmtpLine}} [=map/exist=], run the following + steps: +

      +
        +
      1. +

        + Let firstMediaFormat be a key-value map of the media formats constructed + from first.{{RTCRtpCodec/sdpFmtpLine}} and secondMediaFormat + be a key-value map of the media formats constructed from + second.{{RTCRtpCodec/sdpFmtpLine}}. +

        +

        + Which FMTP parameters make up the media format is codec specific. In some cases + a parameter can be omitted and still be inferred, in which case it is also a part + of the media format of that codec. +

        +
      2. +
      3. +

        + If firstMediaFormat is not equal to secondMediaFormat, return + false. +

        +
      4. +
      5. +
        +

        + If ignoreLevels is false and the highest complying bitstream + levels inferred from first.{{RTCRtpCodec/sdpFmtpLine}} and + second.{{RTCRtpCodec/sdpFmtpLine}} are different, return false. +

        +

        + Even if ignoreLevels is true, some codecs (such as H.264) have + bistream levels that are not distinct from their media formats and as such cannot be + ignored in this algorithm. +

        +
        +
      6. +
    4. From adc8a4665ef5b7d80f19094d7f33679373a5d414 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Fri, 22 Nov 2024 10:37:20 +0100 Subject: [PATCH 11/14] ... --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index 63f5e7c83..927eab2e6 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11402,7 +11402,7 @@

    5. - Remove any [= codec dictionary match | duplicate values =] in + Remove any [= codec dictionary match | duplicate =] values in codecs, ensuring that the first occurrence of each value remains in place.

      From 0cc5068913d43ce110f4e4cb66958c9cbe2c148e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Thu, 28 Nov 2024 15:36:22 +0100 Subject: [PATCH 12/14] Update wording --- amendments.json | 2 +- webrtc.html | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/amendments.json b/amendments.json index 759423345..20eb82f26 100644 --- a/amendments.json +++ b/amendments.json @@ -1249,7 +1249,7 @@ "type": "correction", "status": "candidate", "difftype": "modify", - "id": 51, + "id": 52, "pr": 3023, "testUpdates": "not-testable" } diff --git a/webrtc.html b/webrtc.html index 4029338d8..1173c7913 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11546,9 +11546,8 @@

      second.{{RTCRtpCodec/sdpFmtpLine}} are different, return false.

      - Even if ignoreLevels is true, some codecs (such as H.264) have - bistream levels that are not distinct from their media formats and as such cannot be - ignored in this algorithm. + Even if ignoreLevels is true, some codecs (such as H.264) include + levels in the media format, so that the level cannot be ignored in this algorithm.

    6. From d0e97ad8181e08e2a15f28ab79c5212bd31f8162 Mon Sep 17 00:00:00 2001 From: henbos Date: Thu, 28 Nov 2024 16:07:07 +0100 Subject: [PATCH 13/14] Update webrtc.html Co-authored-by: Harald Alvestrand --- webrtc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webrtc.html b/webrtc.html index 1173c7913..402701b88 100644 --- a/webrtc.html +++ b/webrtc.html @@ -11515,7 +11515,7 @@

    7. If both first.{{RTCRtpCodec/sdpFmtpLine}} and - second.{{RTCRtpCodec/sdpFmtpLine}} [=map/exist=], run the following + second.{{RTCRtpCodec/sdpFmtpLine}} [=map/exist=], and are in key/value format, run the following steps:

        From dc885bc50df79147b67d98d1510776ad61c3801e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Bostr=C3=B6m?= Date: Mon, 2 Dec 2024 10:59:09 +0100 Subject: [PATCH 14/14] Update filter steps --- webrtc.html | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/webrtc.html b/webrtc.html index 402701b88..454459378 100644 --- a/webrtc.html +++ b/webrtc.html @@ -3748,7 +3748,9 @@

        or {{RTCRtpTransceiverDirection/"sendrecv"}}, exclude any codecs not included in the [=RTCRtpSender/list of implemented send codecs=] for - kind. + kind, using the [= codec dictionary match =] + algorithm with ignoreLevels set to + true.

      1. @@ -3759,7 +3761,9 @@

        or {{RTCRtpTransceiverDirection/"sendrecv"}}, exclude any codecs not included in the [=list of implemented receive codecs=] for - kind. + kind, using the [= codec dictionary match =] + algorithm with ignoreLevels set to + true.

      @@ -4031,7 +4035,9 @@

      or {{RTCRtpTransceiverDirection/"sendrecv"}}, exclude any codecs not included in the [=RTCRtpSender/list of implemented send codecs=] for - kind. + kind, using the [= codec dictionary match =] + algorithm with ignoreLevels set to + true.

    8. @@ -4042,7 +4048,9 @@

      or {{RTCRtpTransceiverDirection/"sendrecv"}}, exclude any codecs not included in the [=list of implemented receive codecs=] for - kind. + kind, using the [= codec dictionary match =] + algorithm with ignoreLevels set to + true.