Skip to content

Commit

Permalink
Add a codec match algorithm for setCodecPreferences
Browse files Browse the repository at this point in the history
Also remove impossible to implement steps in setCodecPreferences,
as it's always possible to modify a dictionary.

Fixes #2845.
  • Loading branch information
Orphis committed Mar 27, 2023
1 parent 892d794 commit 8ddd49c
Showing 1 changed file with 34 additions and 8 deletions.
42 changes: 34 additions & 8 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11110,17 +11110,14 @@ <h2>
</p>
<p>
The <var>codecs</var> sequence passed into
{{setCodecPreferences}} can only contain codecs that are
returned by
{{setCodecPreferences}} can only contain
{{RTCRtpCodec}} values that match values using the [= codec match =]
algorithm that are returned by
{{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.
Additionally, the {{RTCRtpCodecCapability}} dictionary
members cannot be modified. If <var>codecs</var> does not
fulfill these requirements, the user agent MUST [=
exception/throw =] an {{InvalidModificationError}}.
</p>
<p class="note">
Due to a recommendation in [[!SDP]], calls to
Expand Down Expand Up @@ -11196,8 +11193,7 @@ <h2>
For each <var>codec</var> in <var>codecs</var>,
</p>
<ol>
<li>If <var>codec</var> is not in
<var>codecCapabilities</var>, throw
<li>If the result of the [= codec match =] algorithm between <var>codec</var> and each of <var>codecCapabilities</var> items is false, throw
{{InvalidModificationError}}.
</li>
</ol>
Expand All @@ -11209,6 +11205,36 @@ <h2>
</p>
</li>
</ol>
<p>
The <dfn class="export">codec match</dfn> algorithm given two {{RTCRtpCodec}} or compatible dictionaries <var>first</var> and <var>second</var> is as follows:
</p>
<ol class=algorithm>
<li>
<p>
If <var>first</var>.{{RTCRtpCodec/mimeType}} is different from <var>second</var>.{{RTCRtpCodec/mimeType}}, return <code>false</code>.
</p>
</li>
<li>
<p>
If <var>first</var>.{{RTCRtpCodec/clockRate}} is different from <var>second</var>.{{RTCRtpCodec/clockRate}}, return <code>false</code>.
</p>
</li>
<li>
<p>
If <var>first</var>.{{RTCRtpCodec/channels}} is different from <var>second</var>.{{RTCRtpCodec/channels}}, return <code>false</code>.
</p>
</li>
<li>
<p>
If <var>first</var>.{{RTCRtpCodec/sdpFmtpLine}} is different from <var>second</var>.{{RTCRtpCodec/sdpFmtpLine}}, return <code>false</code>.
</p>
</li>
<li>
<p>
Return <code>true</code>.
</p>
</li>
</ol>
<p class="note">
If set, the offerer's codec preferences will decide the order
of the codecs in the offer. If the answerer does not have any
Expand Down

0 comments on commit 8ddd49c

Please sign in to comment.