Commit c0786251 authored by Hirokazu Honda's avatar Hirokazu Honda Committed by Commit Bot

media/gpu/v4l2VEA: Replace visible_size with visible_rect

gfx::Rect is a more reasonable struct to stand for a dimension to
be encoded in VideoEncodeAccelerator than gfx::Size. It is
because the area of VideoFrame to be encoded does not necessarily
begin with (0, 0).

This CL basically changes the type to gfx::Rect keeping the logic
of V4L2VEA and the assumption about the area origin.

Bug: 1033799
Test: video.EncodeAccel* on kukui
Change-Id: Ie7a0b6bbdb9a66bfd1b85c9afa5bfff80779ee81
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2010508
Commit-Queue: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#735769}
parent 40af502e
......@@ -179,11 +179,12 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Other utility functions. Called on the |encoder_task_runner_|.
//
// Create image processor that will process input_layout to output_layout. The
// visible size of processed video frames are |visible_size|.
// Create image processor that will process |input_layout| +
// |input_visible_rect| to |output_layout|+|output_visible_rect|.
bool CreateImageProcessor(const VideoFrameLayout& input_layout,
const VideoFrameLayout& output_layout,
const gfx::Size& visible_size);
const gfx::Rect& input_visible_rect,
const gfx::Rect& output_visible_rect);
// Process one video frame in |image_processor_input_queue_| by
// |image_processor_|.
void InputImageProcessorTask();
......@@ -203,8 +204,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Reconfigure format of input buffers and image processor if frame size
// given by client is different from one set in input buffers.
bool ReconfigureFormatIfNeeded(VideoPixelFormat format,
const gfx::Size& new_frame_size);
bool ReconfigureFormatIfNeeded(const VideoFrame& frame);
// Try to set up the device to the input format we were Initialized() with,
// or if the device doesn't support it, use one it can support, so that we
......@@ -228,8 +228,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Allocates |count| video frames with |visible_size| for image processor's
// output buffers. Returns false if there's something wrong.
bool AllocateImageProcessorOutputBuffers(size_t count,
const gfx::Size& visible_size);
bool AllocateImageProcessorOutputBuffers(size_t count);
// Recycle output buffer of image processor with |output_buffer_index|.
void ReuseImageProcessorOutputBuffer(size_t output_buffer_index);
......@@ -249,7 +248,10 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;
SEQUENCE_CHECKER(child_sequence_checker_);
gfx::Size visible_size_;
// Visible rectangle of VideoFrame to be fed to an encoder driver, in other
// words, a visible rectangle that output encoded bitstream buffers represent.
gfx::Rect encoder_input_visible_rect_;
// Layout of device accepted input VideoFrame.
base::Optional<VideoFrameLayout> device_input_layout_;
......
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