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

Side by Side Diff: media/blink/video_frame_compositor.cc

Issue 1299523002: Call VideoFrameProviderImpl::DidReceiveFrame when background render completes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698