Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow level-id to be different in codec match #3023

Merged
merged 17 commits into from
Jan 9, 2025
Merged

Conversation

henbos
Copy link
Contributor

@henbos henbos commented Nov 21, 2024

Fixes #3020


Preview | Diff

@henbos henbos requested a review from aboba November 21, 2024 11:51
@henbos
Copy link
Contributor Author

henbos commented Nov 21, 2024

@aboba Does this wording make sense to you?

@fippo
Copy link
Contributor

fippo commented Nov 21, 2024

if you want to go this route you will also need to take care of RFC6184s level-asymmetry-allowed, no? All of this is reasonably well-defined in IETF specs though (well, not quite for HEVC) already

@henbos
Copy link
Contributor Author

henbos commented Nov 21, 2024

if you want to go this route you will also need to take care of RFC6184s level-asymmetry-allowed, no?

No this is just about the codec matching algorithm used to sanity check input to setParameters/setCodecPreferences, what is actually negotiated based on this is defined somewhere else.

As for sending the selected codec, the description is kind of vague, RTCRtpEncodingParmaters.codec just says:

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.

And setParameters just says:

In parallel, configure the media stack to use parameters to transmit sender.[[SenderTrack]].

So it's just "codec used for selecting what to send", we might want to create an issue about clarifying not to send greater than the level-id that was negotiated, but that seems more like an editorial note.

@henbos
Copy link
Contributor Author

henbos commented Nov 21, 2024

not to send greater than the level-id

We might want to update getParameters().encodings[i].codec to match the level-id that you find in getParamters().codecs though? Separate issue though because that is the same as what happens with setCodecPreferences() today

@henbos
Copy link
Contributor Author

henbos commented Nov 22, 2024

Codec wizard @aboba, can you do another review?

@henbos
Copy link
Contributor Author

henbos commented Nov 22, 2024

Btw I had said during the meeting that I thought all instances of "codec matching" could ignore level, but upon a second look I realized that we don't need to be that "loose" in most cases. For example if you addTransceiver, the only valid input is from getCapabilities since there is no chance that anything else has been negotiated for that transceiver yet. It might not hurt to be more loose here, but it does not seem to help either. Ultimately we only need to "ignoreLevels=true" at a few places:

  • When negotiation completes, the check to see if the codec was negotiated away and for maybe clearing setParameters's codec value, this should not remove the codec because of a level mismatch.
  • When setParameters is called, this should not throw due to level mismatch (= "Proposal A").
  • In addition I clarified that the "RTCRtpEncodingParameters.codec" picks codec based on "ignoreLevels=true" for the same reason that setParameters is supposed to work here, but this was never called out before.

In all other cases we can "ignoreLevels=false", which the PR reflects now.

Co-authored-by: Harald Alvestrand <[email protected]>
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 9, 2025
Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
aarongable pushed a commit to chromium/chromium that referenced this pull request Jan 9, 2025
Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 9, 2025
Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 9, 2025
Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}
@henbos
Copy link
Contributor Author

henbos commented Jan 9, 2025

WPTs added and PR updated with link + addressed remaining comments.

@henbos
Copy link
Contributor Author

henbos commented Jan 9, 2025

Merging based on Editors can integrate

@henbos henbos merged commit 23d37fc into w3c:main Jan 9, 2025
3 checks passed
@henbos henbos removed the Needs Test Needs a WPT test label Jan 9, 2025
@henbos
Copy link
Contributor Author

henbos commented Jan 9, 2025

Removing needs test label since tests now exist

moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jan 13, 2025
…al level-id in SDP answers., a=testonly

Automatic update from web-platform-tests
Add WPTs for negotiating H265 with minimal level-id in SDP answers.

Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}

--

wpt-commits: 545a2ed81a38330f024fac8c0b139739a7329097
wpt-pr: 49990
sadym-chromium pushed a commit to web-platform-tests/wpt that referenced this pull request Jan 14, 2025
Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jan 14, 2025
…al level-id in SDP answers., a=testonly

Automatic update from web-platform-tests
Add WPTs for negotiating H265 with minimal level-id in SDP answers.

Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1404052}

--

wpt-commits: 545a2ed81a38330f024fac8c0b139739a7329097
wpt-pr: 49990
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jan 16, 2025
…al level-id in SDP answers., a=testonly

Automatic update from web-platform-tests
Add WPTs for negotiating H265 with minimal level-id in SDP answers.

Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <dbaronchromium.org>
Commit-Queue: Henrik Boström <hboschromium.org>
Reviewed-by: Evan Shrubsole <eshrgoogle.com>
Cr-Commit-Position: refs/heads/main{#1404052}

--

wpt-commits: 545a2ed81a38330f024fac8c0b139739a7329097
wpt-pr: 49990

UltraBlame original commit: 86ca1c880fa3a95d616df4db1fae65eb4e24e60e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-comments-removed that referenced this pull request Jan 16, 2025
…al level-id in SDP answers., a=testonly

Automatic update from web-platform-tests
Add WPTs for negotiating H265 with minimal level-id in SDP answers.

Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <dbaronchromium.org>
Commit-Queue: Henrik Boström <hboschromium.org>
Reviewed-by: Evan Shrubsole <eshrgoogle.com>
Cr-Commit-Position: refs/heads/main{#1404052}

--

wpt-commits: 545a2ed81a38330f024fac8c0b139739a7329097
wpt-pr: 49990

UltraBlame original commit: 86ca1c880fa3a95d616df4db1fae65eb4e24e60e
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jan 16, 2025
…al level-id in SDP answers., a=testonly

Automatic update from web-platform-tests
Add WPTs for negotiating H265 with minimal level-id in SDP answers.

Add test coverage for w3c/webrtc-pc#3023 which
unblocks merging the PR (it has "editors can integrate"). Specifically
it should be possible to negotiate H265 even if the level-id is
downgraded in the SDP answer (not throwing on level-id mismatch).

- H265 is behind flags so a virtual test suite is added.
- If bot lacks HW capabilities to do H265, the tests will
  PRECONDITION_FAILED. To avoid reverting tests we will allow the bots
  to both pass and fail, I filed crbug.com/388299759.

Some of the tests FAIL even when they run: passing these tests will be
covered by crbug.com/381407888.

Bug: chromium:381407888, webrtc:41480904, chromium:388299759
Change-Id: Ie017560b4310418a4c9ed854dcb09136b9b446e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6148192
Reviewed-by: David Baron <dbaronchromium.org>
Commit-Queue: Henrik Boström <hboschromium.org>
Reviewed-by: Evan Shrubsole <eshrgoogle.com>
Cr-Commit-Position: refs/heads/main{#1404052}

--

wpt-commits: 545a2ed81a38330f024fac8c0b139739a7329097
wpt-pr: 49990

UltraBlame original commit: 86ca1c880fa3a95d616df4db1fae65eb4e24e60e
jrguzman-ms pushed a commit to msft-mirror-aosp/platform.external.webrtc that referenced this pull request Jan 22, 2025
This CL implements allowing sendonly codecs in setCodecPreferences(),
i.e. this spec PR: w3c/webrtc-pc#3018. It also
makes the setCodecPreferences() ignore level IDs in the filtering
algorithm (but not in the sCP method call) as per this spec PR:
w3c/webrtc-pc#3023.

In short, before this CL, setCodecPreferences() threw an exception if a
codec was preferred that is not present in receiver codec capabilities.
After this CL, setCodecPreferences() allows you to prefer codecs that
are *either* in the sender capabilities *or* the receiver capabilities.
- This allows you to "offer to send", i.e. prefer sendonly codecs on a
  sendonly transceiver.
- The filtering on direction is handled by
  RtpTransceiver::filtered_codec_preferences() which is called during
  SDP offer/answer (sdp_offer_answer.cc).

Also as per spec changes, if this filtering results in not having any
codecs to offer or answer then this results in not having any codec
preferences as opposed to throwing an exception (old behavior).
- Two old peer_connection_media_unittest.cc tests are updated to
  reflect the API failing less.

This CL adds both unit tests (rtp_transceiver_unittest.cc) and full
stack integration tests (peer_connection_encodings_integrationtest.cc).
It also makes us pass the following Web Platform Tests in Chrome:
https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/web_tests/external/wpt/webrtc/protocol/h265-level-id.https.html

Bug: chromium:381407888
Change-Id: I98a5ad1acccb56db0538e4d47975b8a725102c33
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/374520
Reviewed-by: Ilya Nikolaevskiy <[email protected]>
Commit-Queue: Henrik Boström <[email protected]>
Reviewed-by: Harald Alvestrand <[email protected]>
Reviewed-by: Evan Shrubsole <[email protected]>
Cr-Commit-Position: refs/heads/main@{#43788}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Codec negotiation and level IDs
6 participants