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 a codec match algorithm for setCodecPreferences #2847

Merged
merged 2 commits into from
Mar 30, 2023
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
9 changes: 9 additions & 0 deletions amendments.json
Original file line number Diff line number Diff line change
Expand Up @@ -440,5 +440,14 @@
"status": "candidate",
"id": 30
}
],
"setcodecparameters-algorithm": [
{
"description": "Fix ambiguities in the setCodecPreferences() algorithm",
"pr": 2847,
"type": "correction",
"status": "candidate",
"id": 31
}
]
}
57 changes: 47 additions & 10 deletions webrtc.html
Original file line number Diff line number Diff line change
Expand Up @@ -11109,18 +11109,13 @@ <h2>
be removed from the mapping of payload types in the SDP.
</p>
<p>
The <var>codecs</var> sequence passed into
{{setCodecPreferences}} can only contain codecs that are
returned by
{{setCodecPreferences}} will reject attempts to set <var>codecs</var>
[= codec match | not matching =] codecs found in
{{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,9 +11191,10 @@ <h2>
For each <var>codec</var> in <var>codecs</var>,
</p>
<ol>
<li>If <var>codec</var> is not in
<var>codecCapabilities</var>, throw
{{InvalidModificationError}}.
<li>
<p>If <var>codec</var> does [= codec match | not match any codec =]
in <var>codecCapabilities</var>, throw {{InvalidModificationError}}.
</p>
</li>
</ol>
</li>
Expand All @@ -11209,6 +11205,47 @@ <h2>
</p>
</li>
</ol>
<p>
The <dfn class="export">codec match</dfn> algorithm given two {{RTCRtpCodec}}
<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 either (but not both) of <var>first</var>.{{RTCRtpCodec/channels}}
and <var>second</var>.{{RTCRtpCodec/channels}} are [= map/exist | missing =],
or if they both [= map/exist =] and <var>first</var>.{{RTCRtpCodec/channels}}
is different from <var>second</var>.{{RTCRtpCodec/channels}}, return
<code>false</code>.
</p>
</li>
<li>
<p>
If either (but not both) of <var>first</var>.{{RTCRtpCodec/sdpFmtpLine}}
and <var>second</var>.{{RTCRtpCodec/sdpFmtpLine}} are [= map/exist | missing =],
or if they both [=map/exist=] and <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