OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_MEDIA_RENDERING_HELPER_H_ | 5 #ifndef MEDIA_GPU_RENDERING_HELPER_H_ |
6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 6 #define MEDIA_GPU_RENDERING_HELPER_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <queue> | 12 #include <queue> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "base/cancelable_callback.h" | 15 #include "base/cancelable_callback.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "build/build_config.h" | 18 #include "build/build_config.h" |
19 #include "ui/gfx/geometry/rect.h" | 19 #include "ui/gfx/geometry/rect.h" |
20 #include "ui/gfx/geometry/size.h" | 20 #include "ui/gfx/geometry/size.h" |
21 #include "ui/gl/gl_bindings.h" | 21 #include "ui/gl/gl_bindings.h" |
22 #include "ui/gl/gl_context.h" | 22 #include "ui/gl/gl_context.h" |
23 #include "ui/gl/gl_surface.h" | 23 #include "ui/gl/gl_surface.h" |
24 | 24 |
25 namespace base { | 25 namespace base { |
26 class MessageLoop; | 26 class MessageLoop; |
27 class WaitableEvent; | 27 class WaitableEvent; |
28 } | 28 } |
29 | 29 |
30 namespace ui { | 30 namespace ui { |
31 class DisplayConfigurator; | 31 class DisplayConfigurator; |
32 } | 32 } |
33 | 33 |
34 namespace content { | 34 namespace media { |
35 | 35 |
36 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { | 36 class VideoFrameTexture : public base::RefCounted<VideoFrameTexture> { |
37 public: | 37 public: |
38 uint32_t texture_id() const { return texture_id_; } | 38 uint32_t texture_id() const { return texture_id_; } |
39 uint32_t texture_target() const { return texture_target_; } | 39 uint32_t texture_target() const { return texture_target_; } |
40 | 40 |
41 VideoFrameTexture(uint32_t texture_target, | 41 VideoFrameTexture(uint32_t texture_target, |
42 uint32_t texture_id, | 42 uint32_t texture_id, |
43 const base::Closure& no_longer_needed_cb); | 43 const base::Closure& no_longer_needed_cb); |
44 | 44 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 gfx::Size thumbnails_page_size; | 78 gfx::Size thumbnails_page_size; |
79 // The size of each thumbnail within the FBO. | 79 // The size of each thumbnail within the FBO. |
80 gfx::Size thumbnail_size; | 80 gfx::Size thumbnail_size; |
81 }; | 81 }; |
82 | 82 |
83 // Creates and draws textures used by the video decoder. | 83 // Creates and draws textures used by the video decoder. |
84 // This class is not thread safe and thus all the methods of this class | 84 // This class is not thread safe and thus all the methods of this class |
85 // (except for ctor/dtor) ensure they're being run on a single thread. | 85 // (except for ctor/dtor) ensure they're being run on a single thread. |
86 class RenderingHelper { | 86 class RenderingHelper { |
87 public: | 87 public: |
88 | |
89 RenderingHelper(); | 88 RenderingHelper(); |
90 ~RenderingHelper(); | 89 ~RenderingHelper(); |
91 | 90 |
92 // Initialize GL. This method must be called on the rendering | 91 // Initialize GL. This method must be called on the rendering |
93 // thread. | 92 // thread. |
94 static void InitializeOneOff(base::WaitableEvent* done); | 93 static void InitializeOneOff(base::WaitableEvent* done); |
95 | 94 |
96 // Setup the platform window to display test results. This method | 95 // Setup the platform window to display test results. This method |
97 // must be called on the main thread. | 96 // must be called on the main thread. |
98 void Setup(); | 97 void Setup(); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
153 bool is_flushing; | 152 bool is_flushing; |
154 | 153 |
155 // The number of frames need to be dropped to catch up the rendering. We | 154 // The number of frames need to be dropped to catch up the rendering. We |
156 // always keep the last remaining frame in pending_frames even after it | 155 // always keep the last remaining frame in pending_frames even after it |
157 // has been rendered, so that we have something to display if the client | 156 // has been rendered, so that we have something to display if the client |
158 // is falling behind on providing us with new frames during timer-driven | 157 // is falling behind on providing us with new frames during timer-driven |
159 // playback. | 158 // playback. |
160 int frames_to_drop; | 159 int frames_to_drop; |
161 | 160 |
162 // The video frames pending for rendering. | 161 // The video frames pending for rendering. |
163 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; | 162 std::queue<scoped_refptr<VideoFrameTexture>> pending_frames; |
164 | 163 |
165 RenderedVideo(); | 164 RenderedVideo(); |
166 RenderedVideo(const RenderedVideo& other); | 165 RenderedVideo(const RenderedVideo& other); |
167 ~RenderedVideo(); | 166 ~RenderedVideo(); |
168 }; | 167 }; |
169 | 168 |
170 void Clear(); | 169 void Clear(); |
171 | 170 |
172 void RenderContent(); | 171 void RenderContent(); |
173 | 172 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 GLuint program_; | 216 GLuint program_; |
218 base::TimeDelta frame_duration_; | 217 base::TimeDelta frame_duration_; |
219 base::TimeTicks scheduled_render_time_; | 218 base::TimeTicks scheduled_render_time_; |
220 base::CancelableClosure render_task_; | 219 base::CancelableClosure render_task_; |
221 base::TimeTicks vsync_timebase_; | 220 base::TimeTicks vsync_timebase_; |
222 base::TimeDelta vsync_interval_; | 221 base::TimeDelta vsync_interval_; |
223 | 222 |
224 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); | 223 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); |
225 }; | 224 }; |
226 | 225 |
227 } // namespace content | 226 } // namespace media |
228 | 227 |
229 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ | 228 #endif // MEDIA_GPU_RENDERING_HELPER_H_ |
OLD | NEW |