WebCodecs Origin Trial in Chrome 92: Breaking changes and new features

444 views
Skip to first unread message

Chris Cunningham

unread,
Jul 9, 2021, 1:13:56 PM7/9/21
to blink-dev
To WebCodecs origin trial / experimental users: 

Chrome 92 is expected to release to stable channel on July 20th. Please see below for breaking changes and new features for WebCodecs in this release.


Breaking changes


Noteworthy additions

  • New VideoFrame "regions" API for simplified pixel copying

    • New API VideoFrame.copyTo(destination, { region: ..., layout: ... }). This will replace planes.readInto() in a later release.

    • New VideoFrame.codedRegion and visibleRegion properties for convenience when calling copyTo().

    • The spec now uses the name "rectangle" (or rect) to describe regions, but "regions" is the name shipped in M92. 

  • VideoFrame is now transferrable. Putting a frame in a transfer list close()s the source frame and transfers the underlying data to a new object in the destination realm. 

  • Added ImageDecoder.completed promise

  • Added chrome://tracing support (media category) for encoders and decoders.


Best,
Chris

Žanetta Berķe

unread,
Jul 12, 2021, 3:55:25 PM7/12/21
to Chris Cunningham, blink-dev

пт, 9 июл. 2021 г., 20:13 Chris Cunningham <chcunn...@chromium.org>:
--
You received this message because you are subscribed to the Google Groups "blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blink-dev+...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CALG6eSorbF4ObPUjiD6HrqU_WnUL4u6sKc_LtaKQd25vY4mNtA%40mail.gmail.com.

Chris Cunningham

unread,
Jul 12, 2021, 5:59:25 PM7/12/21
to blink-dev

Correction: My earlier message mentions the addition of VideoFrame.copyTo(). In M92, this method is named VideoFrame.readInto() (matching Plane.readInto()).  I'll use that name in the text below. In a M93, this name will change to VideoFrame.copyTo(), as already reflected by the spec.


Other notes:


  • The PlaneInit offset member indicates where the source pixel data begins as the UA copies the data from the source buffer into its internal memory. Internally, the UA may store the data however it prefers, optionally trimming off padding bytes prior to the offset.

  • We did not add an offset attribute to the Planes interface (e.g. videoFrame.planes[i].offset). The Plane.readInto() method will always write data to the destination BufferSource starting with the 0th byte. 


NOTE: In a later release, the Planes interface will be removed entirely in favor of videoFrame.readInto().


  • By default, the new videoFrame.readInto() method will also write to the destination buffer starting with the 0th byte and each plane will be tightly packed. For convenience, callers can determine the PlaneLayout (offsets and strides) of the tightly packed planes by inspecting the returned promise's value. 


  • Callers may override the default tight packing by providing their own sequence of plane layouts when calling videoFrame.readInto(). The offsets and strides in these layouts may be totally different from those that may have been given in the PlaneInit dict during construction. 


  • Callers may use videoFrame.allocationSize(), providing options as desired, to determine the appropriate allocation size for the destination buffer provided to videoFrame.readInto().


  • In this release, videoFrame.readInto() does not accept a SharedArrayBuffer as a destination. This is an oversight on our part, remedied in M93. Apps that were already using SharedArrayBuffer may opt to continue using the videoFrame.planes[i].readInto() for M92. 


Best,
Chris

Reply all
Reply to author
Forward
0 new messages