Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Unified Diff: media/gpu/v4l2_image_processor.cc

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/gpu/v4l2_image_processor.cc
diff --git a/content/common/gpu/media/v4l2_image_processor.cc b/media/gpu/v4l2_image_processor.cc
similarity index 95%
rename from content/common/gpu/media/v4l2_image_processor.cc
rename to media/gpu/v4l2_image_processor.cc
index 1ac70298f282adc47848572a19f4ce28cc9d2ad7..092bb094d6bcfbad341b9efd2e8ac43b19a7cf5d 100644
--- a/content/common/gpu/media/v4l2_image_processor.cc
+++ b/media/gpu/v4l2_image_processor.cc
@@ -15,8 +15,8 @@
#include "base/bind_helpers.h"
#include "base/callback.h"
#include "base/numerics/safe_conversions.h"
-#include "content/common/gpu/media/v4l2_image_processor.h"
#include "media/base/bind_to_current_loop.h"
+#include "media/gpu/v4l2_image_processor.h"
#define IOCTL_OR_ERROR_RETURN_VALUE(type, arg, value, type_str) \
do { \
@@ -32,29 +32,25 @@
#define IOCTL_OR_ERROR_RETURN_FALSE(type, arg) \
IOCTL_OR_ERROR_RETURN_VALUE(type, arg, false, #type)
-#define IOCTL_OR_LOG_ERROR(type, arg) \
- do { \
- if (device_->Ioctl(type, arg) != 0) \
- PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \
+#define IOCTL_OR_LOG_ERROR(type, arg) \
+ do { \
+ if (device_->Ioctl(type, arg) != 0) \
+ PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \
} while (0)
-namespace content {
+namespace media {
-V4L2ImageProcessor::InputRecord::InputRecord() : at_device(false) {
-}
+V4L2ImageProcessor::InputRecord::InputRecord() : at_device(false) {}
-V4L2ImageProcessor::InputRecord::~InputRecord() {
-}
+V4L2ImageProcessor::InputRecord::~InputRecord() {}
V4L2ImageProcessor::OutputRecord::OutputRecord() : at_device(false) {}
-V4L2ImageProcessor::OutputRecord::~OutputRecord() {
-}
+V4L2ImageProcessor::OutputRecord::~OutputRecord() {}
V4L2ImageProcessor::JobRecord::JobRecord() : output_buffer_index(-1) {}
-V4L2ImageProcessor::JobRecord::~JobRecord() {
-}
+V4L2ImageProcessor::JobRecord::~JobRecord() {}
V4L2ImageProcessor::V4L2ImageProcessor(const scoped_refptr<V4L2Device>& device)
: input_format_(media::PIXEL_FORMAT_UNKNOWN),
@@ -143,7 +139,8 @@ bool V4L2ImageProcessor::Initialize(media::VideoPixelFormat input_format,
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_QUERYCAP, &caps);
if ((caps.capabilities & kCapsRequired) != kCapsRequired) {
LOG(ERROR) << "Initialize(): ioctl() failed: VIDIOC_QUERYCAP: "
- "caps check failed: 0x" << std::hex << caps.capabilities;
+ "caps check failed: 0x"
+ << std::hex << caps.capabilities;
return false;
}
@@ -193,10 +190,8 @@ void V4L2ImageProcessor::Process(const scoped_refptr<media::VideoFrame>& frame,
job_record->ready_cb = cb;
device_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2ImageProcessor::ProcessTask,
- base::Unretained(this),
- base::Passed(&job_record)));
+ FROM_HERE, base::Bind(&V4L2ImageProcessor::ProcessTask,
+ base::Unretained(this), base::Passed(&job_record)));
}
void V4L2ImageProcessor::ProcessTask(std::unique_ptr<JobRecord> job_record) {
@@ -280,8 +275,8 @@ bool V4L2ImageProcessor::CreateInputBuffers() {
IOCTL_OR_ERROR_RETURN_FALSE(VIDIOC_S_FMT, &format);
input_allocated_size_ = V4L2Device::CodedSizeFromV4L2Format(format);
- DCHECK(gfx::Rect(input_allocated_size_).Contains(
- gfx::Rect(input_visible_size_)));
+ DCHECK(gfx::Rect(input_allocated_size_)
+ .Contains(gfx::Rect(input_visible_size_)));
struct v4l2_crop crop;
memset(&crop, 0, sizeof(crop));
@@ -336,8 +331,8 @@ bool V4L2ImageProcessor::CreateOutputBuffers() {
gfx::Size adjusted_allocated_size =
V4L2Device::CodedSizeFromV4L2Format(format);
- DCHECK(gfx::Rect(adjusted_allocated_size).Contains(
- gfx::Rect(output_allocated_size_)));
+ DCHECK(gfx::Rect(adjusted_allocated_size)
+ .Contains(gfx::Rect(output_allocated_size_)));
output_allocated_size_ = adjusted_allocated_size;
struct v4l2_crop crop;
@@ -408,9 +403,8 @@ void V4L2ImageProcessor::DevicePollTask(bool poll_device) {
// All processing should happen on ServiceDeviceTask(), since we shouldn't
// touch encoder state from this thread.
device_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(&V4L2ImageProcessor::ServiceDeviceTask,
- base::Unretained(this)));
+ FROM_HERE, base::Bind(&V4L2ImageProcessor::ServiceDeviceTask,
+ base::Unretained(this)));
}
void V4L2ImageProcessor::ServiceDeviceTask() {
@@ -579,8 +573,10 @@ bool V4L2ImageProcessor::EnqueueInputRecord() {
qbuf.m.planes = qbuf_planes;
qbuf.length = input_planes_count_;
for (size_t i = 0; i < input_planes_count_; ++i) {
- qbuf.m.planes[i].bytesused = media::VideoFrame::PlaneSize(
- input_record.frame->format(), i, input_allocated_size_).GetArea();
+ qbuf.m.planes[i].bytesused =
+ media::VideoFrame::PlaneSize(input_record.frame->format(), i,
+ input_allocated_size_)
+ .GetArea();
qbuf.m.planes[i].length = qbuf.m.planes[i].bytesused;
qbuf.m.planes[i].m.userptr =
reinterpret_cast<unsigned long>(input_record.frame->data(i));
@@ -632,9 +628,8 @@ bool V4L2ImageProcessor::StartDevicePoll() {
// Enqueue a poll task with no devices to poll on - will wait only for the
// poll interrupt
device_poll_thread_.message_loop()->PostTask(
- FROM_HERE,
- base::Bind(
- &V4L2ImageProcessor::DevicePollTask, base::Unretained(this), false));
+ FROM_HERE, base::Bind(&V4L2ImageProcessor::DevicePollTask,
+ base::Unretained(this), false));
return true;
}
@@ -694,4 +689,4 @@ void V4L2ImageProcessor::FrameReady(const FrameReadyCB& cb,
cb.Run(output_buffer_index);
}
-} // namespace content
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698