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

Filter codecs preferences on transceiver direction #3018

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

Conversation

henbos
Copy link
Contributor

@henbos henbos commented Nov 7, 2024

Fixes #3006.

As decided by the WG, this PR implements Proposal A at TPAC, i.e:

  • A sendonly transceiver can prefer sendonly codecs.
  • A recvonly transceiver can prefer recvonly codecs.
  • A sendrecv transceiver can only prefer codecs that we can both send and receive with. If you want to use both sendonly codecs and recvonly codecs you need to have two transceivers.

This is supported via filtering based on RTCRtpTransceiver.direction. In addition, the case where filtering results in an empty codec preferences this is treated as "no preference" as per Proposal A at Virtual Interim.


Preview | Diff

amendments.json Outdated
Comment on lines 901 to 904
"webrtc/RTCRtpTransceiver-setCodecPreferences-direction.html"
],
"testUpdates": [
"web-platform-tests/wpt#1234"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Needs updating to a real test and WPT PR, just put in a dummy value for the time being

amendments.json Outdated Show resolved Hide resolved
amendments.json Show resolved Hide resolved
@henbos henbos added the Needs Test Needs a WPT test label Nov 7, 2024
webrtc.html Show resolved Hide resolved
webrtc.html Outdated
Comment on lines 11348 to 11350
remote peer. The local peer MUST be prepared to receive any
codec that has been negotiated, even ones not first in the
list.
Copy link
Member

Choose a reason for hiding this comment

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

We should avoid competing normative language with JSEP. One way might be to put explanations in non-normative notes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed these to notes and tried to be more clear

Copy link
Contributor Author

@henbos henbos left a comment

Choose a reason for hiding this comment

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

PTAL @jan-ivar I believe I addressed your comments

webrtc.html Show resolved Hide resolved
webrtc.html Outdated
Comment on lines 11348 to 11350
remote peer. The local peer MUST be prepared to receive any
codec that has been negotiated, even ones not first in the
list.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed these to notes and tried to be more clear

webrtc.html Show resolved Hide resolved
@henbos
Copy link
Contributor Author

henbos commented Nov 14, 2024

@jan-ivar Have I addressed your feedback? If you could take a look before the editor's meeting

An RTCRtpSender defaults to sending what the remote endpoint
indicated that it prefers to receive, but the application can
change which codec to send amongst negotiated codecs in
setParameters() at any time. An RTCRtpReceiver is prepared to
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Link to "codec" specifically

they have any.
</p>
<p class="note">
An RTCRtpSender defaults to sending what the remote endpoint
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Use curly bracket links here and elsewhere

<p>
The {{setCodecPreferences}} method overrides the default
receive codec preferences used by the <a>user agent</a>. When
codec preferences used by the <a>user agent</a>. When
Copy link
Contributor Author

Choose a reason for hiding this comment

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

user agent "...as input to negotiation"

If the m= section is used for receiving, the order of the
codecs in the SDP (both the offer and the answer) tells the
remote endpoint which codec the local endpoint prefers to
receive. The answerer defaults to using the order in the SDP
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even if the m= section is not used for receiving,

],
"testUpdates": [
"web-platform-tests/wpt#44318"
"web-platform-tests/wpt#1234"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add real test before landing!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Chromium issue for adding WPTs: https://crbug.com/379551577

Copy link
Member

@jan-ivar jan-ivar left a comment

Choose a reason for hiding this comment

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

LGTM. I might add another note to cover the surprising case if the answerer receives a recvonly offer: in this case it's too late for the answerer to use setCodecPreferences to set what to send, and they need to use setParameters instead.

Copy link
Member

@dontcallmedom dontcallmedom left a comment

Choose a reason for hiding this comment

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

quoting @henbos

Add real test before landing!
(marking this as requesting changes to make sure this doesn't get overlooked)

description =]'s [= associated =] transceiver,
<var>transceiver</var>, is said to be the value of
<var>filteredCodecs</var> if non-empty and said to
be unset otherwise.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note to self there is also a reference to preferred codecs internal slots in setParameters that should be filtered on sending

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.

Align spec /w codec direction decision
3 participants