| Index: content/common/gpu/media/avda_shared_state.h
|
| diff --git a/content/common/gpu/media/avda_shared_state.h b/content/common/gpu/media/avda_shared_state.h
|
| index eb62681fcd5bd13474c0146f31eabaf1f8524b77..4d14272e7bd39601fc00ad0db4ba5130aa4d7a23 100644
|
| --- a/content/common/gpu/media/avda_shared_state.h
|
| +++ b/content/common/gpu/media/avda_shared_state.h
|
| @@ -5,22 +5,18 @@
|
| #ifndef CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
|
| #define CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
|
|
|
| +#include "base/macros.h"
|
| #include "base/synchronization/waitable_event.h"
|
| -#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
|
| -#include "media/base/android/media_codec_bridge.h"
|
| -#include "media/base/android/sdk_media_codec_bridge.h"
|
| +#include "ui/gl/android/surface_texture.h"
|
| +#include "ui/gl/gl_bindings.h"
|
| #include "ui/gl/gl_context.h"
|
| -#include "ui/gl/gl_image.h"
|
| #include "ui/gl/gl_surface.h"
|
|
|
| -namespace gfx {
|
| -class SurfaceTexture;
|
| -}
|
| -
|
| namespace content {
|
|
|
| -// Shared state to allow communication between the AVDA and the
|
| -// GLImages that configure GL for drawing the frames.
|
| +// Shared state to allow communication between
|
| +// AndroidDeferredRenderingBackingStrategy and the AVDACodecImages it creates.
|
| +// It's refcounted so that it lives as long as the images that refer to it.
|
| class AVDASharedState : public base::RefCounted<AVDASharedState> {
|
| public:
|
| AVDASharedState();
|
| @@ -35,10 +31,14 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
|
| surface_texture_service_id_ = id;
|
| }
|
|
|
| - // Signal the "frame available" event. This may be called from any thread.
|
| - void SignalFrameAvailable();
|
| + scoped_refptr<gfx::SurfaceTexture> surface_texture() const {
|
| + return surface_texture_;
|
| + }
|
|
|
| - void WaitForFrameAvailable();
|
| + void set_surface_texture(
|
| + const scoped_refptr<gfx::SurfaceTexture> surface_texture) {
|
| + surface_texture_ = surface_texture;
|
| + }
|
|
|
| // Context that the surface texture is bound to, or nullptr if it is not in
|
| // the attached state.
|
| @@ -50,16 +50,24 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
|
| return surface_texture_is_attached_;
|
| }
|
|
|
| + // Signal the "frame available" event. This may be called from any thread.
|
| + void SignalFrameAvailable();
|
| +
|
| + void WaitForFrameAvailable();
|
| +
|
| // Call this when the SurfaceTexture is attached to a GL context. This will
|
| // update surface_texture_is_attached(), and set the context() and surface()
|
| // to match.
|
| - void did_attach_surface_texture();
|
| + void DidAttachSurfaceTexture();
|
|
|
| private:
|
| - // Platform gl texture Id for |surface_texture_|. This will be zero if
|
| - // and only if |texture_owner_| is null.
|
| - // TODO(liberato): This should be GLuint, but we don't seem to have the type.
|
| - GLint surface_texture_service_id_;
|
| + friend class base::RefCounted<AVDASharedState>;
|
| + virtual ~AVDASharedState();
|
| +
|
| + // Platform gl texture ID for |surface_texture_|.
|
| + GLuint surface_texture_service_id_;
|
| +
|
| + scoped_refptr<gfx::SurfaceTexture> surface_texture_;
|
|
|
| // For signalling OnFrameAvailable().
|
| base::WaitableEvent frame_available_event_;
|
| @@ -72,11 +80,7 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
|
| scoped_refptr<gfx::GLContext> context_;
|
| scoped_refptr<gfx::GLSurface> surface_;
|
|
|
| - protected:
|
| - virtual ~AVDASharedState();
|
| -
|
| - private:
|
| - friend class base::RefCounted<AVDASharedState>;
|
| + DISALLOW_COPY_AND_ASSIGN(AVDASharedState);
|
| };
|
|
|
| } // namespace content
|
|
|