Chromium Code Reviews| 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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 212 opacity_changed_cb_.Run(IsOpaque(frame)); | 212 opacity_changed_cb_.Run(IsOpaque(frame)); |
| 213 | 213 |
| 214 current_frame_ = frame; | 214 current_frame_ = frame; |
| 215 return true; | 215 return true; |
| 216 } | 216 } |
| 217 | 217 |
| 218 void VideoFrameCompositor::BackgroundRender() { | 218 void VideoFrameCompositor::BackgroundRender() { |
| 219 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 219 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 220 const base::TimeTicks now = tick_clock_->NowTicks(); | 220 const base::TimeTicks now = tick_clock_->NowTicks(); |
| 221 last_background_render_ = now; | 221 last_background_render_ = now; |
| 222 CallRender(now, now + last_interval_, true); | 222 bool new_frame = CallRender(now, now + last_interval_, true); |
| 223 if (new_frame && client_) | |
| 224 client_->DidReceiveFrame(); | |
|
DaleCurtis
2015/08/14 21:50:03
Hmm, this means we're calling SetNeedsRedraw() eve
DaleCurtis
2015/08/14 21:51:41
Actually this can happen as frequently as every 4m
| |
| 223 } | 225 } |
| 224 | 226 |
| 225 bool VideoFrameCompositor::CallRender(base::TimeTicks deadline_min, | 227 bool VideoFrameCompositor::CallRender(base::TimeTicks deadline_min, |
| 226 base::TimeTicks deadline_max, | 228 base::TimeTicks deadline_max, |
| 227 bool background_rendering) { | 229 bool background_rendering) { |
| 228 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 230 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 229 | 231 |
| 230 base::AutoLock lock(lock_); | 232 base::AutoLock lock(lock_); |
| 231 if (!callback_) { | 233 if (!callback_) { |
| 232 // Even if we no longer have a callback, return true if we have a frame | 234 // Even if we no longer have a callback, return true if we have a frame |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 256 last_interval_ = deadline_max - deadline_min; | 258 last_interval_ = deadline_max - deadline_min; |
| 257 | 259 |
| 258 // Restart the background rendering timer whether we're background rendering | 260 // Restart the background rendering timer whether we're background rendering |
| 259 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. | 261 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. |
| 260 if (background_rendering_enabled_) | 262 if (background_rendering_enabled_) |
| 261 background_rendering_timer_.Reset(); | 263 background_rendering_timer_.Reset(); |
| 262 return new_frame || had_new_background_frame; | 264 return new_frame || had_new_background_frame; |
| 263 } | 265 } |
| 264 | 266 |
| 265 } // namespace media | 267 } // namespace media |
| OLD | NEW |