Commit 3d043de8 authored by Alexandre Courbot's avatar Alexandre Courbot Committed by Commit Bot

v4l2 image processor: convert linked_ptr to unique_ptr

linked_ptr is deprecated. Convert it to the more suitable
unique_ptr.

BUG=None
TEST=Checked that VDA unittest was still passing on hana.

Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: Iedb039ab308416d6903974ce56eb8caba110bc43
Reviewed-on: https://chromium-review.googlesource.com/994852
Commit-Queue: Alexandre Courbot <acourbot@chromium.org>
Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#549140}
parent 0a450c32
......@@ -288,7 +288,7 @@ void V4L2ImageProcessor::ProcessTask(std::unique_ptr<JobRecord> job_record) {
std::move(job_record->output_dmabuf_fds);
EnqueueOutput(index);
input_queue_.push(make_linked_ptr(job_record.release()));
input_queue_.emplace(std::move(job_record));
EnqueueInput();
}
......@@ -667,7 +667,7 @@ void V4L2ImageProcessor::Dequeue() {
// Jobs are always processed in FIFO order.
DCHECK(!running_jobs_.empty());
linked_ptr<JobRecord> job_record = running_jobs_.front();
std::unique_ptr<JobRecord> job_record = std::move(running_jobs_.front());
running_jobs_.pop();
DVLOGF(4) << "Processing finished, returning frame, index=" << dqbuf.index;
......@@ -684,7 +684,7 @@ bool V4L2ImageProcessor::EnqueueInputRecord() {
DCHECK(!free_input_buffers_.empty());
// Enqueue an input (VIDEO_OUTPUT) buffer for an input video frame.
linked_ptr<JobRecord> job_record = input_queue_.front();
std::unique_ptr<JobRecord> job_record = std::move(input_queue_.front());
input_queue_.pop();
const int index = free_input_buffers_.back();
InputRecord& input_record = input_buffer_map_[index];
......@@ -714,13 +714,14 @@ bool V4L2ImageProcessor::EnqueueInputRecord() {
}
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QBUF, &qbuf);
input_record.at_device = true;
running_jobs_.push(job_record);
free_input_buffers_.pop_back();
input_buffer_queued_count_++;
DVLOGF(4) << "enqueued frame ts="
<< job_record->frame->timestamp().InMilliseconds() << " to device.";
running_jobs_.emplace(std::move(job_record));
free_input_buffers_.pop_back();
input_buffer_queued_count_++;
return true;
}
......
......@@ -13,7 +13,6 @@
#include "base/containers/queue.h"
#include "base/macros.h"
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/thread.h"
......@@ -199,8 +198,8 @@ class MEDIA_GPU_EXPORT V4L2ImageProcessor {
// All the below members are to be accessed from device_thread_ only
// (if it's running).
base::queue<linked_ptr<JobRecord>> input_queue_;
base::queue<linked_ptr<JobRecord>> running_jobs_;
base::queue<std::unique_ptr<JobRecord>> input_queue_;
base::queue<std::unique_ptr<JobRecord>> running_jobs_;
// Input queue state.
bool input_streamon_;
......
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