From 03df57bf14a6ef9eb7cc92743bc276dd12c639a8 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Tue, 16 Jan 2024 16:05:19 +0100 Subject: [PATCH 01/13] Add constructor for encoded frames --- index.bs | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/index.bs b/index.bs index e7aabd4..794dab4 100644 --- a/index.bs +++ b/index.bs @@ -426,12 +426,32 @@ dictionary RTCEncodedVideoFrameMetadata { // re-use or extend the equivalent defined in WebCodecs. [Exposed=(Window,DedicatedWorker), Serializable] interface RTCEncodedVideoFrame { + constructor(RTCEncodedVideoFrame originalFrame, RTCEncodedVideoFrameMetadata newMetadata); readonly attribute RTCEncodedVideoFrameType type; attribute ArrayBuffer data; RTCEncodedVideoFrameMetadata getMetadata(); }; +### Constructor ### {#RTCEncodedVideoFrame-members} +
+
+ constructor() +
+
+

+ Create a new RTCEncodedVideoFrame from the given |originalFrame| and sets its metadata to |newMetadata|. + + When called, run the following steps: + + 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. + 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. + 1. Set the internal representation of metadata to |newMetadata| such that this.`[[getMetadata()]]` returns |newMetadata|. + +

+
+
+ ### Members ### {#RTCEncodedVideoFrame-members}
@@ -626,11 +646,30 @@ dictionary RTCEncodedAudioFrameMetadata {
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedAudioFrame {
+    constructor(RTCEncodedAudioFrame originalFrame, RTCEncodedAudioFrameMetadata newMetadata);
     attribute ArrayBuffer data;
     RTCEncodedAudioFrameMetadata getMetadata();
 };
 
+### Constructor ### {#RTCEncodedAudioFrame-members} +
+
+ constructor() +
+
+

+ Create a new RTCEncodedAudioFrame from the given |originalFrame| and sets its metadata to |newMetadata|. + + When called, run the following steps: + + 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. + 1. Set the internal representation of metadata to |newMetadata| such that this.`[[getMetadata()]]` returns |newMetadata|. + +

+
+
+ ### Members ### {#RTCEncodedAudioFrame-members}
From 4f2c4381dc07a48138e978f934dd00de6bbdc20d Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Tue, 16 Jan 2024 16:48:05 +0100 Subject: [PATCH 02/13] Update --- index.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 794dab4..1d32bcd 100644 --- a/index.bs +++ b/index.bs @@ -426,7 +426,7 @@ dictionary RTCEncodedVideoFrameMetadata { // re-use or extend the equivalent defined in WebCodecs. [Exposed=(Window,DedicatedWorker), Serializable] interface RTCEncodedVideoFrame { - constructor(RTCEncodedVideoFrame originalFrame, RTCEncodedVideoFrameMetadata newMetadata); + constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameMetadata newMetadata); readonly attribute RTCEncodedVideoFrameType type; attribute ArrayBuffer data; RTCEncodedVideoFrameMetadata getMetadata(); @@ -440,13 +440,13 @@ interface RTCEncodedVideoFrame {

- Create a new RTCEncodedVideoFrame from the given |originalFrame| and sets its metadata to |newMetadata|. + Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. - 1. Set the internal representation of metadata to |newMetadata| such that this.`[[getMetadata()]]` returns |newMetadata|. + 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedVideoFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`.

@@ -646,7 +646,7 @@ dictionary RTCEncodedAudioFrameMetadata {
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedAudioFrame {
-    constructor(RTCEncodedAudioFrame originalFrame, RTCEncodedAudioFrameMetadata newMetadata);
+    constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameMetadata newMetadata);
     attribute ArrayBuffer data;
     RTCEncodedAudioFrameMetadata getMetadata();
 };
@@ -659,12 +659,12 @@ interface RTCEncodedAudioFrame {
     

- Create a new RTCEncodedAudioFrame from the given |originalFrame| and sets its metadata to |newMetadata|. + Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. When called, run the following steps: 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. - 1. Set the internal representation of metadata to |newMetadata| such that this.`[[getMetadata()]]` returns |newMetadata|. + 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedAudioFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`.

From 303d24fcb34eeb39bc7137db85ce6d6c4b257edb Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Wed, 17 Jan 2024 11:10:52 +0100 Subject: [PATCH 03/13] deep clone of data --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 1d32bcd..96482a7 100644 --- a/index.bs +++ b/index.bs @@ -445,7 +445,7 @@ interface RTCEncodedVideoFrame { When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. - 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. + 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedVideoFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`.

@@ -663,7 +663,7 @@ interface RTCEncodedAudioFrame { When called, run the following steps: - 1. Set this.`[[data]]` to |originalFrame|.`[[data]]`. + 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedAudioFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`.

From dccb6f65d07ad9a99eba840e9e6034cc2291d2bf Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Thu, 18 Jan 2024 10:51:22 +0100 Subject: [PATCH 04/13] update wording of metadata --- index.bs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 96482a7..ad1f80a 100644 --- a/index.bs +++ b/index.bs @@ -446,7 +446,9 @@ interface RTCEncodedVideoFrame { 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. - 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedVideoFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`. + 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. + 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.

@@ -664,7 +666,9 @@ interface RTCEncodedAudioFrame { When called, run the following steps: 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. - 1. If |newMetadata| is not empty, set the internal representation of metadata to |newMetadata| such that {{RTCEncodedAudioFrame/getMetadata()}} returns |newMetadata|. Otherwise, set the internal representation of metadata to originalFrame.`[[getMetadata()]]`. + 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. + 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.

From 9739ea1f8670264c2493aa5f2274eae46269c43a Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Tue, 2 Apr 2024 16:01:56 +0200 Subject: [PATCH 05/13] Changes to address the comments --- index.bs | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index ad1f80a..a97ba15 100644 --- a/index.bs +++ b/index.bs @@ -422,11 +422,15 @@ dictionary RTCEncodedVideoFrameMetadata { ## RTCEncodedVideoFrame interface ## {#RTCEncodedVideoFrame-interface}
+dictionary RTCEncodedVideoFrameMetadataOptions {
+    RTCEncodedVideoFrameMetadata metadata;
+};
+
 // New interfaces to define encoded video and audio frames. Will eventually
 // re-use or extend the equivalent defined in WebCodecs.
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedVideoFrame {
-    constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameMetadata newMetadata);
+    constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameMetadataOptions options = {});
     readonly attribute RTCEncodedVideoFrameType type;
     attribute ArrayBuffer data;
     RTCEncodedVideoFrameMetadata getMetadata();
@@ -440,15 +444,15 @@ interface RTCEncodedVideoFrame {
     
     

- Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. + Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal `[[metadata]]` slot to |options|`[metadata]`. When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. - 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. + 1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.

@@ -646,9 +650,13 @@ dictionary RTCEncodedAudioFrameMetadata { ## RTCEncodedAudioFrame interface ## {#RTCEncodedAudioFrame-interface}
+dictionary RTCEncodedAudioFrameMetadataOptions {
+    RTCEncodedAudioFrameMetadata metadata;
+};
+
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedAudioFrame {
-    constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameMetadata newMetadata);
+    constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameMetadataOptions options = {});
     attribute ArrayBuffer data;
     RTCEncodedAudioFrameMetadata getMetadata();
 };
@@ -661,14 +669,14 @@ interface RTCEncodedAudioFrame {
     
     

- Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal metadata to |newMetadata|. + Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal `[[metadata]]` slot to |options|`[metadata]`. When called, run the following steps: 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. - 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. + 1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |newMetadata|, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.

From 3c35ee7a62bb0a838c0170794ab317c12591dc08 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Tue, 2 Apr 2024 17:20:44 +0200 Subject: [PATCH 06/13] rm internal slot --- index.bs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index a97ba15..68ffb0e 100644 --- a/index.bs +++ b/index.bs @@ -444,8 +444,8 @@ interface RTCEncodedVideoFrame {

- Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal `[[metadata]]` slot to |options|`[metadata]`. - + Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal metadata to |options|`[metadata]`. + When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. @@ -669,7 +669,7 @@ interface RTCEncodedAudioFrame {

- Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal `[[metadata]]` slot to |options|`[metadata]`. + Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal metadata to |options|`[metadata]`. When called, run the following steps: From 417f89617890921a02b4a4c673b8c53060ab8538 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Wed, 3 Apr 2024 17:23:43 +0200 Subject: [PATCH 07/13] Use CLoneArrayBuffer --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index 68ffb0e..17c39ad 100644 --- a/index.bs +++ b/index.bs @@ -449,7 +449,7 @@ interface RTCEncodedVideoFrame { When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. - 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. + 1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. @@ -673,7 +673,7 @@ interface RTCEncodedAudioFrame { When called, run the following steps: - 1. Let this.`[[data]]` be a new ArrayBuffer object whose `[[ArrayBufferData]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferData]]`, and whose `[[ArrayBufferByteLength]]` internal slot value is |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`. + 1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. From ae86de49bc7bcd5759f11199742bbc17d44306cc Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Thu, 4 Apr 2024 11:03:06 +0200 Subject: [PATCH 08/13] rename the Options --- index.bs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 17c39ad..a88a1b4 100644 --- a/index.bs +++ b/index.bs @@ -422,7 +422,7 @@ dictionary RTCEncodedVideoFrameMetadata { ## RTCEncodedVideoFrame interface ## {#RTCEncodedVideoFrame-interface}

-dictionary RTCEncodedVideoFrameMetadataOptions {
+dictionary RTCEncodedVideoFrameOptions {
     RTCEncodedVideoFrameMetadata metadata;
 };
 
@@ -430,7 +430,7 @@ dictionary RTCEncodedVideoFrameMetadataOptions {
 // re-use or extend the equivalent defined in WebCodecs.
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedVideoFrame {
-    constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameMetadataOptions options = {});
+    constructor(RTCEncodedVideoFrame originalFrame, optional RTCEncodedVideoFrameOptions options = {});
     readonly attribute RTCEncodedVideoFrameType type;
     attribute ArrayBuffer data;
     RTCEncodedVideoFrameMetadata getMetadata();
@@ -450,7 +450,7 @@ interface RTCEncodedVideoFrame {
 
             1. Set this.`[[type]]` to |originalFrame|.`[[type]]`.
             1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`).
-            1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame.
+            1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame.
                 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.
                 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.
 
@@ -650,13 +650,13 @@ dictionary RTCEncodedAudioFrameMetadata {
 
 ## RTCEncodedAudioFrame interface ## {#RTCEncodedAudioFrame-interface}
 
-dictionary RTCEncodedAudioFrameMetadataOptions {
+dictionary RTCEncodedAudioFrameOptions {
     RTCEncodedAudioFrameMetadata metadata;
 };
 
 [Exposed=(Window,DedicatedWorker), Serializable]
 interface RTCEncodedAudioFrame {
-    constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameMetadataOptions options = {});
+    constructor(RTCEncodedAudioFrame originalFrame, optional RTCEncodedAudioFrameOptions options = {});
     attribute ArrayBuffer data;
     RTCEncodedAudioFrameMetadata getMetadata();
 };
@@ -674,7 +674,7 @@ interface RTCEncodedAudioFrame {
             When called, run the following steps:
 
             1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`).
-            1. Let `[[metadata]]` be the internal slot that stores the metadata associated with this newly constructed frame.
+            1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame.
                 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.
                 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`.
 

From 8ae67388df34eb5d288e579a61c5aac804a8cbc9 Mon Sep 17 00:00:00 2001
From: Palak Agarwal 
Date: Fri, 19 Apr 2024 11:31:37 +0200
Subject: [PATCH 09/13] address comments

---
 index.bs | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/index.bs b/index.bs
index a88a1b4..f6f502c 100644
--- a/index.bs
+++ b/index.bs
@@ -44,6 +44,10 @@ spec:webidl; type:dfn; text:resolve
     "href": "https://www.itu.int/rec/T-REC-G.722/",
     "title": "G.722 : 7 kHz audio-coding within 64 kbit/s",
     "publisher": "ITU"
+   },
+   "CloneArrayBuffer": {
+    "href": "https://tc39.es/ecma262/#sec-clonearraybuffer",
+    "title": "CloneArrayBuffer"
    }
 }
 
@@ -449,10 +453,11 @@ interface RTCEncodedVideoFrame { When called, run the following steps: 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. - 1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). + 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if `[[value]]` is not undefined, set `[[metadata]]`.`[[key]]` to `[[value]]`. +

This does a "deep-copy" here.

@@ -673,10 +678,11 @@ interface RTCEncodedAudioFrame { When called, run the following steps: - 1. Let this.`[[data]]` be the result of CloneArrayBuffer(|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). + 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if the `[[value]]` exists, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if `[[value]]` is not undefined, set `[[metadata]]`.`[[key]]` to `[[value]]`. +

This does a "deep-copy" here.

From ae0c34292396b9c1e9515ad9f824965870f00817 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Fri, 19 Apr 2024 11:52:01 +0200 Subject: [PATCH 10/13] remove conditions on [[value]] --- index.bs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.bs b/index.bs index f6f502c..64ac37e 100644 --- a/index.bs +++ b/index.bs @@ -456,7 +456,7 @@ interface RTCEncodedVideoFrame { 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if `[[value]]` is not undefined, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.

This does a "deep-copy" here.

@@ -681,7 +681,7 @@ interface RTCEncodedAudioFrame { 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, if `[[value]]` is not undefined, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.

This does a "deep-copy" here.

From f229c33a6929d74338e11ce85197edda3436950f Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Fri, 19 Apr 2024 12:22:10 +0200 Subject: [PATCH 11/13] add introduction --- index.bs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/index.bs b/index.bs index 64ac37e..f80119f 100644 --- a/index.bs +++ b/index.bs @@ -448,7 +448,9 @@ interface RTCEncodedVideoFrame {

- Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and sets the internal metadata to |options|`[metadata]`. + Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and |options|`[metadata]`. The newly created frame is completely independent of the + |originalFrame| with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with + any fields replaced with deep copies of the fields present in |options|`[metadata]`. When called, run the following steps: @@ -674,8 +676,10 @@ interface RTCEncodedAudioFrame {

- Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and sets the internal metadata to |options|`[metadata]`. - + Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and |options|`[metadata]`. The newly created frame is completely independent of the + |originalFrame| with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with + any fields replaced with deep copies of the fields present in |options|`[metadata]`. + When called, run the following steps: 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). From 18c1b3e5c86175dd8b7b0293e8059bfcbdc2beb1 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Fri, 19 Apr 2024 12:52:06 +0200 Subject: [PATCH 12/13] nits --- index.bs | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/index.bs b/index.bs index f80119f..4b4b416 100644 --- a/index.bs +++ b/index.bs @@ -448,9 +448,11 @@ interface RTCEncodedVideoFrame {

- Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and |options|`[metadata]`. The newly created frame is completely independent of the - |originalFrame| with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with - any fields replaced with deep copies of the fields present in |options|`[metadata]`. + Creates a new {{RTCEncodedVideoFrame}} from the given |originalFrame| and + |options|.`[metadata]`. The newly created frame is completely independent of + |originalFrame|, with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. + The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with + fields replaced with deep copies of the fields present in |options|.`[metadata]`. When called, run the following steps: @@ -458,7 +460,7 @@ interface RTCEncodedVideoFrame { 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.

This does a "deep-copy" here.

@@ -676,16 +678,18 @@ interface RTCEncodedAudioFrame {

- Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and |options|`[metadata]`. The newly created frame is completely independent of the - |originalFrame| with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with - any fields replaced with deep copies of the fields present in |options|`[metadata]`. + Creates a new {{RTCEncodedAudioFrame}} from the given |originalFrame| and + |options|.`[metadata]`. The newly created frame is completely independent of + |originalFrame|, with its `[[data]]` being a deep copy of |originalFrame|.`[[data]]`. + The new frame's `[[metadata]]` is a deep copy of |originalFrame|.`[[metadata]]`, with + fields replaced with deep copies of the fields present in |options|.`[metadata]`. When called, run the following steps: 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`.

This does a "deep-copy" here.

From 429171d1d4c74ae449105bab70e51086dbcabb94 Mon Sep 17 00:00:00 2001 From: Palak Agarwal Date: Fri, 19 Apr 2024 14:25:10 +0200 Subject: [PATCH 13/13] add deep copy in the steps --- index.bs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/index.bs b/index.bs index 4b4b416..86b501c 100644 --- a/index.bs +++ b/index.bs @@ -459,9 +459,8 @@ interface RTCEncodedVideoFrame { 1. Set this.`[[type]]` to |originalFrame|.`[[type]]`. 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. - 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. -

This does a "deep-copy" here.

+ 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to a deep copy of `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to a deep copy of `[[value]]`.

@@ -688,9 +687,8 @@ interface RTCEncodedAudioFrame { 1. Let this.`[[data]]` be the result of [[CloneArrayBuffer]](|originalFrame|.`[[data]]`, 0, |originalFrame|.`[[data]]`.`[[ArrayBufferByteLength]]`). 1. Let `[[metadata]]` represent the metadata associated with this newly constructed frame. - 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. - 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to `[[value]]`. -

This does a "deep-copy" here.

+ 1. For each {`[[key]]`,`[[value]]`} pair of |originalFrame|.`[[getMetadata()]]`, set `[[metadata]]`.`[[key]]` to a deep copy of `[[value]]`. + 1. For each {`[[key]]`,`[[value]]`} pair of |options|.`[metadata]`, set `[[metadata]]`.`[[key]]` to a deep copy of `[[value]]`.