Skip to content

Commit 36a7447

Browse files
committed
More clear handling of |rect| in RGB branch of VideoFrame.copyTo
1 parent 8e5f883 commit 36a7447

1 file changed

Lines changed: 18 additions & 12 deletions

File tree

index.src.html

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030

3131
<pre class=link-defaults>
3232
spec:html; type:attribute; text:hidden
33+
spec:html; type:enum-value; text:srgb
3334
spec:infra; type:dfn; text:list
3435
spec:infra; type:dfn; text:enqueue
3536
</pre>
@@ -3766,15 +3767,20 @@
37663767
5. If `destination.byteLength` is less than |combinedLayout|'s [=combined
37673768
buffer layout/allocationSize=], return a promise rejected with a
37683769
{{TypeError}}.
3769-
6. If `options.format` does not equal to {{VideoFrame/[[format]]}} and
3770-
`options.format` is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}
3771-
then:
3772-
1. Let |serializedOptions| be [$StructuredSerialize$](|options|)
3773-
2. Let |newOptions| be [$StructuredDeserialize$](|serializedOptions|, [=the current Realm=]).
3774-
3. Set |newOptions.format| to `undefined`
3775-
4. Let |rgbFrame| be the result of running the [=VideoFrame/Convert to RGB frame=]
3776-
algorithm with `options.format`, `options.rect`, and `options.colorSpace`.
3777-
5. Return the result of calling {{VideoFrame/copyTo()}} on |rgbFrame| with
3770+
6. If |options|.{{VideoFrameCopyToOptions/format}} does not equal to
3771+
{{VideoFrame/[[format]]}} and |options|.{{VideoFrameCopyToOptions/format}}
3772+
is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} then:
3773+
1. Let |newOptions| be the result of running the <a>Clone Configuration</a>
3774+
algorithm with |options|.
3775+
2. Assign `undefined` to |newOptions|.{{VideoFrameCopyToOptions/format}}
3776+
and |newOptions|.{{VideoFrameCopyToOptions/rect}}.
3777+
3. Let |rect| be `undefined`.
3778+
4. If |options|.{{VideoFrameCopyToOptions/rect}} [=map/exists=], assign the
3779+
value of |options|.{{VideoFrameCopyToOptions/rect}} to |rect|.
3780+
5. Otherwise, assign the value of {{VideoFrame/visibleRect}} to |rect|.
3781+
6. Let |rgbFrame| be the result of running the [=VideoFrame/Convert to RGB frame=]
3782+
algorithm with |options|.{{VideoFrameCopyToOptions/format}}, |rect|, and `options.colorSpace`.
3783+
7. Return the result of calling {{VideoFrame/copyTo()}} on |rgbFrame| with
37783784
|destination| and |newOptions|.
37793785
7. Let |p| be a new {{Promise}}.
37803786
8. Let |copyStepsQueue| be the result of starting a new [=parallel queue=].
@@ -4322,13 +4328,13 @@
43224328
invalid to specify planes that overlap.
43234329
: <dfn dict-member for=VideoFrameCopyToOptions>format</dfn>
43244330
:: A {{VideoPixelFormat}} for the pixel data in the destination
4325-
{{BufferSource}}. Explicit values can be:
4326-
{{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} or the same as {{VideoFrame/format}}.
4331+
{{BufferSource}}. Potential values are:
4332+
{{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} and values of {{VideoFrame/format}}.
43274333
If unspecified, the {{VideoFrame/format}} is used.
43284334
: <dfn dict-member for=VideoFrameCopyToOptions>colorSpace</dfn>
43294335
:: A {{PredefinedColorSpace}} that <em class="rfc2119">SHALL</em> be used to as
43304336
a target color space for for the pixel data in the destination
4331-
{{BufferSource}}.
4337+
{{BufferSource}}. If unspecified, {{srgb}} is used.
43324338

43334339

43344340
DOMRects in VideoFrame {#videoframe-domrect}

0 commit comments

Comments
 (0)