| 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 hardware video decoder present on Intel CPUs. | 6 // that utilizes hardware video decoder present on Intel CPUs. |
| 7 | 7 |
| 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 8 #ifndef CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
| 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 9 #define CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 #include "base/synchronization/condition_variable.h" | 22 #include "base/synchronization/condition_variable.h" |
| 23 #include "base/synchronization/lock.h" | 23 #include "base/synchronization/lock.h" |
| 24 #include "base/threading/non_thread_safe.h" | 24 #include "base/threading/non_thread_safe.h" |
| 25 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
| 26 #include "content/common/content_export.h" | 26 #include "content/common/content_export.h" |
| 27 #include "content/common/gpu/media/vaapi_h264_decoder.h" | 27 #include "content/common/gpu/media/vaapi_h264_decoder.h" |
| 28 #include "media/base/bitstream_buffer.h" | 28 #include "media/base/bitstream_buffer.h" |
| 29 #include "media/video/picture.h" | 29 #include "media/video/picture.h" |
| 30 #include "media/video/video_decode_accelerator.h" | 30 #include "media/video/video_decode_accelerator.h" |
| 31 | 31 |
| 32 namespace content { |
| 33 |
| 32 // Class to provide video decode acceleration for Intel systems with hardware | 34 // Class to provide video decode acceleration for Intel systems with hardware |
| 33 // support for it, and on which libva is available. | 35 // support for it, and on which libva is available. |
| 34 // Decoding tasks are performed in a separate decoding thread. | 36 // Decoding tasks are performed in a separate decoding thread. |
| 35 // | 37 // |
| 36 // Threading/life-cycle: this object is created & destroyed on the GPU | 38 // Threading/life-cycle: this object is created & destroyed on the GPU |
| 37 // ChildThread. A few methods on it are called on the decoder thread which is | 39 // ChildThread. A few methods on it are called on the decoder thread which is |
| 38 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 40 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
| 39 // can assume |*this| is still alive. See |weak_this_| below for more details. | 41 // can assume |*this| is still alive. See |weak_this_| below for more details. |
| 40 class CONTENT_EXPORT VaapiVideoDecodeAccelerator : | 42 class CONTENT_EXPORT VaapiVideoDecodeAccelerator : |
| 41 public media::VideoDecodeAccelerator { | 43 public media::VideoDecodeAccelerator { |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // decoder thread should use base::Unretained(this), and tasks posted from the | 194 // decoder thread should use base::Unretained(this), and tasks posted from the |
| 193 // decoder thread to the ChildThread should use |weak_this_|. | 195 // decoder thread to the ChildThread should use |weak_this_|. |
| 194 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_; | 196 base::WeakPtr<VaapiVideoDecodeAccelerator> weak_this_; |
| 195 | 197 |
| 196 // To expose client callbacks from VideoDecodeAccelerator. | 198 // To expose client callbacks from VideoDecodeAccelerator. |
| 197 // NOTE: all calls to these objects *MUST* be executed on message_loop_. | 199 // NOTE: all calls to these objects *MUST* be executed on message_loop_. |
| 198 base::WeakPtrFactory<Client> client_ptr_factory_; | 200 base::WeakPtrFactory<Client> client_ptr_factory_; |
| 199 base::WeakPtr<Client> client_; | 201 base::WeakPtr<Client> client_; |
| 200 | 202 |
| 201 base::Thread decoder_thread_; | 203 base::Thread decoder_thread_; |
| 202 content::VaapiH264Decoder decoder_; | 204 VaapiH264Decoder decoder_; |
| 203 | 205 |
| 204 int num_frames_at_client_; | 206 int num_frames_at_client_; |
| 205 int num_stream_bufs_at_decoder_; | 207 int num_stream_bufs_at_decoder_; |
| 206 | 208 |
| 207 // Posted onto ChildThread by the decoder to submit a GPU job to decode | 209 // Posted onto ChildThread by the decoder to submit a GPU job to decode |
| 208 // and put the decoded picture into output buffer. Takes ownership of | 210 // and put the decoded picture into output buffer. Takes ownership of |
| 209 // the queues' memory. | 211 // the queues' memory. |
| 210 void SubmitDecode(int32 output_id, | 212 void SubmitDecode(int32 output_id, |
| 211 std::queue<VABufferID>* va_bufs, | 213 std::queue<VABufferID>* va_bufs, |
| 212 std::queue<VABufferID>* slice_bufs); | 214 std::queue<VABufferID>* slice_bufs); |
| 213 | 215 |
| 214 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 216 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
| 215 }; | 217 }; |
| 216 | 218 |
| 219 } // namespace content |
| 220 |
| 217 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 221 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |