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 MEDIA_GPU_AVDA_SHARED_STATE_H_ | 5 #ifndef MEDIA_GPU_AVDA_SHARED_STATE_H_ |
6 #define MEDIA_GPU_AVDA_SHARED_STATE_H_ | 6 #define MEDIA_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" |
11 #include "media/base/android/sdk_media_codec_bridge.h" | 11 #include "media/base/android/sdk_media_codec_bridge.h" |
12 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
13 #include "ui/gl/gl_image.h" | 13 #include "ui/gl/gl_image.h" |
14 #include "ui/gl/gl_surface.h" | 14 #include "ui/gl/gl_surface.h" |
15 | 15 |
16 namespace gfx { | 16 namespace gl { |
17 class SurfaceTexture; | 17 class SurfaceTexture; |
18 } | 18 } |
19 | 19 |
20 namespace media { | 20 namespace media { |
21 | 21 |
22 class AVDACodecImage; | 22 class AVDACodecImage; |
23 class MediaCodecBridge; | 23 class MediaCodecBridge; |
24 | 24 |
25 // Shared state to allow communication between the AVDA and the | 25 // Shared state to allow communication between the AVDA and the |
26 // GLImages that configure GL for drawing the frames. | 26 // GLImages that configure GL for drawing the frames. |
(...skipping 11 matching lines...) Expand all Loading... |
38 surface_texture_service_id_ = id; | 38 surface_texture_service_id_ = id; |
39 } | 39 } |
40 | 40 |
41 // Signal the "frame available" event. This may be called from any thread. | 41 // Signal the "frame available" event. This may be called from any thread. |
42 void SignalFrameAvailable(); | 42 void SignalFrameAvailable(); |
43 | 43 |
44 void WaitForFrameAvailable(); | 44 void WaitForFrameAvailable(); |
45 | 45 |
46 // Context that the surface texture is bound to, or nullptr if it is not in | 46 // Context that the surface texture is bound to, or nullptr if it is not in |
47 // the attached state. | 47 // the attached state. |
48 gfx::GLContext* context() const { return context_.get(); } | 48 gl::GLContext* context() const { return context_.get(); } |
49 | 49 |
50 gfx::GLSurface* surface() const { return surface_.get(); } | 50 gl::GLSurface* surface() const { return surface_.get(); } |
51 | 51 |
52 bool surface_texture_is_attached() const { | 52 bool surface_texture_is_attached() const { |
53 return surface_texture_is_attached_; | 53 return surface_texture_is_attached_; |
54 } | 54 } |
55 | 55 |
56 // Iterates over all known codec images and updates the MediaCodec attached to | 56 // Iterates over all known codec images and updates the MediaCodec attached to |
57 // each one. | 57 // each one. |
58 void CodecChanged(media::MediaCodecBridge* codec); | 58 void CodecChanged(media::MediaCodecBridge* codec); |
59 | 59 |
60 // Methods for finding and updating the AVDACodecImage associated with a given | 60 // Methods for finding and updating the AVDACodecImage associated with a given |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 GLint surface_texture_service_id_; | 105 GLint surface_texture_service_id_; |
106 | 106 |
107 // For signalling OnFrameAvailable(). | 107 // For signalling OnFrameAvailable(). |
108 base::WaitableEvent frame_available_event_; | 108 base::WaitableEvent frame_available_event_; |
109 | 109 |
110 // True if and only if the surface texture is currently attached. | 110 // True if and only if the surface texture is currently attached. |
111 bool surface_texture_is_attached_; | 111 bool surface_texture_is_attached_; |
112 | 112 |
113 // Context and surface that the surface texture is attached to, if it is | 113 // Context and surface that the surface texture is attached to, if it is |
114 // currently attached. | 114 // currently attached. |
115 scoped_refptr<gfx::GLContext> context_; | 115 scoped_refptr<gl::GLContext> context_; |
116 scoped_refptr<gfx::GLSurface> surface_; | 116 scoped_refptr<gl::GLSurface> surface_; |
117 | 117 |
118 // Maps a picture buffer id to a AVDACodecImage. | 118 // Maps a picture buffer id to a AVDACodecImage. |
119 std::map<int, AVDACodecImage*> codec_images_; | 119 std::map<int, AVDACodecImage*> codec_images_; |
120 | 120 |
121 // The time of the last call to RenderCodecBufferToSurfaceTexture(), null if | 121 // The time of the last call to RenderCodecBufferToSurfaceTexture(), null if |
122 // if there has been no last call or WaitForFrameAvailable() has been called | 122 // if there has been no last call or WaitForFrameAvailable() has been called |
123 // since the last call. | 123 // since the last call. |
124 base::TimeTicks release_time_; | 124 base::TimeTicks release_time_; |
125 | 125 |
126 DISALLOW_COPY_AND_ASSIGN(AVDASharedState); | 126 DISALLOW_COPY_AND_ASSIGN(AVDASharedState); |
127 }; | 127 }; |
128 | 128 |
129 } // namespace media | 129 } // namespace media |
130 | 130 |
131 #endif // MEDIA_GPU_AVDA_SHARED_STATE_H_ | 131 #endif // MEDIA_GPU_AVDA_SHARED_STATE_H_ |
OLD | NEW |