OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 5 #ifndef CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 6 #define CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
7 | 7 |
8 #include <linux/videodev2.h> | 8 #include <linux/videodev2.h> |
9 #include <queue> | 9 #include <queue> |
10 #include <vector> | 10 #include <vector> |
(...skipping 20 matching lines...) Expand all Loading... |
31 : public media::VideoDecodeAccelerator { | 31 : public media::VideoDecodeAccelerator { |
32 public: | 32 public: |
33 class V4L2DecodeSurface; | 33 class V4L2DecodeSurface; |
34 | 34 |
35 V4L2SliceVideoDecodeAccelerator( | 35 V4L2SliceVideoDecodeAccelerator( |
36 const scoped_refptr<V4L2Device>& device, | 36 const scoped_refptr<V4L2Device>& device, |
37 EGLDisplay egl_display, | 37 EGLDisplay egl_display, |
38 EGLContext egl_context, | 38 EGLContext egl_context, |
39 const base::WeakPtr<Client>& io_client_, | 39 const base::WeakPtr<Client>& io_client_, |
40 const base::Callback<bool(void)>& make_context_current, | 40 const base::Callback<bool(void)>& make_context_current, |
41 const scoped_refptr<base::MessageLoopProxy>& io_message_loop_proxy); | 41 const scoped_refptr<base::SingleThreadTaskRunner>& io_task_runner); |
42 ~V4L2SliceVideoDecodeAccelerator() override; | 42 ~V4L2SliceVideoDecodeAccelerator() override; |
43 | 43 |
44 // media::VideoDecodeAccelerator implementation. | 44 // media::VideoDecodeAccelerator implementation. |
45 bool Initialize(media::VideoCodecProfile profile, | 45 bool Initialize(media::VideoCodecProfile profile, |
46 VideoDecodeAccelerator::Client* client) override; | 46 VideoDecodeAccelerator::Client* client) override; |
47 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 47 void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
48 void AssignPictureBuffers( | 48 void AssignPictureBuffers( |
49 const std::vector<media::PictureBuffer>& buffers) override; | 49 const std::vector<media::PictureBuffer>& buffers) override; |
50 void ReusePictureBuffer(int32 picture_buffer_id) override; | 50 void ReusePictureBuffer(int32 picture_buffer_id) override; |
51 void Flush() override; | 51 void Flush() override; |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 267 |
268 // Send decoded pictures to PictureReady. | 268 // Send decoded pictures to PictureReady. |
269 void SendPictureReady(); | 269 void SendPictureReady(); |
270 | 270 |
271 // Callback that indicates a picture has been cleared. | 271 // Callback that indicates a picture has been cleared. |
272 void PictureCleared(); | 272 void PictureCleared(); |
273 | 273 |
274 size_t input_planes_count_; | 274 size_t input_planes_count_; |
275 size_t output_planes_count_; | 275 size_t output_planes_count_; |
276 | 276 |
277 // GPU Child thread message loop. | 277 // GPU Child thread task runner. |
278 const scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 278 const scoped_refptr<base::SingleThreadTaskRunner> child_task_runner_; |
279 | 279 |
280 // IO thread message loop. | 280 // IO thread task runner. |
281 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 281 scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
282 | 282 |
283 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or | 283 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or |
284 // device worker threads back to the child thread. | 284 // device worker threads back to the child thread. |
285 base::WeakPtr<V4L2SliceVideoDecodeAccelerator> weak_this_; | 285 base::WeakPtr<V4L2SliceVideoDecodeAccelerator> weak_this_; |
286 | 286 |
287 // To expose client callbacks from VideoDecodeAccelerator. | 287 // To expose client callbacks from VideoDecodeAccelerator. |
288 // NOTE: all calls to these objects *MUST* be executed on | 288 // NOTE: all calls to these objects *MUST* be executed on |
289 // child_message_loop_proxy_. | 289 // child_task_runner_. |
290 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator::Client>> | 290 scoped_ptr<base::WeakPtrFactory<VideoDecodeAccelerator::Client>> |
291 client_ptr_factory_; | 291 client_ptr_factory_; |
292 base::WeakPtr<VideoDecodeAccelerator::Client> client_; | 292 base::WeakPtr<VideoDecodeAccelerator::Client> client_; |
293 // Callbacks to |io_client_| must be executed on |io_message_loop_proxy_|. | 293 // Callbacks to |io_client_| must be executed on |io_task_runner_|. |
294 base::WeakPtr<Client> io_client_; | 294 base::WeakPtr<Client> io_client_; |
295 | 295 |
296 // V4L2 device in use. | 296 // V4L2 device in use. |
297 scoped_refptr<V4L2Device> device_; | 297 scoped_refptr<V4L2Device> device_; |
298 | 298 |
299 // Thread to communicate with the device on. | 299 // Thread to communicate with the device on. |
300 base::Thread decoder_thread_; | 300 base::Thread decoder_thread_; |
301 scoped_refptr<base::MessageLoopProxy> decoder_thread_proxy_; | 301 scoped_refptr<base::SingleThreadTaskRunner> decoder_thread_task_runner_; |
302 | 302 |
303 // Thread used to poll the device for events. | 303 // Thread used to poll the device for events. |
304 base::Thread device_poll_thread_; | 304 base::Thread device_poll_thread_; |
305 | 305 |
306 // Input queue state. | 306 // Input queue state. |
307 bool input_streamon_; | 307 bool input_streamon_; |
308 // Number of input buffers enqueued to the device. | 308 // Number of input buffers enqueued to the device. |
309 int input_buffer_queued_count_; | 309 int input_buffer_queued_count_; |
310 // Input buffers ready to use; LIFO since we don't care about ordering. | 310 // Input buffers ready to use; LIFO since we don't care about ordering. |
311 std::list<int> free_input_buffers_; | 311 std::list<int> free_input_buffers_; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
388 | 388 |
389 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); | 389 DISALLOW_COPY_AND_ASSIGN(V4L2SliceVideoDecodeAccelerator); |
390 }; | 390 }; |
391 | 391 |
392 class V4L2H264Picture; | 392 class V4L2H264Picture; |
393 class V4L2VP8Picture; | 393 class V4L2VP8Picture; |
394 | 394 |
395 } // namespace content | 395 } // namespace content |
396 | 396 |
397 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ | 397 #endif // CONTENT_COMMON_GPU_MEDIA_V4L2_SLICE_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |