Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1195)

Unified Diff: media/gpu/avda_shared_state.h

Issue 2005103004: AVDACodecImages keep their backing SurfaceTexture alive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@neverdetach
Patch Set: Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/gpu/avda_shared_state.h
diff --git a/media/gpu/avda_shared_state.h b/media/gpu/avda_shared_state.h
index 1366b1f17fe72b7421d9f2c87b82c9d65b55b63a..4f4c5b5e1c5855dab4c6478a0c061167bcab8bad 100644
--- a/media/gpu/avda_shared_state.h
+++ b/media/gpu/avda_shared_state.h
@@ -8,7 +8,7 @@
#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/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_image.h"
#include "ui/gl/gl_surface.h"
@@ -28,31 +28,24 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
public:
AVDASharedState();
- GLint surface_texture_service_id() const {
+ GLuint surface_texture_service_id() const {
return surface_texture_service_id_;
}
- // Set the SurfaceTexture's client texture name, which the SurfaceTexture
- // might not know about yet (see surface_texture_is_attached()).
- void set_surface_texture_service_id(GLint id) {
- surface_texture_service_id_ = id;
- }
-
// Signal the "frame available" event. This may be called from any thread.
void SignalFrameAvailable();
void WaitForFrameAvailable();
- // Context that the surface texture is bound to, or nullptr if it is not in
- // the attached state.
+ void SetSurfaceTexture(scoped_refptr<gfx::SurfaceTexture> surface_texture,
+ GLuint attached_service_id);
+
+ // Context and surface that |surface_texture_| is bound to, if
+ // |surface_texture_| is not null.
gfx::GLContext* context() const { return context_.get(); }
gfx::GLSurface* surface() const { return surface_.get(); }
- bool surface_texture_is_attached() const {
- return surface_texture_is_attached_;
- }
-
// Iterates over all known codec images and updates the MediaCodec attached to
// each one.
void CodecChanged(media::MediaCodecBridge* codec);
@@ -63,16 +56,6 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
void SetImageForPicture(int picture_buffer_id, AVDACodecImage* image);
AVDACodecImage* GetImageForPicture(int picture_buffer_id) const;
- // TODO(liberato): move the surface texture here and make these calls
- // attach / detach it also. There are several changes going on in avda
- // concurrently, so I don't want to change that until the dust settles.
- // AVDACodecImage would no longer hold the surface texture.
-
- // 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 DidAttachSurfaceTexture();
-
// Helper method for coordinating the interactions between
// MediaCodec::ReleaseOutputBuffer() and WaitForFrameAvailable() when
// rendering to a SurfaceTexture; this method should never be called when
@@ -99,19 +82,16 @@ class AVDASharedState : public base::RefCounted<AVDASharedState> {
private:
friend class base::RefCounted<AVDASharedState>;
- // 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_;
+ scoped_refptr<gfx::SurfaceTexture> surface_texture_;
+
+ // Platform gl texture id for |surface_texture_|.
+ GLuint surface_texture_service_id_;
// For signalling OnFrameAvailable().
base::WaitableEvent frame_available_event_;
- // True if and only if the surface texture is currently attached.
- bool surface_texture_is_attached_;
-
- // Context and surface that the surface texture is attached to, if it is
- // currently attached.
+ // Context and surface that |surface_texture_| is bound to, if
+ // |surface_texture_| is not null.
scoped_refptr<gfx::GLContext> context_;
scoped_refptr<gfx::GLSurface> surface_;

Powered by Google App Engine
This is Rietveld 408576698