Skip to content

Commit a332dcb

Browse files
committed
Add a codec match algorithm for setCodecPreferences
Also remove impossible to implement steps in setCodecPreferences, as it's always possible to modify a dictionary. Fixes #2845.
1 parent 892d794 commit a332dcb

File tree

1 file changed

+42
-10
lines changed

1 file changed

+42
-10
lines changed

webrtc.html

Lines changed: 42 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11109,18 +11109,13 @@ <h2>
1110911109
be removed from the mapping of payload types in the SDP.
1111011110
</p>
1111111111
<p>
11112-
The <var>codecs</var> sequence passed into
11113-
{{setCodecPreferences}} can only contain codecs that are
11114-
returned by
11112+
{{setCodecPreferences}} will reject attempts to set <var>codecs</var>
11113+
[=not matching | codec match=] codecs found in
1111511114
{{RTCRtpSender}}.{{RTCRtpSender/getCapabilities}}(<var>kind</var>)
1111611115
or
1111711116
{{RTCRtpReceiver}}.{{RTCRtpReceiver/getCapabilities}}(<var>kind</var>),
1111811117
where <var>kind</var> is the kind of the
1111911118
{{RTCRtpTransceiver}} on which the method is called.
11120-
Additionally, the {{RTCRtpCodecCapability}} dictionary
11121-
members cannot be modified. If <var>codecs</var> does not
11122-
fulfill these requirements, the user agent MUST [=
11123-
exception/throw =] an {{InvalidModificationError}}.
1112411119
</p>
1112511120
<p class="note">
1112611121
Due to a recommendation in [[!SDP]], calls to
@@ -11196,9 +11191,10 @@ <h2>
1119611191
For each <var>codec</var> in <var>codecs</var>,
1119711192
</p>
1119811193
<ol>
11199-
<li>If <var>codec</var> is not in
11200-
<var>codecCapabilities</var>, throw
11201-
{{InvalidModificationError}}.
11194+
<li>
11195+
<p>If <var>codec</var> does [=not match any codec|codec match=]
11196+
in <var>codecCapabilities</var>, throw {{InvalidModificationError}}.
11197+
</p>
1120211198
</li>
1120311199
</ol>
1120411200
</li>
@@ -11209,6 +11205,42 @@ <h2>
1120911205
</p>
1121011206
</li>
1121111207
</ol>
11208+
<p>
11209+
The <dfn class="export">codec match</dfn> algorithm given two {{RTCRtpCodec}} or compatible dictionaries <var>first</var> and <var>second</var> is as follows:
11210+
</p>
11211+
<ol class=algorithm>
11212+
<li>
11213+
<p>
11214+
If <var>first</var>.{{RTCRtpCodec/mimeType}} is different from
11215+
<var>second</var>.{{RTCRtpCodec/mimeType}}, return <code>false</code>.
11216+
</p>
11217+
</li>
11218+
<li>
11219+
<p>
11220+
If <var>first</var>.{{RTCRtpCodec/clockRate}} is different from
11221+
<var>second</var>.{{RTCRtpCodec/clockRate}}, return <code>false</code>.
11222+
</p>
11223+
</li>
11224+
<li>
11225+
<p>
11226+
If <var>first</var>.{{RTCRtpCodec/channels}} and <var>second</var>.{{RTCRtpCodec/channels}}
11227+
are not both missing or if <var>first</var>.{{RTCRtpCodec/channels}} is different from
11228+
<var>second</var>.{{RTCRtpCodec/channels}}, return <code>false</code>.
11229+
</p>
11230+
</li>
11231+
<li>
11232+
<p>
11233+
If <var>first</var>.{{RTCRtpCodec/sdpFmtpLine}} and <var>second</var>.{{RTCRtpCodec/sdpFmtpLine}}
11234+
are not both missing or if <var>first</var>.{{RTCRtpCodec/sdpFmtpLine}} is different from
11235+
<var>second</var>.{{RTCRtpCodec/sdpFmtpLine}}, return <code>false</code>.
11236+
</p>
11237+
</li>
11238+
<li>
11239+
<p>
11240+
Return <code>true</code>.
11241+
</p>
11242+
</li>
11243+
</ol>
1121211244
<p class="note">
1121311245
If set, the offerer's codec preferences will decide the order
1121411246
of the codecs in the offer. If the answerer does not have any

0 commit comments

Comments
 (0)