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

Side by Side Diff: content/common/gpu/media/v4l2_video_encode_accelerator.cc

Issue 1553263002: Remove Pass on CrOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix //components/exo too Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « components/exo/wayland/server.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <fcntl.h> 5 #include <fcntl.h>
6 #include <linux/videodev2.h> 6 #include <linux/videodev2.h>
7 #include <poll.h> 7 #include <poll.h>
8 #include <string.h> 8 #include <string.h>
9 #include <sys/eventfd.h> 9 #include <sys/eventfd.h>
10 #include <sys/ioctl.h> 10 #include <sys/ioctl.h>
11 #include <sys/mman.h> 11 #include <sys/mman.h>
12 #include <utility>
12 13
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/macros.h" 16 #include "base/macros.h"
16 #include "base/numerics/safe_conversions.h" 17 #include "base/numerics/safe_conversions.h"
17 #include "base/thread_task_runner_handle.h" 18 #include "base/thread_task_runner_handle.h"
18 #include "base/trace_event/trace_event.h" 19 #include "base/trace_event/trace_event.h"
19 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h" 20 #include "content/common/gpu/media/v4l2_video_encode_accelerator.h"
20 #include "content/public/common/content_switches.h" 21 #include "content/public/common/content_switches.h"
21 #include "media/base/bitstream_buffer.h" 22 #include "media/base/bitstream_buffer.h"
(...skipping 24 matching lines...) Expand all
46 if (device_->Ioctl(type, arg) != 0) \ 47 if (device_->Ioctl(type, arg) != 0) \
47 PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \ 48 PLOG(ERROR) << __func__ << "(): ioctl() failed: " << #type; \
48 } while (0) 49 } while (0)
49 50
50 namespace content { 51 namespace content {
51 52
52 struct V4L2VideoEncodeAccelerator::BitstreamBufferRef { 53 struct V4L2VideoEncodeAccelerator::BitstreamBufferRef {
53 BitstreamBufferRef(int32_t id, 54 BitstreamBufferRef(int32_t id,
54 scoped_ptr<base::SharedMemory> shm, 55 scoped_ptr<base::SharedMemory> shm,
55 size_t size) 56 size_t size)
56 : id(id), shm(shm.Pass()), size(size) {} 57 : id(id), shm(std::move(shm)), size(size) {}
57 const int32_t id; 58 const int32_t id;
58 const scoped_ptr<base::SharedMemory> shm; 59 const scoped_ptr<base::SharedMemory> shm;
59 const size_t size; 60 const size_t size;
60 }; 61 };
61 62
62 V4L2VideoEncodeAccelerator::InputRecord::InputRecord() : at_device(false) { 63 V4L2VideoEncodeAccelerator::InputRecord::InputRecord() : at_device(false) {
63 } 64 }
64 65
65 V4L2VideoEncodeAccelerator::InputRecord::~InputRecord() { 66 V4L2VideoEncodeAccelerator::InputRecord::~InputRecord() {
66 } 67 }
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 232 }
232 233
233 scoped_ptr<base::SharedMemory> shm( 234 scoped_ptr<base::SharedMemory> shm(
234 new base::SharedMemory(buffer.handle(), false)); 235 new base::SharedMemory(buffer.handle(), false));
235 if (!shm->Map(buffer.size())) { 236 if (!shm->Map(buffer.size())) {
236 NOTIFY_ERROR(kPlatformFailureError); 237 NOTIFY_ERROR(kPlatformFailureError);
237 return; 238 return;
238 } 239 }
239 240
240 scoped_ptr<BitstreamBufferRef> buffer_ref( 241 scoped_ptr<BitstreamBufferRef> buffer_ref(
241 new BitstreamBufferRef(buffer.id(), shm.Pass(), buffer.size())); 242 new BitstreamBufferRef(buffer.id(), std::move(shm), buffer.size()));
242 encoder_thread_.message_loop()->PostTask( 243 encoder_thread_.message_loop()->PostTask(
243 FROM_HERE, 244 FROM_HERE,
244 base::Bind(&V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask, 245 base::Bind(&V4L2VideoEncodeAccelerator::UseOutputBitstreamBufferTask,
245 base::Unretained(this), 246 base::Unretained(this),
246 base::Passed(&buffer_ref))); 247 base::Passed(&buffer_ref)));
247 } 248 }
248 249
249 void V4L2VideoEncodeAccelerator::RequestEncodingParametersChange( 250 void V4L2VideoEncodeAccelerator::RequestEncodingParametersChange(
250 uint32_t bitrate, 251 uint32_t bitrate,
251 uint32_t framerate) { 252 uint32_t framerate) {
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
1167 reqbufs.count = 0; 1168 reqbufs.count = 0;
1168 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; 1169 reqbufs.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE;
1169 reqbufs.memory = V4L2_MEMORY_MMAP; 1170 reqbufs.memory = V4L2_MEMORY_MMAP;
1170 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs); 1171 IOCTL_OR_LOG_ERROR(VIDIOC_REQBUFS, &reqbufs);
1171 1172
1172 output_buffer_map_.clear(); 1173 output_buffer_map_.clear();
1173 free_output_buffers_.clear(); 1174 free_output_buffers_.clear();
1174 } 1175 }
1175 1176
1176 } // namespace content 1177 } // namespace content
OLDNEW
« no previous file with comments | « components/exo/wayland/server.cc ('k') | ui/events/ozone/evdev/input_device_factory_evdev.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698