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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 117 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
118 rendered_last_frame_ = true; | 118 rendered_last_frame_ = true; |
119 } | 119 } |
120 | 120 |
121 bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min, | 121 bool VideoFrameCompositor::UpdateCurrentFrame(base::TimeTicks deadline_min, |
122 base::TimeTicks deadline_max) { | 122 base::TimeTicks deadline_max) { |
123 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 123 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
124 return CallRender(deadline_min, deadline_max, false); | 124 return CallRender(deadline_min, deadline_max, false); |
125 } | 125 } |
126 | 126 |
| 127 bool VideoFrameCompositor::HasCurrentFrame() { |
| 128 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 129 return current_frame_; |
| 130 } |
| 131 |
127 void VideoFrameCompositor::Start(RenderCallback* callback) { | 132 void VideoFrameCompositor::Start(RenderCallback* callback) { |
128 TRACE_EVENT0("media", "VideoFrameCompositor::Start"); | 133 TRACE_EVENT0("media", "VideoFrameCompositor::Start"); |
129 | 134 |
130 // Called from the media thread, so acquire the callback under lock before | 135 // Called from the media thread, so acquire the callback under lock before |
131 // returning in case a Stop() call comes in before the PostTask is processed. | 136 // returning in case a Stop() call comes in before the PostTask is processed. |
132 base::AutoLock lock(lock_); | 137 base::AutoLock lock(lock_); |
133 DCHECK(!callback_); | 138 DCHECK(!callback_); |
134 callback_ = callback; | 139 callback_ = callback; |
135 compositor_task_runner_->PostTask( | 140 compositor_task_runner_->PostTask( |
136 FROM_HERE, base::Bind(&VideoFrameCompositor::OnRendererStateUpdate, | 141 FROM_HERE, base::Bind(&VideoFrameCompositor::OnRendererStateUpdate, |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 last_interval_ = deadline_max - deadline_min; | 251 last_interval_ = deadline_max - deadline_min; |
247 | 252 |
248 // Restart the background rendering timer whether we're background rendering | 253 // Restart the background rendering timer whether we're background rendering |
249 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. | 254 // or not; in either case we should wait for |kBackgroundRenderingTimeoutMs|. |
250 if (background_rendering_enabled_) | 255 if (background_rendering_enabled_) |
251 background_rendering_timer_.Reset(); | 256 background_rendering_timer_.Reset(); |
252 return new_frame; | 257 return new_frame; |
253 } | 258 } |
254 | 259 |
255 } // namespace media | 260 } // namespace media |
OLD | NEW |