diff --git a/index.src.html b/index.src.html
index cfd9350e..f27d265e 100644
--- a/index.src.html
+++ b/index.src.html
@@ -3277,6 +3277,8 @@
[EnforceRange] unsigned long displayHeight;
VideoColorSpaceInit colorSpace;
+
+ sequence transfer = [];
};
dictionary VideoFrameMetadata {
@@ -3415,29 +3417,39 @@
VideoFrame(data, init)
1. If |init| is not a [=valid VideoFrameBufferInit=], throw a {{TypeError}}.
-2. Let |defaultRect| be «[ "x:" → `0`, "y" → `0`,
+1. Let |defaultRect| be «[ "x:" → `0`, "y" → `0`,
"width" → |init|.{{VideoFrameBufferInit/codedWidth}}, "height" →
|init|.{{VideoFrameBufferInit/codedWidth}} ]».
-3. Let |overrideRect| be `undefined`.
-4. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=], assign its
+1. Let |overrideRect| be `undefined`.
+1. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=], assign its
value to |overrideRect|.
-4. Let |parsedRect| be the result of running the [=VideoFrame/Parse Visible
+1. Let |parsedRect| be the result of running the [=VideoFrame/Parse Visible
Rect=] algorithm with |defaultRect|, |overrideRect|,
|init|.{{VideoFrameBufferInit/codedWidth}},
|init|.{{VideoFrameBufferInit/codedHeight}}, and
|init|.{{VideoFrameBufferInit/format}}.
-5. If |parsedRect| is an exception, return |parsedRect|.
-6. Let |optLayout| be `undefined`.
-7. If |options|.{{VideoFrameBufferInit/layout}} [=map/exists=], assign its value
+1. If |parsedRect| is an exception, return |parsedRect|.
+1. Let |optLayout| be `undefined`.
+1. If |options|.{{VideoFrameBufferInit/layout}} [=map/exists=], assign its value
to |optLayout|.
-8. Let |combinedLayout| be the result of running the [=VideoFrame/Compute
+1. Let |combinedLayout| be the result of running the [=VideoFrame/Compute
Layout and Allocation Size=] algorithm with |parsedRect|,
|init|.{{VideoFrameBufferInit/format}}, and |optLayout|.
-9. If |combinedLayout| is an exception, throw |combinedLayout|.
-10. If `data.byteLength` is less than |combinedLayout|’s
+1. If |combinedLayout| is an exception, throw |combinedLayout|.
+1. If `data.byteLength` is less than |combinedLayout|’s
[=combined buffer layout/allocationSize=], throw a {{TypeError}}.
-11. Let |resource| be a new [=media resource=] containing a copy of |data|. Use
- {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}}
+1. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}:
+ 1. If {{platform object/[[Detached]]}} internal slot is `true`,
+ then throw a {{DataCloneError}} {{DOMException}}.
+1. If |init|.{{VideoFrameBufferInit/transfer}} contains an ArrayBuffer referenced
+ by |data|:
+ 1. Let |resource| be a new [=media resource=] referencing pixels in |data|
+ without a copy.
+ Use {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}}
+ to determine where in |data| the pixels for each plane reside.
+1. Otherwise:
+ 1. Let |resource| be a new [=media resource=] containing a copy of |data|.
+ Use {{VideoFrameBufferInit/visibleRect}} and {{VideoFrameBufferInit/layout}}
to determine where in |data| the pixels for each plane reside.
The User Agent MAY choose to allocate
@@ -3449,55 +3461,58 @@
reposition the visible rectangle within |resource|. The final position
will be reflected by {{VideoFrame/visibleRect}}.
-12. Let |resourceCodedWidth| be the coded width of |resource|.
-13. Let |resourceCodedHeight| be the coded height of |resource|.
-14. Let |resourceVisibleLeft| be the left offset for the visible rectangle of
+1. For each |transferable| in |init|.{{VideoFrameBufferInit/transfer}}:
+ 1. Perform [DetachArrayBuffer](https://tc39.es/ecma262/#sec-detacharraybuffer)
+ on |transferable|
+1. Let |resourceCodedWidth| be the coded width of |resource|.
+1. Let |resourceCodedHeight| be the coded height of |resource|.
+1. Let |resourceVisibleLeft| be the left offset for the visible rectangle of
|resource|.
-15. Let |resourceVisibleTop| be the top offset for the visible rectangle of
+1. Let |resourceVisibleTop| be the top offset for the visible rectangle of
|resource|.
ISSUE: The spec SHOULD provide definitions (and
possibly diagrams) for coded size, visible rectangle, and display size.
See [#166](https://github.com/w3c/webcodecs/issues/166).
-16. Let |frame| be a new {{VideoFrame}} object initialized as follows:
+1. Let |frame| be a new {{VideoFrame}} object initialized as follows:
1. Assign |resourceCodedWidth|, |resourceCodedHeight|,
|resourceVisibleLeft|, and |resourceVisibleTop| to
{{VideoFrame/[[coded width]]}}, {{VideoFrame/[[coded height]]}},
{{VideoFrame/[[visible left]]}}, and {{VideoFrame/[[visible top]]}}
respectively.
- 2. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=]:
+ 1. If |init|.{{VideoFrameBufferInit/visibleRect}} [=map/exists=]:
1. Let |truncatedVisibleWidth| be the value of
{{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/width}} after
truncating.
1. Assign |truncatedVisibleWidth| to {{VideoFrame/[[visible width]]}}.
- 3. Let |truncatedVisibleHeight| be the value of
+ 1. Let |truncatedVisibleHeight| be the value of
{{VideoFrameBufferInit/visibleRect}}.{{DOMRectInit/height}} after
truncating.
- 2. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}.
- 3. Otherwise:
+ 1. Assign |truncatedVisibleHeight| to {{VideoFrame/[[visible height]]}}.
+ 1. Otherwise:
1. Assign {{VideoFrame/[[coded width]]}} to
{{VideoFrame/[[visible width]]}}.
2. Assign {{VideoFrame/[[coded height]]}} to
{{VideoFrame/[[visible height]]}}.
- 4. If |init|.{{VideoFrameBufferInit/displayWidth}} [=map/exists=], assign
+ 1. If |init|.{{VideoFrameBufferInit/displayWidth}} [=map/exists=], assign
it to {{VideoFrame/[[display width]]}}. Otherwise, assign
{{VideoFrame/[[visible width]]}} to {{VideoFrame/[[display width]]}}.
- 5. If |init|.{{VideoFrameBufferInit/displayHeight}} [=map/exists=], assign
+ 1. If |init|.{{VideoFrameBufferInit/displayHeight}} [=map/exists=], assign
it to {{VideoFrame/[[display height]]}}. Otherwise, assign
{{VideoFrame/[[visible height]]}} to {{VideoFrame/[[display height]]}}.
- 6. Assign |init|'s {{VideoFrameBufferInit/timestamp}} and
+ 1. Assign |init|'s {{VideoFrameBufferInit/timestamp}} and
{{VideoFrameBufferInit/duration}} to {{VideoFrame/[[timestamp]]}} and
{{VideoFrame/[[duration]]}} respectively.
- 7. Let |colorSpace| be `undefined`.
- 8. If |init|.{{VideoFrameBufferInit/colorSpace}} [=map/exists=], assign its
+ 1. Let |colorSpace| be `undefined`.
+ 1. If |init|.{{VideoFrameBufferInit/colorSpace}} [=map/exists=], assign its
value to |colorSpace|.
- 9. Assign the result of running the [=VideoFrame/Pick Color Space=]
+ 1. Assign the result of running the [=VideoFrame/Pick Color Space=]
algorithm, with |colorSpace| and {{VideoFrame/[[format]]}}, to
{{VideoFrame/[[color space]]}}.
- 10. Assign the result of calling [=Copy VideoFrame metadata=]
+ 1. Assign the result of calling [=Copy VideoFrame metadata=]
with |init|'s {{VideoFrameInit/metadata}} to |frame|.{{VideoFrame/[[metadata]]}}.
-17. Return |frame|.
+1. Return |frame|.
### Attributes ###{#videoframe-attributes}
: format