From 97d1519d09f4475fc78e9d3e1b6df9c43c52f7b4 Mon Sep 17 00:00:00 2001 From: Eugene Zemtsov Date: Mon, 11 Dec 2023 21:03:01 -0800 Subject: [PATCH] More clear handling of |rect| in RGB branch of VideoFrame.copyTo --- index.src.html | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/index.src.html b/index.src.html index 08c58286..a25b7a1e 100644 --- a/index.src.html +++ b/index.src.html @@ -30,6 +30,7 @@ @@ -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 Clone Configuration + 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=]. @@ -4305,13 +4311,13 @@ invalid to specify planes that overlap. : format :: 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. : colorSpace :: A {{PredefinedColorSpace}} that SHALL 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}