@@ -44,6 +44,10 @@ spec:webidl; type:dfn; text:resolve
44
44
"href": "https://www.itu.int/rec/T-REC-G.722/",
45
45
"title": "G.722 : 7 kHz audio-coding within 64 kbit/s",
46
46
"publisher": "ITU"
47
+ },
48
+ "CloneArrayBuffer": {
49
+ "href": "https://tc39.es/ecma262/#sec-clonearraybuffer",
50
+ "title": "CloneArrayBuffer"
47
51
}
48
52
}
49
53
</pre>
@@ -441,16 +445,46 @@ dictionary RTCEncodedVideoFrameMetadata {
441
445
442
446
## <dfn interface>RTCEncodedVideoFrame</dfn> interface ## {#RTCEncodedVideoFrame-interface}
443
447
<pre class="idl">
448
+ dictionary RTCEncodedVideoFrameOptions {
449
+ RTCEncodedVideoFrameMetadata metadata;
450
+ };
451
+
444
452
// New interfaces to define encoded video and audio frames. Will eventually
445
453
// re-use or extend the equivalent defined in WebCodecs.
446
454
[Exposed=(Window,DedicatedWorker), Serializable]
447
455
interface RTCEncodedVideoFrame {
456
+ constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameOptions options = {});
448
457
readonly attribute RTCEncodedVideoFrameType type;
449
458
attribute ArrayBuffer data;
450
459
RTCEncodedVideoFrameMetadata getMetadata();
451
460
};
452
461
</pre>
453
462
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
+
454
488
### Members ### {#RTCEncodedVideoFrame-members}
455
489
<dl dfn-for="RTCEncodedVideoFrame" class="dictionary-members">
456
490
<dt>
@@ -643,13 +677,42 @@ dictionary RTCEncodedAudioFrameMetadata {
643
677
644
678
## <dfn interface>RTCEncodedAudioFrame</dfn> interface ## {#RTCEncodedAudioFrame-interface}
645
679
<pre class="idl">
680
+ dictionary RTCEncodedAudioFrameOptions {
681
+ RTCEncodedAudioFrameMetadata metadata;
682
+ };
683
+
646
684
[Exposed=(Window,DedicatedWorker), Serializable]
647
685
interface RTCEncodedAudioFrame {
686
+ constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameOptions options = {});
648
687
attribute ArrayBuffer data;
649
688
RTCEncodedAudioFrameMetadata getMetadata();
650
689
};
651
690
</pre>
652
691
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
+
653
716
### Members ### {#RTCEncodedAudioFrame-members}
654
717
<dl dfn-for="RTCEncodedAudioFrame" class="dictionary-members">
655
718
<dt>
0 commit comments