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

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

Issue 590403004: rendering_helper - Schedule RenderContent() based on VSync. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 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
« no previous file with comments | « no previous file | content/common/gpu/media/rendering_helper.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ 6 #define CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <queue> 9 #include <queue>
10 #include <vector> 10 #include <vector>
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 // Sets alpha_solid to true if the alpha channel is entirely 0xff. 122 // Sets alpha_solid to true if the alpha channel is entirely 0xff.
123 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, 123 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
124 bool* alpha_solid, 124 bool* alpha_solid,
125 base::WaitableEvent* done); 125 base::WaitableEvent* done);
126 126
127 private: 127 private:
128 struct RenderedVideo { 128 struct RenderedVideo {
129 // The rect on the screen where the video will be rendered. 129 // The rect on the screen where the video will be rendered.
130 gfx::Rect render_area; 130 gfx::Rect render_area;
131 131
132 // True if the last (and the only one) frame in pending_frames has
133 // been rendered. We keep the last remaining frame in pending_frames even
134 // after it has been rendered, so that we have something to display if the
135 // client is falling behind on providing us with new frames during
136 // timer-driven playback.
137 bool last_frame_rendered;
138
139 // True if there won't be any new video frames comming. 132 // True if there won't be any new video frames comming.
140 bool is_flushing; 133 bool is_flushing;
141 134
142 // The number of frames need to be dropped to catch up the rendering. 135 // The number of frames need to be dropped to catch up the rendering. We
136 // always keep the last remaining frame in pending_frames even after it
137 // has been rendered, so that we have something to display if the client
138 // is falling behind on providing us with new frames during timer-driven
139 // playback.
143 int frames_to_drop; 140 int frames_to_drop;
144 141
145 // The video frames pending for rendering. 142 // The video frames pending for rendering.
146 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; 143 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames;
147 144
148 RenderedVideo(); 145 RenderedVideo();
149 ~RenderedVideo(); 146 ~RenderedVideo();
150 }; 147 };
151 148
152 void Clear(); 149 void Clear();
153 150
154 void RenderContent(); 151 void RenderContent();
155 152
156 void WarmUpRendering(int warm_up_iterations); 153 void WarmUpRendering(int warm_up_iterations);
157 154
158 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes); 155 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes);
159 156
157 void UpdateVSyncParameters(base::WaitableEvent* done,
158 const base::TimeTicks timebase,
159 const base::TimeDelta interval);
160
161 void DropOneFrameForAllVideos();
162 void ScheduleNextRenderContent();
163
160 // Render |texture_id| to the current view port of the screen using target 164 // Render |texture_id| to the current view port of the screen using target
161 // |texture_target|. 165 // |texture_target|.
162 void RenderTexture(uint32 texture_target, uint32 texture_id); 166 void RenderTexture(uint32 texture_target, uint32 texture_id);
163 167
164 base::MessageLoop* message_loop_; 168 base::MessageLoop* message_loop_;
165 169
166 scoped_refptr<gfx::GLContext> gl_context_; 170 scoped_refptr<gfx::GLContext> gl_context_;
167 scoped_refptr<gfx::GLSurface> gl_surface_; 171 scoped_refptr<gfx::GLSurface> gl_surface_;
168 172
169 gfx::AcceleratedWidget window_; 173 gfx::AcceleratedWidget window_;
170 174
171 gfx::Size screen_size_; 175 gfx::Size screen_size_;
172 176
173 std::vector<RenderedVideo> videos_; 177 std::vector<RenderedVideo> videos_;
174 178
175 bool render_as_thumbnails_; 179 bool render_as_thumbnails_;
176 int frame_count_; 180 int frame_count_;
177 GLuint thumbnails_fbo_id_; 181 GLuint thumbnails_fbo_id_;
178 GLuint thumbnails_texture_id_; 182 GLuint thumbnails_texture_id_;
179 gfx::Size thumbnails_fbo_size_; 183 gfx::Size thumbnails_fbo_size_;
180 gfx::Size thumbnail_size_; 184 gfx::Size thumbnail_size_;
181 GLuint program_; 185 GLuint program_;
182 base::TimeDelta frame_duration_; 186 base::TimeDelta frame_duration_;
183 base::TimeTicks scheduled_render_time_; 187 base::TimeTicks scheduled_render_time_;
184 base::CancelableClosure render_task_; 188 base::CancelableClosure render_task_;
189 base::TimeTicks vsync_timebase_;
190 base::TimeDelta vsync_interval_;
185 191
186 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); 192 DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
187 }; 193 };
188 194
189 } // namespace content 195 } // namespace content
190 196
191 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ 197 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_
OLDNEW
« no previous file with comments | « no previous file | content/common/gpu/media/rendering_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698