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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions amendments.json
Original file line number Diff line number Diff line change
Expand Up @@ -1022,19 +1022,19 @@
"id": 40
}
],
"setcodecpreferences-receive": [
"setcodecpreferences-send-and-receive": [
{
"description": "setCodecPreferences only takes into account receive codecs",
"pr": 2926,
"type": "correction",
"description": "setCodecPreferences supports both send and receive codecs (filtered by direction)",
"pr": 3018,
"type": "addition",
henbos marked this conversation as resolved.
Show resolved Hide resolved
"status": "candidate",
"tests": [
"webrtc/RTCRtpTransceiver-setCodecPreferences.html"
"webrtc/RTCRtpTransceiver-setCodecPreferences-direction.html"
],
"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

],
"id": 42
"id": 50
}
],
"internalslot-jitterbuffertarget": [
Expand Down
2 changes: 1 addition & 1 deletion base-rec.html
Original file line number Diff line number Diff line change
Expand Up @@ -11036,7 +11036,7 @@ <h4 id="methods-8">
<dfn data-idl="operation" data-export="" data-dfn-type="method" id="dom-rtcrtptransceiver-setcodecpreferences" data-title="setCodecPreferences" data-dfn-for="RTCRtpTransceiver" data-type="undefined" data-lt="setCodecPreferences()|setCodecPreferences(codecs)" data-local-lt="RTCRtpTransceiver.setCodecPreferences|RTCRtpTransceiver.setCodecPreferences()|setCodecPreferences"><code>setCodecPreferences</code></dfn>
</dt>
<dd>
<div id="setcodecpreferences-receive">
<div id="setcodecpreferences-send-and-receive">
<p class="needs-tests">
The <a data-link-type="idl" href="#dom-rtcrtptransceiver-setcodecpreferences" class="internalDFN" id="ref-for-dom-rtcrtptransceiver-setcodecpreferences-4"><code><code>setCodecPreferences</code></code></a> method overrides the default
codec preferences used by the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-9">user agent</a>. When
Expand Down
90 changes: 56 additions & 34 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3727,14 +3727,11 @@ <h2>
</li>
<li>
<p>
The <i>codec preferences</i> of a [= media
description =]'s [= associated =] transceiver,
<var>transceiver</var>, is said to be the value of
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
with the following filtering applied (or said not
to be set if
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
is empty):
Let <var>filteredCodecs</var> be the result of
applying the following filter on
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}.
The filtering MUST NOT change the order of the codec
preferences:
</p>
<ol>
<li>
Expand Down Expand Up @@ -3767,8 +3764,11 @@ <h2>
</li>
henbos marked this conversation as resolved.
Show resolved Hide resolved
</ol>
<p>
The filtering MUST NOT change the order of the
codec preferences.
The <i>codec preferences</i> of a [= media
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

</p>
</li>
<li>
Expand Down Expand Up @@ -4010,14 +4010,11 @@ <h2>
<ol id="create-answer-restrictions">
<li>
<p>
The <i>codec preferences</i> of an m= section's
[= associated =] transceiver,
<var>transceiver</var>, is said to be the value of
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
with the following filtering applied (or said not
to be set if
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
is empty):
Let <var>filteredCodecs</var> be the result of
applying the following filter on
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}.
The filtering MUST NOT change the order of the
codec preferences:
</p>
<ol>
<li>
Expand Down Expand Up @@ -4050,8 +4047,11 @@ <h2>
</li>
</ol>
<p>
The filtering MUST NOT change the order of the
codec preferences.
The <i>codec preferences</i> of a [= media
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.
</p>
</li>
<li>
Expand Down Expand Up @@ -11323,31 +11323,48 @@ <h2>
<dfn data-idl="">setCodecPreferences</dfn>
</dt>
<dd>
<div id="setcodecpreferences-receive">
<div id="setcodecpreferences-send-and-receive">
<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
henbos marked this conversation as resolved.
Show resolved Hide resolved
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"

generating a session description using either
{{RTCPeerConnection/createOffer}} or
{{RTCPeerConnection/createAnswer}}, the <a>user agent</a>
MUST use the indicated codecs, in the order specified in the
<var>codecs</var> argument, for the media section
corresponding to this {{RTCRtpTransceiver}}.
{{RTCPeerConnection/createAnswer}}, the <a>user agent</a> MUST
filter the preferred codecs on {{RTCRtpTransceiver/direction}}
and, if this results in a non-empty list, it MUST use the
specified codecs in the order of the <var>codecs</var>
argument, for the media section corresponding to this
{{RTCRtpTransceiver}}.
</p>
<p>
This method allows applications to disable the negotiation of
specific codecs (including RTX/RED/FEC). It also allows an
application to cause a remote peer to prefer the codec that
appears first in the list for sending.
specific codecs (including RTX/RED/FEC) by listing all codecs
except for the ones to disable.
</p>
<p class="note">
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,

offer, but overrides this with their own codec preferences if
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

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

receive any negotiated codec.
</p>
<!-- 'until this method is called again' is not clear. Ditto for 'any default value' -->
<p class="needs-test">
Codec preferences remain in effect for all calls to
{{RTCPeerConnection/createOffer}} and
{{RTCPeerConnection/createAnswer}} that include this
{{RTCRtpTransceiver}} until this method is called again.
Setting <var>codecs</var> to an empty sequence resets codec
preferences to any default value.
Setting <var>codecs</var> to an empty sequence, or one that
becomes empty after {{RTCRtpTransceiver/direction}} filtering,
results in default codec preferences.
</p>
<p class="note">
Codecs have their payload types listed under each m= section
Expand All @@ -11362,8 +11379,11 @@ <h2>
be removed from the mapping of payload types in the SDP.
</p>
<p>
{{setCodecPreferences}} will reject attempts to set <var>codecs</var>
[= codec dictionary match | not matching =] codecs found in
{{setCodecPreferences}} will reject attempts to set
<var>codecs</var> [= codec dictionary match | not matching =]
codecs found in either
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>)
or
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(<var>kind</var>),
where <var>kind</var> is the kind of the
{{RTCRtpTransceiver}} on which the method is called.
Expand Down Expand Up @@ -11405,7 +11425,9 @@ <h2>
</li>
<li class="no-test-needed">
<p>
Let <var>codecCapabilities</var> be
Let <var>codecCapabilities</var> be the union of
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}
and
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}.
</p>
</li>
Expand Down
Loading