OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This file contains an implementation of VideoDecoderAccelerator | 5 // This file contains an implementation of VideoDecoderAccelerator |
6 // that utilizes the hardware video decoder present on the Exynos SoC. | 6 // that utilizes the hardware video decoder present on the Exynos SoC. |
7 | 7 |
8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
10 | 10 |
11 #include <list> | 11 #include <list> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback_forward.h" | 14 #include "base/callback_forward.h" |
15 #include "base/memory/linked_ptr.h" | 15 #include "base/memory/linked_ptr.h" |
16 #include "base/memory/scoped_ptr.h" | 16 #include "base/memory/scoped_ptr.h" |
17 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
18 #include "content/common/content_export.h" | 18 #include "content/common/content_export.h" |
19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" | 19 #include "content/common/gpu/media/video_decode_accelerator_impl.h" |
20 #include "media/base/limits.h" | 20 #include "media/base/limits.h" |
21 #include "media/base/video_decoder_config.h" | 21 #include "media/base/video_decoder_config.h" |
22 #include "media/video/picture.h" | |
22 #include "ui/gfx/size.h" | 23 #include "ui/gfx/size.h" |
23 #include "ui/gl/gl_bindings.h" | 24 #include "ui/gl/gl_bindings.h" |
24 | 25 |
25 namespace base { | 26 namespace base { |
26 class MessageLoopProxy; | 27 class MessageLoopProxy; |
27 } | 28 } |
28 | 29 |
29 namespace content { | 30 namespace content { |
30 class H264Parser; | 31 class H264Parser; |
31 | 32 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
170 // Record for GSC output buffers. | 171 // Record for GSC output buffers. |
171 struct GscOutputRecord { | 172 struct GscOutputRecord { |
172 GscOutputRecord(); | 173 GscOutputRecord(); |
173 ~GscOutputRecord(); | 174 ~GscOutputRecord(); |
174 bool at_device; // held by device. | 175 bool at_device; // held by device. |
175 bool at_client; // held by client. | 176 bool at_client; // held by client. |
176 int fd; // file descriptor from backing EGLImage. | 177 int fd; // file descriptor from backing EGLImage. |
177 EGLImageKHR egl_image; // backing EGLImage. | 178 EGLImageKHR egl_image; // backing EGLImage. |
178 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. | 179 EGLSyncKHR egl_sync; // sync the compositor's use of the EGLImage. |
179 int32 picture_id; // picture buffer id as returned to PictureReady(). | 180 int32 picture_id; // picture buffer id as returned to PictureReady(). |
181 bool cleared; // the texture has been cleared | |
180 }; | 182 }; |
181 | 183 |
182 // | 184 // |
183 // Decoding tasks, to be run on decode_thread_. | 185 // Decoding tasks, to be run on decode_thread_. |
184 // | 186 // |
185 | 187 |
186 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the | 188 // Enqueue a BitstreamBuffer to decode. This will enqueue a buffer to the |
187 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode | 189 // decoder_input_queue_, then queue a DecodeBufferTask() to actually decode |
188 // the buffer. | 190 // the buffer. |
189 void DecodeTask(const media::BitstreamBuffer& bitstream_buffer); | 191 void DecodeTask(const media::BitstreamBuffer& bitstream_buffer); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 // Methods run on child thread. | 311 // Methods run on child thread. |
310 // | 312 // |
311 | 313 |
312 // Destroy buffers. | 314 // Destroy buffers. |
313 void DestroyMfcInputBuffers(); | 315 void DestroyMfcInputBuffers(); |
314 void DestroyMfcOutputBuffers(); | 316 void DestroyMfcOutputBuffers(); |
315 void DestroyGscInputBuffers(); | 317 void DestroyGscInputBuffers(); |
316 void DestroyGscOutputBuffers(); | 318 void DestroyGscOutputBuffers(); |
317 void ResolutionChangeDestroyBuffers(); | 319 void ResolutionChangeDestroyBuffers(); |
318 | 320 |
321 // Send decoded buffers to PictureReady. | |
322 void SendPictureReady(); | |
323 | |
324 // Callback that indicates a picture has been cleared. | |
325 void PictureCleared(); | |
326 | |
319 // Our original calling message loop for the child thread. | 327 // Our original calling message loop for the child thread. |
320 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; | 328 scoped_refptr<base::MessageLoopProxy> child_message_loop_proxy_; |
321 | 329 |
322 // Message loop of the IO thread. | 330 // Message loop of the IO thread. |
323 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; | 331 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; |
324 | 332 |
325 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or | 333 // WeakPtr<> pointing to |this| for use in posting tasks from the decoder or |
326 // device worker threads back to the child thread. Because the worker threads | 334 // device worker threads back to the child thread. Because the worker threads |
327 // are members of this class, any task running on those threads is guaranteed | 335 // are members of this class, any task running on those threads is guaranteed |
328 // that this object is still alive. As a result, tasks posted from the child | 336 // that this object is still alive. As a result, tasks posted from the child |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
430 | 438 |
431 // GSC output buffer state. | 439 // GSC output buffer state. |
432 bool gsc_output_streamon_; | 440 bool gsc_output_streamon_; |
433 // GSC output buffers enqueued to device. | 441 // GSC output buffers enqueued to device. |
434 int gsc_output_buffer_queued_count_; | 442 int gsc_output_buffer_queued_count_; |
435 // Output buffers ready to use. We need a FIFO here. | 443 // Output buffers ready to use. We need a FIFO here. |
436 std::list<int> gsc_free_output_buffers_; | 444 std::list<int> gsc_free_output_buffers_; |
437 // Mapping of int index to GSC output buffer record. | 445 // Mapping of int index to GSC output buffer record. |
438 std::vector<GscOutputRecord> gsc_output_buffer_map_; | 446 std::vector<GscOutputRecord> gsc_output_buffer_map_; |
439 | 447 |
448 // Pictures that are ready but not sent to PictureReady yet. | |
449 std::queue<std::pair<bool, media::Picture> > pending_picture_ready_; | |
Ami GONE FROM CHROMIUM
2013/09/30 18:03:03
Doco what the bool is
piman
2013/09/30 21:49:13
nit: Better yet, make it a struct with explicit fi
wuchengli
2013/10/01 03:49:43
Done.
| |
450 | |
451 // The number of pictures that are sent to PictureReady and will be cleared. | |
452 int picture_clearing_count_; | |
453 | |
440 // Output picture size. | 454 // Output picture size. |
441 gfx::Size frame_buffer_size_; | 455 gfx::Size frame_buffer_size_; |
442 | 456 |
443 // | 457 // |
444 // The device polling thread handles notifications of V4L2 device changes. | 458 // The device polling thread handles notifications of V4L2 device changes. |
445 // | 459 // |
446 | 460 |
447 // The thread. | 461 // The thread. |
448 base::Thread device_poll_thread_; | 462 base::Thread device_poll_thread_; |
449 // eventfd fd to signal device poll thread when its poll() should be | 463 // eventfd fd to signal device poll thread when its poll() should be |
(...skipping 13 matching lines...) Expand all Loading... | |
463 | 477 |
464 // The codec we'll be decoding for. | 478 // The codec we'll be decoding for. |
465 media::VideoCodecProfile video_profile_; | 479 media::VideoCodecProfile video_profile_; |
466 | 480 |
467 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); | 481 DISALLOW_COPY_AND_ASSIGN(ExynosVideoDecodeAccelerator); |
468 }; | 482 }; |
469 | 483 |
470 } // namespace content | 484 } // namespace content |
471 | 485 |
472 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ | 486 #endif // CONTENT_COMMON_GPU_MEDIA_EXYNOS_VIDEO_DECODE_ACCELERATOR_H_ |
OLD | NEW |