OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "media/blink/video_frame_compositor.h" | 5 #include "media/blink/video_frame_compositor.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/time/default_tick_clock.h" | 9 #include "base/time/default_tick_clock.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // PaintSingleFrame() is not also called while stopped.) | 174 // PaintSingleFrame() is not also called while stopped.) |
175 if (!current_frame_) | 175 if (!current_frame_) |
176 return base::TimeDelta(); | 176 return base::TimeDelta(); |
177 return current_frame_->timestamp(); | 177 return current_frame_->timestamp(); |
178 } | 178 } |
179 | 179 |
180 bool VideoFrameCompositor::ProcessNewFrame( | 180 bool VideoFrameCompositor::ProcessNewFrame( |
181 const scoped_refptr<VideoFrame>& frame) { | 181 const scoped_refptr<VideoFrame>& frame) { |
182 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 182 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
183 | 183 |
184 if (frame == current_frame_) | 184 // TODO(tguilbert): uncomment the following code and expose a |
185 return false; | 185 // "frame refreshed" method, or some other equivalent solution. |
| 186 // if (frame == current_frame_) |
| 187 // return false; |
186 | 188 |
187 // Set the flag indicating that the current frame is unrendered, if we get a | 189 // Set the flag indicating that the current frame is unrendered, if we get a |
188 // subsequent PutCurrentFrame() call it will mark it as rendered. | 190 // subsequent PutCurrentFrame() call it will mark it as rendered. |
189 rendered_last_frame_ = false; | 191 rendered_last_frame_ = false; |
190 | 192 |
191 current_frame_ = frame; | 193 current_frame_ = frame; |
192 return true; | 194 return true; |
193 } | 195 } |
194 | 196 |
195 void VideoFrameCompositor::BackgroundRender() { | 197 void VideoFrameCompositor::BackgroundRender() { |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 last_interval_ = deadline_max - deadline_min; | 237 last_interval_ = deadline_max - deadline_min; |
236 | 238 |
237 // Restart the background rendering timer whether we're background rendering | 239 // Restart the background rendering timer whether we're background rendering |
238 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. | 240 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. |
239 if (background_rendering_enabled_) | 241 if (background_rendering_enabled_) |
240 background_rendering_timer_.Reset(); | 242 background_rendering_timer_.Reset(); |
241 return new_frame || had_new_background_frame; | 243 return new_frame || had_new_background_frame; |
242 } | 244 } |
243 | 245 |
244 } // namespace media | 246 } // namespace media |
OLD | NEW |