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

Merged
merged 10 commits into from
Nov 28, 2024
Merged
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/protocol/h264-unidirectional-codec-offer.https.html"
],
"testUpdates": [
"web-platform-tests/wpt#44318"
"web-platform-tests/wpt#49421"
],
"id": 42
"id": 51
}
],
"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
101 changes: 64 additions & 37 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.
henbos marked this conversation as resolved.
Show resolved Hide resolved
</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 @@ -9051,7 +9051,9 @@ <h2>
</li>
<li id="setparameters-codec-validation-2">
<p>If <var>choosableCodecs</var> is an empty list, set <var>choosableCodecs</var>
to transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}}.</p>
to transceiver.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
and exclude any codecs not included in the
[=RTCRtpSender/list of implemented send codecs=].</p>
</li>
<li id="setparameters-codec-validation-3">
<p>If <var>choosableCodecs</var> is still an empty list, set <var>choosableCodecs</var>
Expand Down Expand Up @@ -11323,31 +11325,51 @@ <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
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}}.
codec preferences used by the <a>user agent</a> as input to
negotiation. When generating a session description using
either {{RTCPeerConnection/createOffer}} or
{{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. Even if the m= section is not used for receiving, an
answerer that does not have any codec preferences of their own
defaults to using the same order for its SDP answer.
</p>
<p class="note">
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
{{RTCRtpParameters/codecs}} by calling
{{RTCRtpSender/setParameters}} and specifying which
{{RTCRtpEncodingParameters/codec}} to send. An
{{RTCRtpReceiver}} is prepared to 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 +11384,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 +11430,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