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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 } | 98 } |
99 | 99 |
100 bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min, | 100 bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min, |
101 base::TimeTicks deadline_max) { | 101 base::TimeTicks deadline_max) { |
102 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 102 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
103 return CallRender(deadline_min, deadline_max, false); | 103 return CallRender(deadline_min, deadline_max, false); |
104 } | 104 } |
105 | 105 |
106 bool VideoFrameCompositor::HasCurrentFrame() { | 106 bool VideoFrameCompositor::HasCurrentFrame() { |
107 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 107 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
108 return current_frame_; | 108 return static_cast<bool>(current_frame_); |
109 } | 109 } |
110 | 110 |
111 void VideoFrameCompositor::Start(RenderCallback* callback) { | 111 void VideoFrameCompositor::Start(RenderCallback* callback) { |
112 TRACE_EVENT0("media", "VideoFrameCompositor::Start"); | 112 TRACE_EVENT0("media", "VideoFrameCompositor::Start"); |
113 | 113 |
114 // Called from the media thread, so acquire the callback under lock before | 114 // Called from the media thread, so acquire the callback under lock before |
115 // returning in case a Stop() call comes in before the PostTask is processed. | 115 // returning in case a Stop() call comes in before the PostTask is processed. |
116 base::AutoLock lock(callback_lock_); | 116 base::AutoLock lock(callback_lock_); |
117 DCHECK(!callback_); | 117 DCHECK(!callback_); |
118 callback_ = callback; | 118 callback_ = callback; |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 last_interval_ = deadline_max - deadline_min; | 249 last_interval_ = deadline_max - deadline_min; |
250 | 250 |
251 // Restart the background rendering timer whether we're background rendering | 251 // Restart the background rendering timer whether we're background rendering |
252 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. | 252 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. |
253 if (background_rendering_enabled_) | 253 if (background_rendering_enabled_) |
254 background_rendering_timer_.Reset(); | 254 background_rendering_timer_.Reset(); |
255 return new_frame || had_new_background_frame; | 255 return new_frame || had_new_background_frame; |
256 } | 256 } |
257 | 257 |
258 } // namespace media | 258 } // namespace media |
OLD | NEW |