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

Request keyframe via setParameters #167

Merged
merged 21 commits into from
Jul 27, 2023
63 changes: 63 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,69 @@ <h2>Dictionary {{RTCRtpEncodingParameters}} Members</h2>
</dl>
</section>
</section>
<section id="rtcrtpsender-setparameters-keyframe">
<h3>
{{RTCRtpSender}} {{RTCRtpSender/setParameters()}} extensions for requesting the generation of a key frame.
</h3>
<p>
The {{RTCRtpSender}}'s {{RTCRtpSender/setParameters()}} method is defined in
[[WEBRTC]]. This document extends it with an optional second argument
to request generation of a key frame by the encoder.
</p>
<pre class="idl">dictionary RTCEncodeOptions {
boolean keyFrame = false;
};</pre>
<section id="rtcrtpsender-setparameters-keyframe-idl">
<h2>Dictionary {{RTCEncodeOptions}} Members</h2>
henbos marked this conversation as resolved.
Show resolved Hide resolved
<p>
RTCEncodeOptions is the WebRTC equivalent of {{VideoEncoderEncodeOptions}} in [[WebCodecs]].
henbos marked this conversation as resolved.
Show resolved Hide resolved
</p>
<dl data-link-for="RTCEncodeOptions" data-dfn-for="RTCEncodeOptions" class="dictionary-members">
henbos marked this conversation as resolved.
Show resolved Hide resolved
<dt>
<dfn data-idl>keyFrame</dfn> of type <span class="idlMemberType">boolean</span>, defaulting to <code>false</code>.
</dt>
<dd>
<p>
When set to true, request that RTCRtpSender's encoder generates a keyframe for the encoding.
The semantics of flag is similar to the RTCP FIR message described in [RFC5104], section 3.5.1.
aboba marked this conversation as resolved.
Show resolved Hide resolved
</p>
</dd>
</dl>
</section>
<section id="rtcrtpsender-setparameters-keyframe-interface-extensions">
<h2>{{RTCRtpSender}} {{RTCRtpSender/setParameters()}} extensions</h2>
<pre class="idl">[Exposed=Window]
partial interface RTCRtpSender {
Promise&lt;undefined&gt; setParameters(RTCRtpSendParameters parameters,
optional sequence&lt;RTCEncodeOptions&gt; encodeOptions = []);
fippo marked this conversation as resolved.
Show resolved Hide resolved
};</pre>
<p>
In the steps to call the {{RTCRtpSender/setParameters()}} method,
let <var>parameters</var> be the method's first argument and let <var>encodeOptions</var>
be the method's second argument.
</p>
<p>
If the [=RTCRtpTransceiver/transceiver kind=] of the associated kind is `"audio"`, set
<var>encodeOptions</var> to the empty list.
</p>
<p>
Append the following step after the steps to validate the <var>parameters</var>:
<ul>
<li>If <var>encodeOptions</var> is not empty and <code><var>encodeOptions</var>.length</code>
is different from <code><var>parameters</var>.encodings.length</code>,
return a promise [= rejected =] with a newly [= exception/created =] {{InvalidModificationError}}.</li>
</ul>
<p>
In the steps to configure the media stack to use <var>parameters</var>, append the following step:
<ul>
<li>For the <var>encodeOption</var> at index <var>i</var>, request that the encoder associated with
<code><var>parameters</var>.encodings[i]</code> generates a key frame.</li>
</ul>
<p class="note">
The request to generate does not wait for a key frame to be produced by the encoder.
</p>
</section>
</section>
<section id="rtcrtpcontributingsource-extensions">
<h3>
{{RTCRtpContributingSource}} extensions
Expand Down