Commit 52a68d3d authored by Thomas Guilbert's avatar Thomas Guilbert Committed by Commit Bot

Crop ImageBitmaps from VideoFrames

This CL adds consideration for a frame's visible_rect when creating an
image bitmap, instead of using only the coded_rect. This fixes rows of
pixels being repeated at the bottom of an image.

Bug: 1145244
Change-Id: I534a9e768203ceee889827c370d2acfd574c77fe
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2518108Reviewed-by: default avatarDan Sanders <sandersd@chromium.org>
Commit-Queue: Thomas Guilbert <tguilbert@chromium.org>
Cr-Commit-Position: refs/heads/master@{#823786}
parent b4eb8d7c
......@@ -315,8 +315,13 @@ scoped_refptr<const media::VideoFrame> VideoFrame::frame() const {
ScriptPromise VideoFrame::createImageBitmap(ScriptState* script_state,
const ImageBitmapOptions* options,
ExceptionState& exception_state) {
return ImageBitmapFactories::CreateImageBitmap(
script_state, this, base::Optional<IntRect>(), options, exception_state);
base::Optional<IntRect> crop_rect;
if (auto local_frame = handle_->frame())
crop_rect = IntRect(local_frame->visible_rect());
return ImageBitmapFactories::CreateImageBitmap(script_state, this, crop_rect,
options, exception_state);
}
IntSize VideoFrame::BitmapSourceSize() const {
......
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