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

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: schedule base on vsync 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
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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 // Sets alpha_solid to true if the alpha channel is entirely 0xff. 118 // Sets alpha_solid to true if the alpha channel is entirely 0xff.
119 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb, 119 void GetThumbnailsAsRGB(std::vector<unsigned char>* rgb,
120 bool* alpha_solid, 120 bool* alpha_solid,
121 base::WaitableEvent* done); 121 base::WaitableEvent* done);
122 122
123 private: 123 private:
124 struct RenderedVideo { 124 struct RenderedVideo {
125 // The rect on the screen where the video will be rendered. 125 // The rect on the screen where the video will be rendered.
126 gfx::Rect render_area; 126 gfx::Rect render_area;
127 127
128 // True if the last (and the only one) frame in pending_frames has
129 // been rendered. We keep the last remaining frame in pending_frames even
130 // after it has been rendered, so that we have something to display if the
131 // client is falling behind on providing us with new frames during
132 // timer-driven playback.
133 bool last_frame_rendered;
134
135 // True if there won't be any new video frames comming. 128 // True if there won't be any new video frames comming.
136 bool is_flushing; 129 bool is_flushing;
137 130
138 // The number of frames need to be dropped to catch up the rendering. 131 // The number of frames need to be dropped to catch up the rendering. We
132 // always keep the last remaining frame in pending_frames even after it
133 // has been rendered, so that we have something to display if the client
134 // is falling behind on providing us with new frames during timer-driven
135 // playback.
139 int frames_to_drop; 136 int frames_to_drop;
140 137
141 // The video frames pending for rendering. 138 // The video frames pending for rendering.
142 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames; 139 std::queue<scoped_refptr<VideoFrameTexture> > pending_frames;
143 140
144 RenderedVideo(); 141 RenderedVideo();
145 ~RenderedVideo(); 142 ~RenderedVideo();
146 }; 143 };
147 144
148 void Clear(); 145 void Clear();
149 146
150 void RenderContent(); 147 void RenderContent();
151 148
152 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes); 149 void LayoutRenderingAreas(const std::vector<gfx::Size>& window_sizes);
153 150
151 void UpdateVSyncParameters(base::WaitableEvent* done,
152 const base::TimeTicks timebase,
153 const base::TimeDelta interval);
154
155 void DropOneFrameForAllVideos();
156 void ScheduleNextRenderContent();
157
154 // Render |texture_id| to the current view port of the screen using target 158 // Render |texture_id| to the current view port of the screen using target
155 // |texture_target|. 159 // |texture_target|.
156 void RenderTexture(uint32 texture_target, uint32 texture_id); 160 void RenderTexture(uint32 texture_target, uint32 texture_id);
157 161
158 base::MessageLoop* message_loop_; 162 base::MessageLoop* message_loop_;
159 163
160 scoped_refptr<gfx::GLContext> gl_context_; 164 scoped_refptr<gfx::GLContext> gl_context_;
161 scoped_refptr<gfx::GLSurface> gl_surface_; 165 scoped_refptr<gfx::GLSurface> gl_surface_;
162 166
163 gfx::AcceleratedWidget window_; 167 gfx::AcceleratedWidget window_;
164 168
165 gfx::Size screen_size_; 169 gfx::Size screen_size_;
166 170
167 std::vector<RenderedVideo> videos_; 171 std::vector<RenderedVideo> videos_;
168 172
169 bool render_as_thumbnails_; 173 bool render_as_thumbnails_;
170 int frame_count_; 174 int frame_count_;
171 GLuint thumbnails_fbo_id_; 175 GLuint thumbnails_fbo_id_;
172 GLuint thumbnails_texture_id_; 176 GLuint thumbnails_texture_id_;
173 gfx::Size thumbnails_fbo_size_; 177 gfx::Size thumbnails_fbo_size_;
174 gfx::Size thumbnail_size_; 178 gfx::Size thumbnail_size_;
175 GLuint program_; 179 GLuint program_;
176 base::TimeDelta frame_duration_; 180 base::TimeDelta frame_duration_;
177 base::TimeTicks scheduled_render_time_; 181 base::TimeTicks scheduled_render_time_;
178 base::CancelableClosure render_task_; 182 base::CancelableClosure render_task_;
183 base::TimeTicks vsync_timebase_;
184 base::TimeDelta vsync_interval_;
179 185
180 DISALLOW_COPY_AND_ASSIGN(RenderingHelper); 186 DISALLOW_COPY_AND_ASSIGN(RenderingHelper);
181 }; 187 };
182 188
183 } // namespace content 189 } // namespace content
184 190
185 #endif // CONTENT_COMMON_GPU_MEDIA_RENDERING_HELPER_H_ 191 #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') | content/common/gpu/media/rendering_helper.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698