Chromium Code Reviews| Index: content/common/gpu/media/vaapi_video_decode_accelerator.h |
| diff --git a/content/common/gpu/media/vaapi_video_decode_accelerator.h b/content/common/gpu/media/vaapi_video_decode_accelerator.h |
| index 5d65da7a4ae4ae6ab4276f7475f4b639877eb30c..5c24d3f2776081c63b1f3becf5c1dc1480ed2090 100644 |
| --- a/content/common/gpu/media/vaapi_video_decode_accelerator.h |
| +++ b/content/common/gpu/media/vaapi_video_decode_accelerator.h |
| @@ -20,7 +20,6 @@ |
| #include "base/message_loop/message_loop.h" |
| #include "base/synchronization/condition_variable.h" |
| #include "base/synchronization/lock.h" |
| -#include "base/threading/non_thread_safe.h" |
| #include "base/threading/thread.h" |
| #include "content/common/content_export.h" |
| #include "content/common/gpu/media/vaapi_h264_decoder.h" |
| @@ -28,10 +27,15 @@ |
| #include "media/base/bitstream_buffer.h" |
| #include "media/video/picture.h" |
| #include "media/video/video_decode_accelerator.h" |
| -#include "ui/gl/gl_bindings.h" |
| + |
| +namespace gfx { |
| +class GLContext; |
| +} // namespace gfx |
| namespace content { |
| +class VaapiPicture; |
| + |
| // Class to provide video decode acceleration for Intel systems with hardware |
| // support for it, and on which libva is available. |
| // Decoding tasks are performed in a separate decoding thread. |
| @@ -44,7 +48,7 @@ class CONTENT_EXPORT VaapiVideoDecodeAccelerator |
| : public media::VideoDecodeAccelerator { |
| public: |
| VaapiVideoDecodeAccelerator( |
| - Display* x_display, |
| + gfx::GLContext* gl_context, |
| const base::Callback<bool(void)>& make_context_current); |
| virtual ~VaapiVideoDecodeAccelerator(); |
| @@ -123,16 +127,13 @@ private: |
| // |va_surface|. |
| void SurfaceReady(int32 input_id, const scoped_refptr<VASurface>& va_surface); |
| - // Represents a texture bound to an X Pixmap for output purposes. |
| - class TFPPicture; |
| - |
| // Callback to be executed once we have a |va_surface| to be output and |
| - // an available |tfp_picture| to use for output. |
| - // Puts contents of |va_surface| into given |tfp_picture|, releases the |
| + // an available |picture| to use for output. |
| + // Puts contents of |va_surface| into given |picture|, releases the |
| // surface and passes the resulting picture to client for output. |
| void OutputPicture(const scoped_refptr<VASurface>& va_surface, |
| int32 input_id, |
| - TFPPicture* tfp_picture); |
| + VaapiPicture* picture); |
| // Try to OutputPicture() if we have both a ready surface and picture. |
| void TryOutputSurface(); |
| @@ -148,10 +149,9 @@ private: |
| // Check if the surfaces have been released or post ourselves for later. |
| void TryFinishSurfaceSetChange(); |
| - // Client-provided X/GLX state. |
| - Display* x_display_; |
| + // Client-provided GL state. |
| + gfx::GLContext* gl_context_; |
| base::Callback<bool(void)> make_context_current_; |
| - GLXFBConfig fb_config_; |
| // VAVDA state. |
| enum State { |
| @@ -196,13 +196,8 @@ private: |
| typedef std::queue<int32> OutputBuffers; |
| OutputBuffers output_buffers_; |
| - typedef std::map<int32, linked_ptr<TFPPicture> > TFPPictures; |
| - // All allocated TFPPictures, regardless of their current state. TFPPictures |
| - // are allocated once and destroyed at the end of decode. |
| - TFPPictures tfp_pictures_; |
| - |
| // Return a TFPPicture associated with given client-provided id. |
| - TFPPicture* TFPPictureById(int32 picture_buffer_id); |
| + VaapiPicture* PictureById(int32 picture_buffer_id); |
| // VA Surfaces no longer in use that can be passed back to the decoder for |
| // reuse, once it requests them. |
| @@ -212,15 +207,15 @@ private: |
| base::ConditionVariable surfaces_available_; |
| // Pending output requests from the decoder. When it indicates that we should |
| - // output a surface and we have an available TFPPicture (i.e. texture) ready |
| - // to use, we'll execute the callback passing the TFPPicture. The callback |
| + // output a surface and we have an available Picture (i.e. texture) ready |
| + // to use, we'll execute the callback passing the Picture. The callback |
| // will put the contents of the surface into the picture and return it to |
| // the client, releasing the surface as well. |
| - // If we don't have any available TFPPictures at the time when the decoder |
| + // If we don't have any available Pictures at the time when the decoder |
| // requests output, we'll store the request on pending_output_cbs_ queue for |
| // later and run it once the client gives us more textures |
| // via ReusePictureBuffer(). |
| - typedef base::Callback<void(TFPPicture*)> OutputCB; |
| + typedef base::Callback<void(VaapiPicture*)> OutputCB; |
| std::queue<OutputCB> pending_output_cbs_; |
| // ChildThread's message loop |
| @@ -242,8 +237,16 @@ private: |
| scoped_ptr<base::WeakPtrFactory<Client> > client_ptr_factory_; |
| base::WeakPtr<Client> client_; |
| + // Comes after |pictures_| to ensure LibVA has time to destroy |
|
Pawel Osciak
2014/12/08 10:55:15
s/after/before
llandwerlin-old
2014/12/08 16:42:06
Done.
|
| + // references to X11 pixmaps before these are destroyed. |
|
Pawel Osciak
2014/12/08 10:55:15
s/these/it's/
llandwerlin-old
2014/12/08 16:42:06
Done.
|
| scoped_ptr<VaapiWrapper> vaapi_wrapper_; |
| + typedef std::map<int32, linked_ptr<VaapiPicture>> Pictures; |
| + // All allocated Pictures, regardless of their current state. Pictures |
| + // are allocated once and destroyed at the end of decode. |
| + // |pictures_| needs to be destroyed prior to |vaapi_wrapper_|. |
| + Pictures pictures_; |
| + |
| // Comes after vaapi_wrapper_ to ensure its destructor is executed before |
| // vaapi_wrapper_ is destroyed. |
| scoped_ptr<VaapiH264Decoder> decoder_; |