Commit 2572ed9b authored by Chih-Yu Huang's avatar Chih-Yu Huang Committed by Commit Bot

media/gpu: Remove "const scoped_refptr<T>&" at V4L2 VEA and VDA.

The Chromium smart pointer guidelines [1] says "don't pass or return a
smart pointer by reference". This CL remove "const scoped_refptr<T>&"
at V4L2 VEA and VDA.

[1] https://www.chromium.org/developers/smart-pointer-guidelines

Bug: 1020668
Test: run vda_tests on kevin

Change-Id: I577ecf143f48f5fd3b0749a7a964e84ef1533cbc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1974722
Commit-Queue: Chih-Yu Huang <akahuang@chromium.org>
Reviewed-by: default avatarHirokazu Honda <hiroh@chromium.org>
Reviewed-by: default avatarAlexandre Courbot <acourbot@chromium.org>
Cr-Commit-Position: refs/heads/master@{#726302}
parent 387490b9
...@@ -97,7 +97,7 @@ V4L2SliceVideoDecodeAccelerator::OutputRecord::~OutputRecord() = default; ...@@ -97,7 +97,7 @@ V4L2SliceVideoDecodeAccelerator::OutputRecord::~OutputRecord() = default;
struct V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef { struct V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef {
BitstreamBufferRef( BitstreamBufferRef(
base::WeakPtr<VideoDecodeAccelerator::Client>& client, base::WeakPtr<VideoDecodeAccelerator::Client>& client,
const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner, scoped_refptr<base::SingleThreadTaskRunner> client_task_runner,
scoped_refptr<DecoderBuffer> buffer, scoped_refptr<DecoderBuffer> buffer,
int32_t input_id); int32_t input_id);
~BitstreamBufferRef(); ~BitstreamBufferRef();
...@@ -111,11 +111,11 @@ struct V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef { ...@@ -111,11 +111,11 @@ struct V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef {
V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef::BitstreamBufferRef( V4L2SliceVideoDecodeAccelerator::BitstreamBufferRef::BitstreamBufferRef(
base::WeakPtr<VideoDecodeAccelerator::Client>& client, base::WeakPtr<VideoDecodeAccelerator::Client>& client,
const scoped_refptr<base::SingleThreadTaskRunner>& client_task_runner, scoped_refptr<base::SingleThreadTaskRunner> client_task_runner,
scoped_refptr<DecoderBuffer> buffer, scoped_refptr<DecoderBuffer> buffer,
int32_t input_id) int32_t input_id)
: client(client), : client(client),
client_task_runner(client_task_runner), client_task_runner(std::move(client_task_runner)),
buffer(std::move(buffer)), buffer(std::move(buffer)),
bytes_used(0), bytes_used(0),
input_id(input_id) {} input_id(input_id) {}
...@@ -139,14 +139,14 @@ V4L2SliceVideoDecodeAccelerator::PictureRecord::PictureRecord( ...@@ -139,14 +139,14 @@ V4L2SliceVideoDecodeAccelerator::PictureRecord::PictureRecord(
V4L2SliceVideoDecodeAccelerator::PictureRecord::~PictureRecord() {} V4L2SliceVideoDecodeAccelerator::PictureRecord::~PictureRecord() {}
V4L2SliceVideoDecodeAccelerator::V4L2SliceVideoDecodeAccelerator( V4L2SliceVideoDecodeAccelerator::V4L2SliceVideoDecodeAccelerator(
const scoped_refptr<V4L2Device>& device, scoped_refptr<V4L2Device> device,
EGLDisplay egl_display, EGLDisplay egl_display,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
const MakeGLContextCurrentCallback& make_context_current_cb) const MakeGLContextCurrentCallback& make_context_current_cb)
: input_planes_count_(0), : input_planes_count_(0),
output_planes_count_(0), output_planes_count_(0),
child_task_runner_(base::ThreadTaskRunnerHandle::Get()), child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
device_(device), device_(std::move(device)),
decoder_thread_("V4L2SliceVideoDecodeAcceleratorThread"), decoder_thread_("V4L2SliceVideoDecodeAcceleratorThread"),
video_profile_(VIDEO_CODEC_PROFILE_UNKNOWN), video_profile_(VIDEO_CODEC_PROFILE_UNKNOWN),
input_format_fourcc_(0), input_format_fourcc_(0),
...@@ -776,7 +776,7 @@ void V4L2SliceVideoDecodeAccelerator::ServiceDeviceTask(bool event) { ...@@ -776,7 +776,7 @@ void V4L2SliceVideoDecodeAccelerator::ServiceDeviceTask(bool event) {
} }
void V4L2SliceVideoDecodeAccelerator::Enqueue( void V4L2SliceVideoDecodeAccelerator::Enqueue(
const scoped_refptr<V4L2DecodeSurface>& dec_surface) { scoped_refptr<V4L2DecodeSurface> dec_surface) {
DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread());
if (!EnqueueInputRecord(dec_surface.get())) { if (!EnqueueInputRecord(dec_surface.get())) {
...@@ -2003,7 +2003,7 @@ void V4L2SliceVideoDecodeAccelerator::TryOutputSurfaces() { ...@@ -2003,7 +2003,7 @@ void V4L2SliceVideoDecodeAccelerator::TryOutputSurfaces() {
void V4L2SliceVideoDecodeAccelerator::OutputSurface( void V4L2SliceVideoDecodeAccelerator::OutputSurface(
int32_t bitstream_id, int32_t bitstream_id,
const scoped_refptr<V4L2DecodeSurface>& dec_surface) { scoped_refptr<V4L2DecodeSurface> dec_surface) {
DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread());
DCHECK_EQ(decoded_buffer_map_.count(dec_surface->output_record()), 1u); DCHECK_EQ(decoded_buffer_map_.count(dec_surface->output_record()), 1u);
...@@ -2242,7 +2242,7 @@ bool V4L2SliceVideoDecodeAccelerator::ProcessFrame( ...@@ -2242,7 +2242,7 @@ bool V4L2SliceVideoDecodeAccelerator::ProcessFrame(
// In IMPORT mode we can decide ourselves which IP buffer to use, so choose // In IMPORT mode we can decide ourselves which IP buffer to use, so choose
// the one with the same index number as our decoded buffer. // the one with the same index number as our decoded buffer.
const OutputRecord& output_record = output_buffer_map_[buffer->BufferId()]; const OutputRecord& output_record = output_buffer_map_[buffer->BufferId()];
const scoped_refptr<VideoFrame>& output_frame = output_record.output_frame; scoped_refptr<VideoFrame> output_frame = output_record.output_frame;
// We will set a destruction observer to the output frame, so wrap the // We will set a destruction observer to the output frame, so wrap the
// imported frame into another one that we can destruct. // imported frame into another one that we can destruct.
......
...@@ -48,7 +48,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator ...@@ -48,7 +48,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator
public base::trace_event::MemoryDumpProvider { public base::trace_event::MemoryDumpProvider {
public: public:
V4L2SliceVideoDecodeAccelerator( V4L2SliceVideoDecodeAccelerator(
const scoped_refptr<V4L2Device>& device, scoped_refptr<V4L2Device> device,
EGLDisplay egl_display, EGLDisplay egl_display,
const BindGLImageCallback& bind_image_cb, const BindGLImageCallback& bind_image_cb,
const MakeGLContextCurrentCallback& make_context_current_cb); const MakeGLContextCurrentCallback& make_context_current_cb);
...@@ -161,7 +161,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator ...@@ -161,7 +161,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator
void ReuseOutputBuffer(V4L2ReadableBufferRef buffer); void ReuseOutputBuffer(V4L2ReadableBufferRef buffer);
// Queue a |dec_surface| to device for decoding. // Queue a |dec_surface| to device for decoding.
void Enqueue(const scoped_refptr<V4L2DecodeSurface>& dec_surface); void Enqueue(scoped_refptr<V4L2DecodeSurface> dec_surface);
// Dequeue any V4L2 buffers available and process. // Dequeue any V4L2 buffers available and process.
void Dequeue(); void Dequeue();
...@@ -333,7 +333,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator ...@@ -333,7 +333,7 @@ class MEDIA_GPU_EXPORT V4L2SliceVideoDecodeAccelerator
// decoding the stream in |bitstream_id| - after it is decoded preserving // decoding the stream in |bitstream_id| - after it is decoded preserving
// the order in which it was scheduled via SurfaceReady(). // the order in which it was scheduled via SurfaceReady().
void OutputSurface(int32_t bitstream_id, void OutputSurface(int32_t bitstream_id,
const scoped_refptr<V4L2DecodeSurface>& dec_surface); scoped_refptr<V4L2DecodeSurface> dec_surface);
// Goes over the |decoder_display_queue_| and sends all buffers from the // Goes over the |decoder_display_queue_| and sends all buffers from the
// front of the queue that are already decoded to the client, in order. // front of the queue that are already decoded to the client, in order.
......
...@@ -130,12 +130,12 @@ V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator( ...@@ -130,12 +130,12 @@ V4L2VideoDecodeAccelerator::V4L2VideoDecodeAccelerator(
EGLDisplay egl_display, EGLDisplay egl_display,
const GetGLContextCallback& get_gl_context_cb, const GetGLContextCallback& get_gl_context_cb,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const scoped_refptr<V4L2Device>& device) scoped_refptr<V4L2Device> device)
: child_task_runner_(base::ThreadTaskRunnerHandle::Get()), : child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
decoder_thread_("V4L2DecoderThread"), decoder_thread_("V4L2DecoderThread"),
decoder_state_(kUninitialized), decoder_state_(kUninitialized),
output_mode_(Config::OutputMode::ALLOCATE), output_mode_(Config::OutputMode::ALLOCATE),
device_(device), device_(std::move(device)),
decoder_delay_bitstream_buffer_id_(-1), decoder_delay_bitstream_buffer_id_(-1),
decoder_decode_buffer_tasks_scheduled_(0), decoder_decode_buffer_tasks_scheduled_(0),
decoder_flushing_(false), decoder_flushing_(false),
......
...@@ -106,7 +106,7 @@ class MEDIA_GPU_EXPORT V4L2VideoDecodeAccelerator ...@@ -106,7 +106,7 @@ class MEDIA_GPU_EXPORT V4L2VideoDecodeAccelerator
EGLDisplay egl_display, EGLDisplay egl_display,
const GetGLContextCallback& get_gl_context_cb, const GetGLContextCallback& get_gl_context_cb,
const MakeGLContextCurrentCallback& make_context_current_cb, const MakeGLContextCurrentCallback& make_context_current_cb,
const scoped_refptr<V4L2Device>& device); scoped_refptr<V4L2Device> device);
~V4L2VideoDecodeAccelerator() override; ~V4L2VideoDecodeAccelerator() override;
// VideoDecodeAccelerator implementation. // VideoDecodeAccelerator implementation.
......
...@@ -153,13 +153,13 @@ V4L2VideoEncodeAccelerator::InputFrameInfo::InputFrameInfo( ...@@ -153,13 +153,13 @@ V4L2VideoEncodeAccelerator::InputFrameInfo::InputFrameInfo(
V4L2VideoEncodeAccelerator::InputFrameInfo::~InputFrameInfo() {} V4L2VideoEncodeAccelerator::InputFrameInfo::~InputFrameInfo() {}
V4L2VideoEncodeAccelerator::V4L2VideoEncodeAccelerator( V4L2VideoEncodeAccelerator::V4L2VideoEncodeAccelerator(
const scoped_refptr<V4L2Device>& device) scoped_refptr<V4L2Device> device)
: child_task_runner_(base::ThreadTaskRunnerHandle::Get()), : child_task_runner_(base::ThreadTaskRunnerHandle::Get()),
native_input_mode_(false), native_input_mode_(false),
output_buffer_byte_size_(0), output_buffer_byte_size_(0),
output_format_fourcc_(0), output_format_fourcc_(0),
encoder_state_(kUninitialized), encoder_state_(kUninitialized),
device_(device), device_(std::move(device)),
input_memory_type_(V4L2_MEMORY_USERPTR), input_memory_type_(V4L2_MEMORY_USERPTR),
is_flush_supported_(false), is_flush_supported_(false),
// TODO(akahuang): Change to use SequencedTaskRunner to see if the // TODO(akahuang): Change to use SequencedTaskRunner to see if the
......
...@@ -47,7 +47,7 @@ namespace media { ...@@ -47,7 +47,7 @@ namespace media {
class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator class MEDIA_GPU_EXPORT V4L2VideoEncodeAccelerator
: public VideoEncodeAccelerator { : public VideoEncodeAccelerator {
public: public:
explicit V4L2VideoEncodeAccelerator(const scoped_refptr<V4L2Device>& device); explicit V4L2VideoEncodeAccelerator(scoped_refptr<V4L2Device> device);
~V4L2VideoEncodeAccelerator() override; ~V4L2VideoEncodeAccelerator() override;
// VideoEncodeAccelerator implementation. // VideoEncodeAccelerator implementation.
......
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