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

Separate Send/ReceiveCodecs and NegotiatedCodecs #2972

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

alvestrand
Copy link
Contributor

@alvestrand alvestrand commented May 8, 2024

This makes it unambiguous what to return in RTCRtpSender/Receiver's getParameters() function (null before negotiation, filled in after, which corresponds to implementations).

Fixes #2956


Preview | Diff

This makes it unambiguous what to return in RTCRtpSender/Receiver's
getParameters() function (null before negotiation, filled in after)

Fixes: 2956
@alvestrand alvestrand requested a review from jan-ivar May 8, 2024 10:40
Set NegotiatedCodecs only on answers for both senders and receivers.
webrtc.html Outdated Show resolved Hide resolved
Comment on lines 2233 to +2236
<li>Locate the matching codec description in <var>transceiver</var>.{{RTCRtpTransceiver/[[Sender]]}}.{{RTCRtpSender/[[SendCodecs]]}}.</li>
<li>If the matching codec description is not found, abort these steps.</li>
<li>Set the "enabled" flag in the matching codec description to "true".</li>
<li>Add the codec description to the sender's {{RTCRtpSender/[[NegotiatedCodecs]]}} internal slot.</li>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This puts tuples in [[NegotiatedCodecs]], which while expedient, seems a bit confusing since they'll always have "enabled" true. Is this on purpose?

Also since these are internal objects kept in lists in internal slots, these entries are added by reference, so if we ever introduce code that sets an enabled flag to false, it would affect both [[SendCodecs]] and [[NegotiatedCodecs]] potentially causing the codec entry to disappear from getParameters(). Is this desirable?

Even if desirable, this behavior seems a bit hard to grasp from this prose.

The other thing I noticed is that payloadType isn't filled in.

While [[SendCodecs]] is "a list of tuples, each containing an RTCRtpCodecParameters dictionary and an "enabled" boolean" it's actually initialized to "an implementation-defined list of RTCRtpCodecCapability dictionaries"

Spot the different dictionary types above. RTCRtpCodecParameters != RTCRtpCodecCapability

The former contains payloadType, the latter doesn't. So it needs to be filled in here I think.

It might be good to use language shown in https://infra.spec.whatwg.org/#example-tuple to be more precise. This includes declaring the tuple where it's created with member names like codec and enabled, and "Let entry be ..." etc.

This would let us be more precise and be clear whether we want to put the tuples in [[NegotiatedCodecs]] or simply the entry.codec.

Copy link
Contributor Author

@alvestrand alvestrand May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The intent of "negotiatedCodecs" is to reflect the currently negotiated codecs. The "enabled" flag has no purpose there, so it's not carried along.
Good point about using RTCRtpCodecParameters and filling in the PT field - this accentuates the need for it being a copy not a reference.

Copy link
Contributor Author

@alvestrand alvestrand May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually RTCRtpCodecCapability is a dictionary with no extra members over RTCRtpCodec. We shouldn't be using it. It is RTCRtpCodecParameters that contains the PT.

@@ -8800,6 +8806,9 @@ <h3>
[=RTCRtpSender/list of implemented send codecs=], with the "enabled" flag
set in an implementation defined manner.
</p>
<p>
Let <var>sender</var> have a <dfn data-dfn-for="RTCRtpSender">[[\NegotiatedCodecs]]</dfn> internal slot, consisting of {{RTCRtpCodecParameters}}, and initialized to an empty list.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, this says [[NegotiatedCodecs]] contains RTCRtpCodecParameters, not tuples. Good, but means the code above needs to be fixed to not add tuples.

Copy link
Contributor Author

@alvestrand alvestrand May 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or rather ... construct an RTCRtpCodecParameters from the RTCRtpCodec and add the PT from the description.

chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2024
In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
aarongable pushed a commit to chromium/chromium that referenced this pull request Jun 20, 2024
In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2024
In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}
chromium-wpt-export-bot pushed a commit to web-platform-tests/wpt that referenced this pull request Jun 20, 2024
In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}
amendments.json Outdated Show resolved Hide resolved
moz-v2v-gh pushed a commit to mozilla/gecko-dev that referenced this pull request Jun 24, 2024
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840
i3roly pushed a commit to i3roly/firefox-dynasty that referenced this pull request Jun 25, 2024
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840
jamienicol pushed a commit to jamienicol/gecko that referenced this pull request Jun 27, 2024
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <hta@chromium.org>
Reviewed-by: Florent Castelli <orphis@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified-and-comments-removed that referenced this pull request Jul 1, 2024
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <htachromium.org>
Reviewed-by: Florent Castelli <orphischromium.org>
Cr-Commit-Position: refs/heads/main{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840

UltraBlame original commit: b98fa37e2e0425dbfe0f272d58e1c9e0486ec712
gecko-dev-updater pushed a commit to marco-c/gecko-dev-wordified that referenced this pull request Jul 1, 2024
…the right time., a=testonly

Automatic update from web-platform-tests
Add tests for if codec info surfaces at the right time.

In support of landing this spec PR:
w3c/webrtc-pc#2972

Bug: None
Change-Id: I698276ccf739a872d791fc0923c2725ec303fbd3
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5642762
Commit-Queue: Harald Alvestrand <htachromium.org>
Reviewed-by: Florent Castelli <orphischromium.org>
Cr-Commit-Position: refs/heads/main{#1317347}

--

wpt-commits: 4d7ec06c827c841bfe9090a92521de6a2fb265cf
wpt-pr: 46840

UltraBlame original commit: b98fa37e2e0425dbfe0f272d58e1c9e0486ec712
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.

receiver.getParameters().codecs is broken (regression)
3 participants