Open Bug 1939711 Opened 1 year ago Updated 8 days ago

createImageBitmap cropping is not persisted in VideoFrame

Categories

(Core :: Audio/Video: Web Codecs, defect)

Firefox 133
defect

Tracking

()

ASSIGNED

People

(Reporter: github, Assigned: tnibler, NeedInfo)

Details

Attachments

(1 file)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:133.0) Gecko/20100101 Firefox/133.0

Steps to reproduce:

I am cropping ImageBitmaps using the createImageBitmap(image, sx, sy, sw, sh) API. When I want to use the cropped Image in a VideoFrame, the videoFrame will have the dimensions of the original, uncropped image.

  const originalBitmap = createTestBitmap(50, 50);  // Original 50x50 Bitmap
  const croppedBitmap = await createImageBitmap(originalBitmap, 0, 0, 10, 10); // Crop to 10x10
  const videoFrame = new VideoFrame(croppedBitmap, { timestamp: 0 }); // expected: 10x10 Videoframe

I created a jsBin with a minimal reproduction: https://jsbin.com/daxepogere/edit?html,js,output

I tested this on Firefox Windows, Linux and Android and all share this behavior.
Chromium based browsers use the cropped dimensions in the video frame.

Actual results:

The videoFrame has the dimensions of the original Bitmap instead of the cropped dimensions.

Expected results:

The videoFrame has the dimensions of the cropped Bitmap.

Not sure if this is on the video frame side, or the create image bitmap side (graphics). Chun-Min, any thoughts?

Component: Audio/Video → Audio/Video: Web Codecs
Flags: needinfo?(cchang)
Severity: -- → S3

If required, copy the cropped image portion to a new SourceSurface to
create the frame.

Assignee: nobody → dev
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9652618 - Attachment description: Bug 1939711 - Crop ImageBitmap in VideoFrame constructor if required r=#media-playback-reviewers → Bug 1939711 - Handle ImageBitmap source's crop and alpha type in VideoFrame constructor r=#media-playback-reviewers
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: