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

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

Issue 1135943005: Revert of content/common: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
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 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_ 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_
6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_
7 7
8 #include <linux/videodev2.h> 8 #include <linux/videodev2.h>
9 #include <list> 9 #include <list>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/memory/linked_ptr.h" 12 #include "base/memory/linked_ptr.h"
13 #include "base/memory/weak_ptr.h" 13 #include "base/memory/weak_ptr.h"
14 #include "base/threading/thread.h" 14 #include "base/threading/thread.h"
15 #include "content/common/content_export.h" 15 #include "content/common/content_export.h"
16 #include "content/common/gpu/media/v4l2_device.h" 16 #include "content/common/gpu/media/v4l2_device.h"
17 #include "content/common/gpu/media/v4l2_image_processor.h" 17 #include "content/common/gpu/media/v4l2_image_processor.h"
18 #include "media/video/video_encode_accelerator.h" 18 #include "media/video/video_encode_accelerator.h"
19 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
20 20
21 namespace base {
22
23 class MessageLoopProxy;
24
25 } // namespace base
26
21 namespace media { 27 namespace media {
22 28
23 class BitstreamBuffer; 29 class BitstreamBuffer;
24 30
25 } // namespace media 31 } // namespace media
26 32
27 namespace content { 33 namespace content {
28 34
29 // This class handles video encode acceleration by interfacing with a V4L2 35 // This class handles video encode acceleration by interfacing with a V4L2
30 // device exposed by the codec hardware driver. The threading model of this 36 // device exposed by the codec hardware driver. The threading model of this
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 bool CreateInputBuffers(); 185 bool CreateInputBuffers();
180 bool CreateOutputBuffers(); 186 bool CreateOutputBuffers();
181 187
182 // Destroy these buffers. 188 // Destroy these buffers.
183 void DestroyInputBuffers(); 189 void DestroyInputBuffers();
184 void DestroyOutputBuffers(); 190 void DestroyOutputBuffers();
185 191
186 // Set controls in |ctrls| and return true if successful. 192 // Set controls in |ctrls| and return true if successful.
187 bool SetExtCtrls(std::vector<struct v4l2_ext_control> ctrls); 193 bool SetExtCtrls(std::vector<struct v4l2_ext_control> ctrls);
188 194
189 // Our original calling task runner for the child thread. 195 // Our original calling message loop for the child thread.
190 const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; 196 const scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_;
191 197
192 gfx::Size visible_size_; 198 gfx::Size visible_size_;
193 // Input allocated size required by the device. 199 // Input allocated size required by the device.
194 gfx::Size input_allocated_size_; 200 gfx::Size input_allocated_size_;
195 size_t output_buffer_byte_size_; 201 size_t output_buffer_byte_size_;
196 202
197 // Formats for input frames and the output stream. 203 // Formats for input frames and the output stream.
198 media::VideoFrame::Format device_input_format_; 204 media::VideoFrame::Format device_input_format_;
199 size_t input_planes_count_; 205 size_t input_planes_count_;
200 uint32 output_format_fourcc_; 206 uint32 output_format_fourcc_;
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 // This thread services tasks posted from the VEA API entry points by the 255 // This thread services tasks posted from the VEA API entry points by the
250 // child thread and device service callbacks posted from the device thread. 256 // child thread and device service callbacks posted from the device thread.
251 base::Thread encoder_thread_; 257 base::Thread encoder_thread_;
252 258
253 // The device polling thread handles notifications of V4L2 device changes. 259 // The device polling thread handles notifications of V4L2 device changes.
254 // TODO(sheu): replace this thread with an TYPE_IO encoder_thread_. 260 // TODO(sheu): replace this thread with an TYPE_IO encoder_thread_.
255 base::Thread device_poll_thread_; 261 base::Thread device_poll_thread_;
256 262
257 // To expose client callbacks from VideoEncodeAccelerator. 263 // To expose client callbacks from VideoEncodeAccelerator.
258 // NOTE: all calls to these objects *MUST* be executed on 264 // NOTE: all calls to these objects *MUST* be executed on
259 // child_task_runner_. 265 // child_message_loop_proxy_.
260 base::WeakPtr<Client> client_; 266 base::WeakPtr<Client> client_;
261 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_; 267 scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_;
262 268
263 // WeakPtr<> pointing to |this| for use in posting tasks from the 269 // WeakPtr<> pointing to |this| for use in posting tasks from the
264 // image_processor_ back to the child thread. 270 // image_processor_ back to the child thread.
265 // Tasks posted onto encoder and poll threads can use base::Unretained(this), 271 // Tasks posted onto encoder and poll threads can use base::Unretained(this),
266 // as both threads will not outlive this object. 272 // as both threads will not outlive this object.
267 base::WeakPtr<V4L2VideoEncodeAccelerator> weak_this_; 273 base::WeakPtr<V4L2VideoEncodeAccelerator> weak_this_;
268 base::WeakPtrFactory<V4L2VideoEncodeAccelerator> weak_this_ptr_factory_; 274 base::WeakPtrFactory<V4L2VideoEncodeAccelerator> weak_this_ptr_factory_;
269 275
270 DISALLOW_COPY_AND_ASSIGN(V4L2VideoEncodeAccelerator); 276 DISALLOW_COPY_AND_ASSIGN(V4L2VideoEncodeAccelerator);
271 }; 277 };
272 278
273 } // namespace content 279 } // namespace content
274 280
275 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_ 281 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_VIDEO_ENCODE_ACCELERATOR_H_
OLDNEW
« no previous file with comments | « content/common/gpu/media/v4l2_video_decode_accelerator.cc ('k') | content/common/gpu/media/v4l2_video_encode_accelerator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698