Commit 7aa35e9c authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Allow planar access for I420A VideoFrames.

These appear to be commonly generated from the canvas capture path
when '{alpha: false}' is not specified. They may also be generated
from alpha vp8/vp9 decoding

R=sandersd

Fixed: 1148800
Change-Id: I5da2aed405b6ed7c0708dae1aee2bb397731c26e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2542936Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#828931}
parent 34cb4a34
...@@ -219,10 +219,12 @@ VideoFrame* VideoFrame::Create(ImageBitmap* source, ...@@ -219,10 +219,12 @@ VideoFrame* VideoFrame::Create(ImageBitmap* source,
// static // static
bool VideoFrame::IsSupportedPlanarFormat(media::VideoFrame* frame) { bool VideoFrame::IsSupportedPlanarFormat(media::VideoFrame* frame) {
// For now only I420 or NV12 in CPU or GPU memory is supported. // For now only I420, I420A, or NV12 in CPU or GPU memory is supported.
return frame && (frame->IsMappable() || frame->HasGpuMemoryBuffer()) && return frame && (frame->IsMappable() || frame->HasGpuMemoryBuffer()) &&
((frame->format() == media::PIXEL_FORMAT_I420 && ((frame->format() == media::PIXEL_FORMAT_I420 &&
frame->layout().num_planes() == 3) || frame->layout().num_planes() == 3) ||
(frame->format() == media::PIXEL_FORMAT_I420A &&
frame->layout().num_planes() == 4) ||
(frame->format() == media::PIXEL_FORMAT_NV12 && (frame->format() == media::PIXEL_FORMAT_NV12 &&
frame->layout().num_planes() == 2)); frame->layout().num_planes() == 2));
} }
...@@ -234,6 +236,7 @@ String VideoFrame::format() const { ...@@ -234,6 +236,7 @@ String VideoFrame::format() const {
switch (local_frame->format()) { switch (local_frame->format()) {
case media::PIXEL_FORMAT_I420: case media::PIXEL_FORMAT_I420:
case media::PIXEL_FORMAT_I420A:
return V8VideoPixelFormat(V8VideoPixelFormat::Enum::kI420); return V8VideoPixelFormat(V8VideoPixelFormat::Enum::kI420);
case media::PIXEL_FORMAT_NV12: case media::PIXEL_FORMAT_NV12:
return V8VideoPixelFormat(V8VideoPixelFormat::Enum::kNV12); return V8VideoPixelFormat(V8VideoPixelFormat::Enum::kNV12);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
// https://github.com/WICG/web-codecs // https://github.com/WICG/web-codecs
enum VideoPixelFormat { enum VideoPixelFormat {
// 4:2:0 subsampled 3 plane Y,U,V // 4:2:0 subsampled 3 plane Y,U,V or 4 plane Y,U,V,A
"I420", "I420",
// 4:2:0 subsampled 2 plane Y,UV // 4:2:0 subsampled 2 plane Y,UV
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment