OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ | 5 #ifndef CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ |
6 #define CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ | 6 #define CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ |
7 | 7 |
8 #include "base/synchronization/waitable_event.h" | 8 #include "base/synchronization/waitable_event.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
10 #include "media/base/android/media_codec_bridge.h" | 10 #include "media/base/android/media_codec_bridge.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // Context that the surface texture is bound to, or nullptr if it is not in | 43 // Context that the surface texture is bound to, or nullptr if it is not in |
44 // the attached state. | 44 // the attached state. |
45 gfx::GLContext* context() const { return context_.get(); } | 45 gfx::GLContext* context() const { return context_.get(); } |
46 | 46 |
47 gfx::GLSurface* surface() const { return surface_.get(); } | 47 gfx::GLSurface* surface() const { return surface_.get(); } |
48 | 48 |
49 bool surface_texture_is_attached() const { | 49 bool surface_texture_is_attached() const { |
50 return surface_texture_is_attached_; | 50 return surface_texture_is_attached_; |
51 } | 51 } |
52 | 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 |
53 // Call this when the SurfaceTexture is attached to a GL context. This will | 58 // Call this when the SurfaceTexture is attached to a GL context. This will |
54 // update surface_texture_is_attached(), and set the context() and surface() | 59 // update surface_texture_is_attached(), and set the context() and surface() |
55 // to match. | 60 // to match. |
56 void did_attach_surface_texture(); | 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(); |
57 | 66 |
58 private: | 67 private: |
59 // Platform gl texture Id for |surface_texture_|. This will be zero if | 68 // Platform gl texture Id for |surface_texture_|. This will be zero if |
60 // and only if |texture_owner_| is null. | 69 // and only if |texture_owner_| is null. |
61 // TODO(liberato): This should be GLuint, but we don't seem to have the type. | 70 // TODO(liberato): This should be GLuint, but we don't seem to have the type. |
62 GLint surface_texture_service_id_; | 71 GLint surface_texture_service_id_; |
63 | 72 |
64 // For signalling OnFrameAvailable(). | 73 // For signalling OnFrameAvailable(). |
65 base::WaitableEvent frame_available_event_; | 74 base::WaitableEvent frame_available_event_; |
66 | 75 |
67 // True if and only if the surface texture is currently attached. | 76 // True if and only if the surface texture is currently attached. |
68 bool surface_texture_is_attached_; | 77 bool surface_texture_is_attached_; |
69 | 78 |
70 // Context and surface that the surface texture is attached to, if it is | 79 // Context and surface that the surface texture is attached to, if it is |
71 // currently attached. | 80 // currently attached. |
72 scoped_refptr<gfx::GLContext> context_; | 81 scoped_refptr<gfx::GLContext> context_; |
73 scoped_refptr<gfx::GLSurface> surface_; | 82 scoped_refptr<gfx::GLSurface> surface_; |
74 | 83 |
75 protected: | 84 protected: |
76 virtual ~AVDASharedState(); | 85 virtual ~AVDASharedState(); |
77 | 86 |
78 private: | 87 private: |
79 friend class base::RefCounted<AVDASharedState>; | 88 friend class base::RefCounted<AVDASharedState>; |
80 }; | 89 }; |
81 | 90 |
82 } // namespace content | 91 } // namespace content |
83 | 92 |
84 #endif // CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ | 93 #endif // CONTENT_COMMON_GPU_AVDA_SHARED_STATE_H_ |
OLD | NEW |