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

make setCodecPreferences only look at receive codecs #2926

Merged
merged 3 commits into from
Feb 8, 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
17 changes: 16 additions & 1 deletion amendments.json
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
],
"dom-datachannel-binarytype-desc": [
{
"description": "Fix binaryType setter requriements",
"description": "Fix binaryType setter requirements",
"pr": 2909,
"type": "correction",
"status": "candidate",
Expand All @@ -541,5 +541,20 @@
],
"id": 39
}
],
"setcodecpreferences-receive": [
{
"description": "setCodecPreferences only takes into account receive codecs",
"pr": 2926,
"type": "correction",
"status": "candidate",
"tests": [
"webrtc/RTCRtpTransceiver-setCodecPreferences.html"
],
"testUpdates": [
"web-platform-tests/wpt#44318"
],
"id": 40
}
]
}
2 changes: 2 additions & 0 deletions base-rec.html
Original file line number Diff line number Diff line change
Expand Up @@ -11037,6 +11037,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">
<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 Expand Up @@ -11101,6 +11102,7 @@ <h4 id="methods-8">
When <a data-link-type="idl" data-lt="setCodecPreferences()" href="#dom-rtcrtptransceiver-setcodecpreferences" class="internalDFN" id="ref-for-dom-rtcrtptransceiver-setcodecpreferences-6"><code><code>setCodecPreferences</code></code></a><code>()</code> in invoked, the <a href="#dfn-user-agent" class="internalDFN" data-link-type="dfn" id="ref-for-dfn-user-agent-11">user
agent</a> <em class="rfc2119">MUST</em> run the following steps:
</p>
</div>
<ol id="setcodecparameters-algorithm">
<li class="no-test-needed">
<p>
Expand Down
16 changes: 6 additions & 10 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11181,9 +11181,10 @@ <h2>
<dfn data-idl="">setCodecPreferences</dfn>
</dt>
<dd>
<div id="setcodecpreferences-receive">
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I found one more place we forgot to upate. Should we also delete this sentence?

https://w3c.github.io/webrtc-pc/#dfn-final-steps-to-create-an-answer says

If transceiver.direction is "sendonly" or "sendrecv", exclude any codecs not included in the list of implemented send codecs for kind.

Since it should be OK for pc1 to receive X and pc2 to receive Y, we shouldn't filter the preference on send codecs because that would exclude X from pc1's offer if X was a recvonly codec.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That sentence needs to stay. Until we are ready to more officially deal with answer codecs that are not in the offer which JSEP allows.

<p>
The {{setCodecPreferences}} method overrides the default
codec preferences used by the <a>user agent</a>. When
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>
Expand Down Expand Up @@ -11221,8 +11222,6 @@ <h2>
<p>
{{setCodecPreferences}} will reject attempts to set <var>codecs</var>
[= codec match | not matching =] codecs found in
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>)
or
henbos marked this conversation as resolved.
Show resolved Hide resolved
{{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 @@ -11278,20 +11277,16 @@ <h2>
<li data-tests="RTCRtpTransceiver-setCodecPreferences.html">
<p>
If the intersection between <var>codecs</var> and
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}
or the intersection between <var>codecs</var> and
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}
only contains RTX, RED or FEC codecs or is an empty set,
only contains RTX, RED, FEC codecs or Comfort Noise codecs or is an empty set,
throw {{InvalidModificationError}}. This ensures that we
always have something to offer, regardless of
<var>transceiver</var>.{{RTCRtpTransceiver/direction}}.
</p>
</li>
<li class="no-test-needed">
<p>
Let <var>codecCapabilities</var> be the union of
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}
and
Let <var>codecCapabilities</var> be
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(<var>kind</var>).{{RTCRtpParameters/codecs}}.
</p>
</li>
Expand All @@ -11314,6 +11309,7 @@ <h2>
</p>
</li>
</ol>
</div>
<div id="setcodecparameters-algorithm">
<p> The <dfn class="export">codec match</dfn> algorithm given two {{RTCRtpCodec}}
<var>first</var> and <var>second</var> is as follows:
Expand Down Expand Up @@ -11357,7 +11353,7 @@ <h2>
</ol>
</div>
<p class="note">
If set, the offerer's codec preferences will decide the order
If set, the offerer's receive codec preferences will decide the order
of the codecs in the offer. If the answerer does not have any
codec preferences then the same order will be used in the
answer. However, if the answerer also has codec preferences,
Expand Down
Loading