Commit e78aab74 authored by Dean Liao's avatar Dean Liao Committed by Commit Bot

media/gpu: Fix scoped_refptr parameter passing.

According to
https://chromium.googlesource.com/chromium/src/+/master/styleguide/c++/c++.md#object-ownership-and-calling-conventions
scoped_refptr should be passed by value, not by reference.

This CL focus on image_processor. More than 200+ lines need to be
fixed in media/gpu:
~/chrome/src/media/gpu$ grep -r "const scoped_refptr<.*>&" | wc
    226    1068   21515

BUG=chromium:906479
TEST=Run VEA VDA unittest on devices (peach_pit and elm)
VEA:
video_encode_accelerator_unittest \
--test_stream_data=bear-320x180.yuv:320:180:1:bear.mp4:100000:30 \
--disable_flush --single-process-tests -v=0

VDA:
video_decode_accelerator_unittest \
--test_stream_data=/usr/local/video/test-25fps.h264:320:240:250:258:\
35:150:1 -v=0 --disable_flush --single-process-tests --ozone-platform=gbm

Change-Id: I963501af745124e565eee4a3febf5a0957d53e10
Reviewed-on: https://chromium-review.googlesource.com/c/1341288Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Commit-Queue: Shuo-Peng Liao <deanliao@google.com>
Cr-Commit-Position: refs/heads/master@{#609197}
parent 8c5fc479
...@@ -57,7 +57,7 @@ class ImageProcessor { ...@@ -57,7 +57,7 @@ class ImageProcessor {
// should pass non-empty |output_dmabuf_fds| and the processed frame will be // should pass non-empty |output_dmabuf_fds| and the processed frame will be
// stored in those buffers. If the number of |output_dmabuf_fds| is not // stored in those buffers. If the number of |output_dmabuf_fds| is not
// expected, this function will return false. // expected, this function will return false.
virtual bool Process(const scoped_refptr<VideoFrame>& frame, virtual bool Process(scoped_refptr<VideoFrame> frame,
int output_buffer_index, int output_buffer_index,
std::vector<base::ScopedFD> output_dmabuf_fds, std::vector<base::ScopedFD> output_dmabuf_fds,
FrameReadyCB cb) = 0; FrameReadyCB cb) = 0;
......
...@@ -64,7 +64,7 @@ V4L2ImageProcessor::JobRecord::JobRecord() : output_buffer_index(-1) {} ...@@ -64,7 +64,7 @@ V4L2ImageProcessor::JobRecord::JobRecord() : output_buffer_index(-1) {}
V4L2ImageProcessor::JobRecord::~JobRecord() {} V4L2ImageProcessor::JobRecord::~JobRecord() {}
V4L2ImageProcessor::V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device, V4L2ImageProcessor::V4L2ImageProcessor(scoped_refptr<V4L2Device> device,
v4l2_memory input_memory_type, v4l2_memory input_memory_type,
v4l2_memory output_memory_type) v4l2_memory output_memory_type)
: input_format_(PIXEL_FORMAT_UNKNOWN), : input_format_(PIXEL_FORMAT_UNKNOWN),
...@@ -256,7 +256,7 @@ gfx::Size V4L2ImageProcessor::output_allocated_size() const { ...@@ -256,7 +256,7 @@ gfx::Size V4L2ImageProcessor::output_allocated_size() const {
return output_allocated_size_; return output_allocated_size_;
} }
bool V4L2ImageProcessor::Process(const scoped_refptr<VideoFrame>& frame, bool V4L2ImageProcessor::Process(scoped_refptr<VideoFrame> frame,
int output_buffer_index, int output_buffer_index,
std::vector<base::ScopedFD> output_dmabuf_fds, std::vector<base::ScopedFD> output_dmabuf_fds,
FrameReadyCB cb) { FrameReadyCB cb) {
......
...@@ -28,7 +28,7 @@ namespace media { ...@@ -28,7 +28,7 @@ namespace media {
// hardware accelerators (see V4L2VideoDecodeAccelerator) for more details. // hardware accelerators (see V4L2VideoDecodeAccelerator) for more details.
class MEDIA_GPU_EXPORT V4L2ImageProcessor : public ImageProcessor { class MEDIA_GPU_EXPORT V4L2ImageProcessor : public ImageProcessor {
public: public:
explicit V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device, explicit V4L2ImageProcessor(scoped_refptr<V4L2Device> device,
v4l2_memory input_memory_type, v4l2_memory input_memory_type,
v4l2_memory output_memory_type); v4l2_memory output_memory_type);
~V4L2ImageProcessor() override; ~V4L2ImageProcessor() override;
...@@ -77,7 +77,7 @@ class MEDIA_GPU_EXPORT V4L2ImageProcessor : public ImageProcessor { ...@@ -77,7 +77,7 @@ class MEDIA_GPU_EXPORT V4L2ImageProcessor : public ImageProcessor {
// should pass non-empty |output_dmabuf_fds| and the processed frame will be // should pass non-empty |output_dmabuf_fds| and the processed frame will be
// stored in those buffers. If the number of |output_dmabuf_fds| is not // stored in those buffers. If the number of |output_dmabuf_fds| is not
// expected, this function will return false. // expected, this function will return false.
bool Process(const scoped_refptr<VideoFrame>& frame, bool Process(scoped_refptr<VideoFrame> frame,
int output_buffer_index, int output_buffer_index,
std::vector<base::ScopedFD> output_dmabuf_fds, std::vector<base::ScopedFD> output_dmabuf_fds,
FrameReadyCB cb) override; FrameReadyCB cb) override;
......
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