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

Side by Side Diff: content/common/gpu/media/avda_shared_state.h

Issue 1882373004: Migrate content/common/gpu/media code to media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix several more bot-identified build issues Created 4 years, 8 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
6 #define CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
7
8 #include "base/synchronization/waitable_event.h"
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
10 #include "media/base/android/media_codec_bridge.h"
11 #include "media/base/android/sdk_media_codec_bridge.h"
12 #include "ui/gl/gl_context.h"
13 #include "ui/gl/gl_image.h"
14 #include "ui/gl/gl_surface.h"
15
16 namespace gfx {
17 class SurfaceTexture;
18 }
19
20 namespace content {
21
22 // Shared state to allow communication between the AVDA and the
23 // GLImages that configure GL for drawing the frames.
24 class AVDASharedState : public base::RefCounted<AVDASharedState> {
25 public:
26 AVDASharedState();
27
28 GLint surface_texture_service_id() const {
29 return surface_texture_service_id_;
30 }
31
32 // Set the SurfaceTexture's client texture name, which the SurfaceTexture
33 // might not know about yet (see surface_texture_is_attached()).
34 void set_surface_texture_service_id(GLint id) {
35 surface_texture_service_id_ = id;
36 }
37
38 // Signal the "frame available" event. This may be called from any thread.
39 void SignalFrameAvailable();
40
41 void WaitForFrameAvailable();
42
43 // Context that the surface texture is bound to, or nullptr if it is not in
44 // the attached state.
45 gfx::GLContext* context() const { return context_.get(); }
46
47 gfx::GLSurface* surface() const { return surface_.get(); }
48
49 bool surface_texture_is_attached() const {
50 return surface_texture_is_attached_;
51 }
52
53 // TODO(liberato): move the surface texture here and make these calls
54 // attach / detach it also. There are several changes going on in avda
55 // concurrently, so I don't want to change that until the dust settles.
56 // AVDACodecImage would no longer hold the surface texture.
57
58 // Call this when the SurfaceTexture is attached to a GL context. This will
59 // update surface_texture_is_attached(), and set the context() and surface()
60 // to match.
61 void DidAttachSurfaceTexture();
62
63 // Call this when the SurfaceTexture is detached from its GL context. This
64 // will cause us to forget the last binding.
65 void DidDetachSurfaceTexture();
66
67 private:
68 // Platform gl texture Id for |surface_texture_|. This will be zero if
69 // and only if |texture_owner_| is null.
70 // TODO(liberato): This should be GLuint, but we don't seem to have the type.
71 GLint surface_texture_service_id_;
72
73 // For signalling OnFrameAvailable().
74 base::WaitableEvent frame_available_event_;
75
76 // True if and only if the surface texture is currently attached.
77 bool surface_texture_is_attached_;
78
79 // Context and surface that the surface texture is attached to, if it is
80 // currently attached.
81 scoped_refptr<gfx::GLContext> context_;
82 scoped_refptr<gfx::GLSurface> surface_;
83
84 protected:
85 virtual ~AVDASharedState();
86
87 private:
88 friend class base::RefCounted<AVDASharedState>;
89 };
90
91 } // namespace content
92
93 #endif // CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698