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 2bde3e0cef75a83e99b2166fdf772137a66460f2..eed87a13cf69f9143458cc82a4e536b9c90966d0 100644 |
--- a/content/common/gpu/media/vaapi_video_decode_accelerator.h |
+++ b/content/common/gpu/media/vaapi_video_decode_accelerator.h |
@@ -13,22 +13,25 @@ |
#include <utility> |
#include <vector> |
+#include "base/containers/scoped_ptr_hash_map.h" |
#include "base/logging.h" |
-#include "base/memory/linked_ptr.h" |
#include "base/memory/shared_memory.h" |
#include "base/memory/weak_ptr.h" |
#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" |
+#include "content/common/gpu/media/vaapi_picture_provider.h" |
#include "content/common/gpu/media/vaapi_wrapper.h" |
#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 { |
@@ -44,7 +47,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 +126,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); |
+ VaapiPictureProvider::Picture* picture); |
// Try to OutputPicture() if we have both a ready surface and picture. |
void TryOutputSurface(); |
@@ -149,9 +149,8 @@ private: |
void TryFinishSurfaceSetChange(); |
// Client-provided X/GLX state. |
- Display* x_display_; |
+ gfx::GLContext* gl_context_; |
base::Callback<bool(void)> make_context_current_; |
- GLXFBConfig fb_config_; |
// VAVDA state. |
enum State { |
@@ -196,13 +195,13 @@ 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 |
+ typedef base::ScopedPtrHashMap<int32, VaapiPictureProvider::Picture> Pictures; |
Pawel Osciak
2014/09/24 11:27:12
Why do we need a hashmap?
llandwerlin-old
2014/10/02 14:14:23
I couldn't find a data structure with the same pro
Pawel Osciak
2014/10/08 08:17:21
linked_ptr currently used does delete...
llandwerlin-old
2014/10/13 16:53:00
Removing this change.
|
+ // All allocated Pictures, regardless of their current state. Pictures |
// are allocated once and destroyed at the end of decode. |
- TFPPictures tfp_pictures_; |
+ Pictures pictures_; |
// Return a TFPPicture associated with given client-provided id. |
Pawel Osciak
2014/09/24 11:27:12
s/TFPPicture/Picture/
llandwerlin-old
2014/10/02 14:14:23
Acknowledged.
|
- TFPPicture* TFPPictureById(int32 picture_buffer_id); |
+ VaapiPictureProvider::Picture* 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 +211,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(VaapiPictureProvider::Picture*)> OutputCB; |
std::queue<OutputCB> pending_output_cbs_; |
// ChildThread's message loop |
@@ -244,6 +243,8 @@ private: |
scoped_ptr<VaapiWrapper> vaapi_wrapper_; |
+ scoped_ptr<VaapiPictureProvider> vaapi_picture_provider_; |
+ |
// Comes after vaapi_wrapper_ to ensure its destructor is executed before |
// vaapi_wrapper_ is destroyed. |
scoped_ptr<VaapiH264Decoder> decoder_; |