Chromium Code Reviews| 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 10 matching lines...) Expand all Loading... | |
| 21 #include "base/synchronization/condition_variable.h" | 21 #include "base/synchronization/condition_variable.h" |
| 22 #include "base/synchronization/lock.h" | 22 #include "base/synchronization/lock.h" |
| 23 #include "base/threading/thread.h" | 23 #include "base/threading/thread.h" |
| 24 #include "content/common/content_export.h" | 24 #include "content/common/content_export.h" |
| 25 #include "content/common/gpu/media/vaapi_h264_decoder.h" | 25 #include "content/common/gpu/media/vaapi_h264_decoder.h" |
| 26 #include "content/common/gpu/media/vaapi_wrapper.h" | 26 #include "content/common/gpu/media/vaapi_wrapper.h" |
| 27 #include "media/base/bitstream_buffer.h" | 27 #include "media/base/bitstream_buffer.h" |
| 28 #include "media/video/picture.h" | 28 #include "media/video/picture.h" |
| 29 #include "media/video/video_decode_accelerator.h" | 29 #include "media/video/video_decode_accelerator.h" |
| 30 | 30 |
| 31 namespace gpu { | |
| 32 namespace gles2 { | |
| 33 class TextureManager; | |
| 34 } | |
| 35 } | |
| 36 | |
| 31 namespace content { | 37 namespace content { |
| 32 | 38 |
| 33 class VaapiPicture; | 39 class VaapiPicture; |
| 34 | 40 |
| 35 // Class to provide video decode acceleration for Intel systems with hardware | 41 // Class to provide video decode acceleration for Intel systems with hardware |
| 36 // support for it, and on which libva is available. | 42 // support for it, and on which libva is available. |
| 37 // Decoding tasks are performed in a separate decoding thread. | 43 // Decoding tasks are performed in a separate decoding thread. |
| 38 // | 44 // |
| 39 // Threading/life-cycle: this object is created & destroyed on the GPU | 45 // Threading/life-cycle: this object is created & destroyed on the GPU |
| 40 // ChildThread. A few methods on it are called on the decoder thread which is | 46 // ChildThread. A few methods on it are called on the decoder thread which is |
| 41 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread | 47 // stopped during |this->Destroy()|, so any tasks posted to the decoder thread |
| 42 // can assume |*this| is still alive. See |weak_this_| below for more details. | 48 // can assume |*this| is still alive. See |weak_this_| below for more details. |
| 43 class CONTENT_EXPORT VaapiVideoDecodeAccelerator | 49 class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
| 44 : public media::VideoDecodeAccelerator { | 50 : public media::VideoDecodeAccelerator { |
| 45 public: | 51 public: |
| 46 VaapiVideoDecodeAccelerator( | 52 VaapiVideoDecodeAccelerator( |
| 47 const base::Callback<bool(void)>& make_context_current); | 53 const base::Callback<bool(void)>& make_context_current, |
| 54 gpu::gles2::TextureManager* texture_manager); | |
| 48 virtual ~VaapiVideoDecodeAccelerator(); | 55 virtual ~VaapiVideoDecodeAccelerator(); |
| 49 | 56 |
| 50 // media::VideoDecodeAccelerator implementation. | 57 // media::VideoDecodeAccelerator implementation. |
| 51 virtual bool Initialize(media::VideoCodecProfile profile, | 58 virtual bool Initialize(media::VideoCodecProfile profile, |
| 52 Client* client) override; | 59 Client* client) override; |
| 53 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; | 60 virtual void Decode(const media::BitstreamBuffer& bitstream_buffer) override; |
| 54 virtual void AssignPictureBuffers( | 61 virtual void AssignPictureBuffers( |
| 55 const std::vector<media::PictureBuffer>& buffers) override; | 62 const std::vector<media::PictureBuffer>& buffers) override; |
| 56 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; | 63 virtual void ReusePictureBuffer(int32 picture_buffer_id) override; |
| 57 virtual void Flush() override; | 64 virtual void Flush() override; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 257 bool finish_flush_pending_; | 264 bool finish_flush_pending_; |
| 258 | 265 |
| 259 // Decoder requested a new surface set and we are waiting for all the surfaces | 266 // Decoder requested a new surface set and we are waiting for all the surfaces |
| 260 // to be returned before we can free them. | 267 // to be returned before we can free them. |
| 261 bool awaiting_va_surfaces_recycle_; | 268 bool awaiting_va_surfaces_recycle_; |
| 262 | 269 |
| 263 // Last requested number/resolution of output picture buffers. | 270 // Last requested number/resolution of output picture buffers. |
| 264 size_t requested_num_pics_; | 271 size_t requested_num_pics_; |
| 265 gfx::Size requested_pic_size_; | 272 gfx::Size requested_pic_size_; |
| 266 | 273 |
| 274 gpu::gles2::TextureManager* texture_manager_; | |
|
alexst (slow to review)
2015/01/19 19:02:17
Is it safe to cache this here from a lifetime pers
achaulk
2015/01/19 19:05:49
It should be. This object is owned by the GpuVideo
| |
| 275 | |
| 267 // The WeakPtrFactory for |weak_this_|. | 276 // The WeakPtrFactory for |weak_this_|. |
| 268 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; | 277 base::WeakPtrFactory<VaapiVideoDecodeAccelerator> weak_this_factory_; |
| 269 | 278 |
| 270 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); | 279 DISALLOW_COPY_AND_ASSIGN(VaapiVideoDecodeAccelerator); |
| 271 }; | 280 }; |
| 272 | 281 |
| 273 } // namespace content | 282 } // namespace content |
| 274 | 283 |
| 275 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ | 284 #endif // CONTENT_COMMON_GPU_MEDIA_VAAPI_VIDEO_DECODE_ACCELERATOR_H_ |
| OLD | NEW |