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 ...@@ -179,11 +179,12 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Other utility functions. Called on the |encoder_task_runner_|. // Other utility functions. Called on the |encoder_task_runner_|.
// //
// Create image processor that will process input_layout to output_layout. The // Create image processor that will process |input_layout| +
// visible size of processed video frames are |visible_size|. // |input_visible_rect| to |output_layout|+|output_visible_rect|.
bool CreateImageProcessor(const VideoFrameLayout& input_layout, bool CreateImageProcessor(const VideoFrameLayout& input_layout,
const VideoFrameLayout& output_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 // Process one video frame in |image_processor_input_queue_| by
// |image_processor_|. // |image_processor_|.
void InputImageProcessorTask(); void InputImageProcessorTask();
...@@ -203,8 +204,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator ...@@ -203,8 +204,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Reconfigure format of input buffers and image processor if frame size // Reconfigure format of input buffers and image processor if frame size
// given by client is different from one set in input buffers. // given by client is different from one set in input buffers.
bool ReconfigureFormatIfNeeded(VideoPixelFormat format, bool ReconfigureFormatIfNeeded(const VideoFrame& frame);
const gfx::Size& new_frame_size);
// Try to set up the device to the input format we were Initialized() with, // 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 // 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 ...@@ -228,8 +228,7 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
// Allocates |count| video frames with |visible_size| for image processor's // Allocates |count| video frames with |visible_size| for image processor's
// output buffers. Returns false if there's something wrong. // output buffers. Returns false if there's something wrong.
bool AllocateImageProcessorOutputBuffers(size_t count, bool AllocateImageProcessorOutputBuffers(size_t count);
const gfx::Size& visible_size);
// Recycle output buffer of image processor with |output_buffer_index|. // Recycle output buffer of image processor with |output_buffer_index|.
void ReuseImageProcessorOutputBuffer(size_t output_buffer_index); void ReuseImageProcessorOutputBuffer(size_t output_buffer_index);
...@@ -249,7 +248,10 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator ...@@ -249,7 +248,10 @@ class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_;
SEQUENCE_CHECKER(child_sequence_checker_); 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. // Layout of device accepted input VideoFrame.
base::Optional<VideoFrameLayout> device_input_layout_; 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