| Index: content/common/gpu/media/vt_video_decode_accelerator.h
|
| diff --git a/content/common/gpu/media/vt_video_decode_accelerator.h b/content/common/gpu/media/vt_video_decode_accelerator.h
|
| index 44f563b81bff3fe6fd0e96ee9015063f4878df74..0a385096d437969b7de6b7dcee66c8bd5bb4736f 100644
|
| --- a/content/common/gpu/media/vt_video_decode_accelerator.h
|
| +++ b/content/common/gpu/media/vt_video_decode_accelerator.h
|
| @@ -10,6 +10,7 @@
|
| #include <map>
|
| #include <queue>
|
|
|
| +#include "base/containers/scoped_ptr_map.h"
|
| #include "base/mac/scoped_cftyperef.h"
|
| #include "base/memory/linked_ptr.h"
|
| #include "base/memory/weak_ptr.h"
|
| @@ -22,6 +23,7 @@
|
| #include "media/video/video_decode_accelerator.h"
|
| #include "ui/gfx/geometry/size.h"
|
| #include "ui/gl/gl_context_cgl.h"
|
| +#include "ui/gl/gl_image_io_surface.h"
|
|
|
| namespace content {
|
|
|
| @@ -33,7 +35,9 @@ bool InitializeVideoToolbox();
|
| class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
|
| public:
|
| explicit VTVideoDecodeAccelerator(
|
| - const base::Callback<bool(void)>& make_context_current);
|
| + const base::Callback<bool(void)>& make_context_current,
|
| + const base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)>&
|
| + bind_image);
|
| ~VTVideoDecodeAccelerator() override;
|
|
|
| // VideoDecodeAccelerator implementation.
|
| @@ -113,6 +117,26 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
|
| linked_ptr<Frame> frame;
|
| };
|
|
|
| + struct PictureInfo {
|
| + PictureInfo(uint32_t client_texture_id, uint32_t service_texture_id);
|
| + ~PictureInfo();
|
| +
|
| + // Image buffer, kept alive while they are bound to pictures.
|
| + base::ScopedCFTypeRef<CVImageBufferRef> cv_image;
|
| +
|
| + // The GLImage representation of |cv_image|. This is kept around to ensure
|
| + // that Destroy is called on it before it hits its destructor (there is a
|
| + // DCHECK that requires this).
|
| + scoped_refptr<gfx::GLImageIOSurface> gl_image;
|
| +
|
| + // Texture IDs for the image buffer.
|
| + const uint32_t client_texture_id;
|
| + const uint32_t service_texture_id;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(PictureInfo);
|
| + };
|
| +
|
| //
|
| // Methods for interacting with VideoToolbox. Run on |decoder_thread_|.
|
| //
|
| @@ -163,6 +187,7 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
|
| // GPU thread state.
|
| //
|
| base::Callback<bool(void)> make_context_current_;
|
| + base::Callback<void(uint32, uint32, scoped_refptr<gfx::GLImage>)> bind_image_;
|
| media::VideoDecodeAccelerator::Client* client_;
|
| State state_;
|
|
|
| @@ -200,15 +225,12 @@ class VTVideoDecodeAccelerator : public media::VideoDecodeAccelerator {
|
| // released immediately because we need the reuse event to free the binding.)
|
| std::set<int32_t> assigned_picture_ids_;
|
|
|
| - // Texture IDs of assigned pictures.
|
| - std::map<int32_t, uint32_t> texture_ids_;
|
| + // Texture IDs and image buffers of assigned pictures.
|
| + base::ScopedPtrMap<int32_t, scoped_ptr<PictureInfo>> picture_info_map_;
|
|
|
| // Pictures ready to be rendered to.
|
| std::vector<int32_t> available_picture_ids_;
|
|
|
| - // Image buffers kept alive while they are bound to pictures.
|
| - std::map<int32_t, base::ScopedCFTypeRef<CVImageBufferRef>> picture_bindings_;
|
| -
|
| //
|
| // Decoder thread state.
|
| //
|
|
|