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

Add sender/receiver.getCapabilities() algorithms (and use them in offer/answer) #2850

Merged
merged 4 commits into from
Apr 5, 2023
Merged
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
189 changes: 124 additions & 65 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -3740,38 +3740,41 @@ <h2>
<li>
<p>
The <i>codec preferences</i> of a [= media
description =]'s [= associated =] transceiver is
said to be the value of the
{{RTCRtpTransceiver}}.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
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 {{RTCRtpTransceiver/[[PreferredCodecs]]}} is empty):
to be set if
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
is empty):
</p>
<ol>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
intersection of
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}
and
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
</p>
</li>
<p>Let <var>kind</var> be <var>transceiver</var>'s
{{RTCRtpTransceiver/[[Receiver]]}}'s
{{RTCRtpReceiver/[[ReceiverTrack]]}}'s
{{MediaStreamTrack/kind}}.</p>
<li>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"sendonly"}},
exclude any codecs not included in
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
If
<var>transceiver</var>.{{RTCRtpTransceiver/direction}}
is {{RTCRtpTransceiverDirection/"sendonly"}}
or {{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
[=list of implemented send codecs=] for
<var>kind</var>.
</p>
</li>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"recvonly"}},
exclude any codecs not included in
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
If
<var>transceiver</var>.{{RTCRtpTransceiver/direction}}
is {{RTCRtpTransceiverDirection/"recvonly"}}
or {{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
[=list of implemented receive codecs=] for
<var>kind</var>.
</p>
</li>
</ol>
Expand Down Expand Up @@ -4020,38 +4023,41 @@ <h2>
<li>
<p>
The <i>codec preferences</i> of an m= section's
associated transceiver is said to be the value of
the
{{RTCRtpTransceiver}}.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
[= 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 {{RTCRtpTransceiver/[[PreferredCodecs]]}} is empty):
to be set if
<var>transceiver</var>.{{RTCRtpTransceiver/[[PreferredCodecs]]}}
is empty):
</p>
<ol>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
intersection of
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}
and
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
</p>
<p>Let <var>kind</var> be <var>transceiver</var>'s
{{RTCRtpTransceiver/[[Receiver]]}}'s
{{RTCRtpReceiver/[[ReceiverTrack]]}}'s
{{MediaStreamTrack/kind}}.</p>
</li>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"sendonly"}},
exclude any codecs not included in
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
If
<var>transceiver</var>.{{RTCRtpTransceiver/direction}}
is {{RTCRtpTransceiverDirection/"sendonly"}}
or {{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
[=list of implemented send codecs=] for
<var>kind</var>.
</p>
</li>
<li>
<p>
If the {{RTCRtpTransceiver/direction}} is
{{RTCRtpTransceiverDirection/"recvonly"}},
exclude any codecs not included in
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(kind).{{RTCRtpCapabilities/codecs}}.
If
<var>transceiver</var>.{{RTCRtpTransceiver/direction}}
is {{RTCRtpTransceiverDirection/"recvonly"}}
or {{RTCRtpTransceiverDirection/"sendrecv"}},
exclude any codecs not included in the
[=list of implemented receive codecs=] for
<var>kind</var>.
</p>
</li>
</ol>
Expand Down Expand Up @@ -8901,22 +8907,48 @@ <h2>
</dt>
<dd>
<p data-tests="RTCRtpSender-getCapabilities.html">
The {{getCapabilities()}} method returns the most optimistic
view of the capabilities of the system for sending media of
the given kind. It does not reserve any resources, ports, or
other state but is meant to provide a way to discover the
types of capabilities of the browser including which codecs
may be supported. User agents MUST support <var>kind</var>
values of <code>"audio"</code> and <code>"video"</code>. If
the system has no capabilities corresponding to the value of
the <var>kind</var> argument, {{getCapabilities}} returns
<code>null</code>.
The static {{RTCRtpSender}}.{{getCapabilities()}} method provides a way to
discover the types of capabilities the user agent supports for sending media
of the given kind, without reserving any resources, ports, or other state.
</p>
<p>
When the {{getCapabilities}} method is called, the user agent MUST run the
following steps:
</p>
<ol class=algorithm>
<li class="no-test-needed">
<p>Let <var>kind</var> be the method's first argument.</p>
</li>
<li class="no-test-needed">
<p>If <var>kind</var> is neither `"video"` nor `"audio"` return `null`.</p>
</li>
<li class="no-test-needed">
<p>Return a new {{RTCRtpCapabilities}} dictionary, with its
{{RTCRtpCapabilities/codecs}} member initialized to the
[=list of implemented send codecs=] for <var>kind</var>, and its
{{RTCRtpCapabilities/headerExtensions}} member initialized to the
[=list of implemented header extensions for sending=] with
<var>kind</var>.</p>
</li>
</ol>
<p>
The <dfn>list of implemented send codecs</dfn>, given <var>kind</var>, is
an [=implementation-defined=] list of {{RTCRtpCodecCapability}}
dictionaries representing the most optimistic view of the codecs the user
agent supports for sending media of the given <var>kind</var> (video or audio).
</p>
<p>
The <dfn>list of implemented header extensions for sending</dfn>, given
<var>kind</var>, is an [=implementation-defined=] list of
{{RTCRtpHeaderExtensionCapability}} dictionaries representing the most
optimistic view of the header extensions the user agent supports for
sending media of the given <var>kind</var> (video or audio).
</p>
<p class="fingerprint">
These capabilities provide generally persistent cross-origin
information on the device and thus increases the
fingerprinting surface of the application. In
privacy-sensitive contexts, browsers can consider mitigations
privacy-sensitive contexts, user agents MAY consider mitigations
such as reporting only a common subset of the capabilities.
</p>
<div class="note">
Expand Down Expand Up @@ -10267,22 +10299,49 @@ <h2>
</dt>
<dd>
<p data-tests="RTCRtpReceiver-getCapabilities.html">
The {{getCapabilities()}} method returns the most optimistic
view of the capabilities of the system for receiving media of
the given kind. It does not reserve any resources, ports, or
other state but is meant to provide a way to discover the
types of capabilities of the browser including which codecs
may be supported. User agents MUST support <var>kind</var>
values of <code>"audio"</code> and <code>"video"</code>. If
the system has no capabilities corresponding to the value of
the <var>kind</var> argument, {{getCapabilities}} returns
<code>null</code>.
The static {{RTCRtpReceiver}}.{{getCapabilities()}} method provides a way to
discover the types of capabilities the user agent supports for receiving media
of the given kind, without reserving any resources, ports, or other state.
</p>
<p>
When the {{getCapabilities}} method is called, the user agent MUST run the
following steps:
</p>
<ol class=algorithm>
<li class="no-test-needed">
<p>Let <var>kind</var> be the method's first argument.</p>
</li>
<li class="no-test-needed">
<p>If <var>kind</var> is neither `"video"` nor `"audio"` return `null`.</p>
</li>
<li class="no-test-needed">
<p>Return a new {{RTCRtpCapabilities}} dictionary, with its
{{RTCRtpCapabilities/codecs}} member initialized to the
[=list of implemented receive codecs=] for <var>kind</var>, and its
{{RTCRtpCapabilities/headerExtensions}} member initialized to the
[=list of implemented header extensions for receiving=] for
<var>kind</var>.</p>
</li>
</ol>
<p>
The <dfn>list of implemented receive codecs</dfn>, given <var>kind</var>, is an
[=implementation-defined=] list of
{{RTCRtpCodecCapability}} dictionaries representing the most optimistic view of
the codecs the user agent supports for receiving media of the given
<var>kind</var> (video or audio).
</p>
<p>
The <dfn>list of implemented header extensions for receiving</dfn>, given
<var>kind</var>, is an [=implementation-defined=] list of
{{RTCRtpHeaderExtensionCapability}} dictionaries representing an optimistic
view of the header extensions the user agent supports for receiving media
of the given <var>kind</var> (video or audio).
</p>
<p class="fingerprint">
These capabilities provide generally persistent cross-origin
information on the device and thus increases the
fingerprinting surface of the application. In
privacy-sensitive contexts, browsers can consider mitigations
privacy-sensitive contexts, user agents MAY consider mitigations
such as reporting only a common subset of the capabilities.
</p>
<div class="note">
Expand Down