Skip to content

Commit

Permalink
More clear handling of |rect| in RGB branch of VideoFrame.copyTo
Browse files Browse the repository at this point in the history
  • Loading branch information
Djuffin committed Dec 12, 2023
1 parent 185e2b7 commit 97d1519
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions index.src.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

<pre class=link-defaults>
spec:html; type:attribute; text:hidden
spec:html; type:enum-value; text:srgb
spec:infra; type:dfn; text:list
spec:infra; type:dfn; text:enqueue
</pre>
Expand Down Expand Up @@ -3749,15 +3750,20 @@
5. If `destination.byteLength` is less than |combinedLayout|'s [=combined
buffer layout/allocationSize=], return a promise rejected with a
{{TypeError}}.
6. If `options.format` does not equal to {{VideoFrame/[[format]]}} and
`options.format` is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}}
then:
1. Let |serializedOptions| be [$StructuredSerialize$](|options|)
2. Let |newOptions| be [$StructuredDeserialize$](|serializedOptions|, [=the current Realm=]).
3. Set |newOptions.format| to `undefined`
4. Let |rgbFrame| be the result of running the [=VideoFrame/Convert to RGB frame=]
algorithm with `options.format`, `options.rect`, and `options.colorSpace`.
5. Return the result of calling {{VideoFrame/copyTo()}} on |rgbFrame| with
6. If |options|.{{VideoFrameCopyToOptions/format}} does not equal to
{{VideoFrame/[[format]]}} and |options|.{{VideoFrameCopyToOptions/format}}
is equal to one of {{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} then:
1. Let |newOptions| be the result of running the <a>Clone Configuration</a>
algorithm with |options|.
2. Assign `undefined` to |newOptions|.{{VideoFrameCopyToOptions/format}}
and |newOptions|.{{VideoFrameCopyToOptions/rect}}.
3. Let |rect| be `undefined`.
4. If |options|.{{VideoFrameCopyToOptions/rect}} [=map/exists=], assign the
value of |options|.{{VideoFrameCopyToOptions/rect}} to |rect|.
5. Otherwise, assign the value of {{VideoFrame/visibleRect}} to |rect|.
6. Let |rgbFrame| be the result of running the [=VideoFrame/Convert to RGB frame=]
algorithm with |options|.{{VideoFrameCopyToOptions/format}}, |rect|, and `options.colorSpace`.
7. Return the result of calling {{VideoFrame/copyTo()}} on |rgbFrame| with
|destination| and |newOptions|.
7. Let |p| be a new {{Promise}}.
8. Let |copyStepsQueue| be the result of starting a new [=parallel queue=].
Expand Down Expand Up @@ -4305,13 +4311,13 @@
invalid to specify planes that overlap.
: <dfn dict-member for=VideoFrameCopyToOptions>format</dfn>
:: A {{VideoPixelFormat}} for the pixel data in the destination
{{BufferSource}}. Explicit values can be:
{{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} or the same as {{VideoFrame/format}}.
{{BufferSource}}. Potential values are:
{{RGBA}}, {{RGBX}}, {{BGRA}}, {{BGRX}} and values of {{VideoFrame/format}}.
If unspecified, the {{VideoFrame/format}} is used.
: <dfn dict-member for=VideoFrameCopyToOptions>colorSpace</dfn>
:: A {{PredefinedColorSpace}} that <em class="rfc2119">SHALL</em> be used to as
a target color space for for the pixel data in the destination
{{BufferSource}}.
{{BufferSource}}. If unspecified, {{srgb}} is used.


DOMRects in VideoFrame {#videoframe-domrect}
Expand Down

0 comments on commit 97d1519

Please sign in to comment.