@@ -44,6 +44,10 @@ spec:webidl; type:dfn; text:resolve
4444 "href": "https://www.itu.int/rec/T-REC-G.722/",
4545 "title": "G.722 : 7 kHz audio-coding within 64 kbit/s",
4646 "publisher": "ITU"
47+ },
48+ "CloneArrayBuffer": {
49+ "href": "https://tc39.es/ecma262/#sec-clonearraybuffer",
50+ "title": "CloneArrayBuffer"
4751 }
4852}
4953</pre>
@@ -441,16 +445,46 @@ dictionary RTCEncodedVideoFrameMetadata {
441445
442446## <dfn interface>RTCEncodedVideoFrame</dfn> interface ## {#RTCEncodedVideoFrame-interface}
443447<pre class="idl">
448+ dictionary RTCEncodedVideoFrameOptions {
449+ RTCEncodedVideoFrameMetadata metadata;
450+ };
451+
444452// New interfaces to define encoded video and audio frames. Will eventually
445453// re-use or extend the equivalent defined in WebCodecs.
446454[Exposed=(Window,DedicatedWorker), Serializable]
447455interface RTCEncodedVideoFrame {
456+ constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameOptions options = {});
448457 readonly attribute RTCEncodedVideoFrameType type;
449458 attribute ArrayBuffer data;
450459 RTCEncodedVideoFrameMetadata getMetadata();
451460};
452461</pre>
453462
463+ ### Constructor ### {#RTCEncodedVideoFrame-members}
464+ <dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members">
465+ <dt>
466+ <dfn for="RTCEncodedVideoFrame" method>constructor()</dfn>
467+ </dt>
468+ <dd>
469+ <p>
470+ Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and
471+ |options|.`[metadata] `. The newly created frame is completely independent of
472+ |originalFrame|, with its `[[data]] ` being a deep copy of |originalFrame|.`[[data]] `.
473+ The new frame's `[[metadata]] ` is a deep copy of |originalFrame|.`[[metadata]] `, with
474+ fields replaced with deep copies of the fields present in |options|.`[metadata] `.
475+
476+ When called, run the following steps:
477+
478+ 1. Set this.`[[type]] ` to |originalFrame|.`[[type]] `.
479+ 1. Let this.`[[data]] ` be the result of [[CloneArrayBuffer]] (|originalFrame|.`[[data]] `, 0, |originalFrame|.`[[data]] `.`[[ArrayBufferByteLength]] `).
480+ 1. Let `[[metadata]] ` represent the metadata associated with this newly constructed frame.
481+ 1. For each {`[[key]] `,`[[value]] `} pair of |originalFrame|.`[[getMetadata()]] `, set `[[metadata]] `.`[[key]] ` to a deep copy of `[[value]] `.
482+ 1. For each {`[[key]] `,`[[value]] `} pair of |options|.`[metadata] `, set `[[metadata]] `.`[[key]] ` to a deep copy of `[[value]] `.
483+
484+ </p>
485+ </dd>
486+ </dl>
487+
454488### Members ### {#RTCEncodedVideoFrame-members}
455489<dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members">
456490 <dt>
@@ -643,13 +677,42 @@ dictionary RTCEncodedAudioFrameMetadata {
643677
644678## <dfn interface>RTCEncodedAudioFrame</dfn> interface ## {#RTCEncodedAudioFrame-interface}
645679<pre class="idl">
680+ dictionary RTCEncodedAudioFrameOptions {
681+ RTCEncodedAudioFrameMetadata metadata;
682+ };
683+
646684[Exposed=(Window,DedicatedWorker), Serializable]
647685interface RTCEncodedAudioFrame {
686+ constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameOptions options = {});
648687 attribute ArrayBuffer data;
649688 RTCEncodedAudioFrameMetadata getMetadata();
650689};
651690</pre>
652691
692+ ### Constructor ### {#RTCEncodedAudioFrame-members}
693+ <dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members">
694+ <dt>
695+ <dfn for="RTCEncodedAudioFrame" method>constructor()</dfn>
696+ </dt>
697+ <dd>
698+ <p>
699+ Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and
700+ |options|.`[metadata] `. The newly created frame is completely independent of
701+ |originalFrame|, with its `[[data]] ` being a deep copy of |originalFrame|.`[[data]] `.
702+ The new frame's `[[metadata]] ` is a deep copy of |originalFrame|.`[[metadata]] `, with
703+ fields replaced with deep copies of the fields present in |options|.`[metadata] `.
704+
705+ When called, run the following steps:
706+
707+ 1. Let this.`[[data]] ` be the result of [[CloneArrayBuffer]] (|originalFrame|.`[[data]] `, 0, |originalFrame|.`[[data]] `.`[[ArrayBufferByteLength]] `).
708+ 1. Let `[[metadata]] ` represent the metadata associated with this newly constructed frame.
709+ 1. For each {`[[key]] `,`[[value]] `} pair of |originalFrame|.`[[getMetadata()]] `, set `[[metadata]] `.`[[key]] ` to a deep copy of `[[value]] `.
710+ 1. For each {`[[key]] `,`[[value]] `} pair of |options|.`[metadata] `, set `[[metadata]] `.`[[key]] ` to a deep copy of `[[value]] `.
711+
712+ </p>
713+ </dd>
714+ </dl>
715+
653716### Members ### {#RTCEncodedAudioFrame-members}
654717<dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members">
655718 <dt>
0 commit comments