Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/renderer/media/webmediaplayer_ms_compositor.h" | 5 #include "content/renderer/media/webmediaplayer_ms_compositor.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/hash.h" | 10 #include "base/hash.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 rendering_frame_buffer_.reset(); | 209 rendering_frame_buffer_.reset(); |
| 210 SetCurrentFrame(frame); | 210 SetCurrentFrame(frame); |
| 211 return; | 211 return; |
| 212 } | 212 } |
| 213 | 213 |
| 214 timestamps_to_clock_times_[frame->timestamp()] = render_time; | 214 timestamps_to_clock_times_[frame->timestamp()] = render_time; |
| 215 | 215 |
| 216 rendering_frame_buffer_->EnqueueFrame(frame); | 216 rendering_frame_buffer_->EnqueueFrame(frame); |
| 217 | 217 |
| 218 const base::TimeTicks now = base::TimeTicks::Now(); | 218 const base::TimeTicks now = base::TimeTicks::Now(); |
| 219 if (now <= last_deadline_max_) | 219 if (now <= last_deadline_max_ || !current_frame_) |
| 220 return; | 220 return; |
| 221 | 221 |
| 222 // This shows vsyncs stops rendering frames. A probable cause is that the | 222 // This shows vsyncs stops rendering frames. A probable cause is that the |
| 223 // tab is not in the front. But we still have to let old frames go. | 223 // tab is not in the front. But we still have to let old frames go. |
| 224 const base::TimeTicks deadline_max = | 224 rendering_frame_buffer_->Reset(); |
|
DaleCurtis
2016/03/09 00:42:23
Hmm, is this really what you want? This will drop
qiangchen
2016/03/09 19:55:02
Probably RemoveExpiredFrames(now) will not work. A
| |
| 225 std::max(now, last_deadline_max_ + last_render_length_); | |
| 226 | |
| 227 Render(deadline_max - last_render_length_, deadline_max); | |
| 228 } | 225 } |
| 229 | 226 |
| 230 bool WebMediaPlayerMSCompositor::UpdateCurrentFrame( | 227 bool WebMediaPlayerMSCompositor::UpdateCurrentFrame( |
| 231 base::TimeTicks deadline_min, | 228 base::TimeTicks deadline_min, |
| 232 base::TimeTicks deadline_max) { | 229 base::TimeTicks deadline_max) { |
| 233 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); | 230 DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
| 234 | 231 |
| 235 TRACE_EVENT_BEGIN2("webrtc", "WebMediaPlayerMS::UpdateCurrentFrame", | 232 TRACE_EVENT_BEGIN2("webrtc", "WebMediaPlayerMS::UpdateCurrentFrame", |
| 236 "Actual Render Begin", deadline_min.ToInternalValue(), | 233 "Actual Render Begin", deadline_min.ToInternalValue(), |
| 237 "Actual Render End", deadline_max.ToInternalValue()); | 234 "Actual Render End", deadline_max.ToInternalValue()); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 391 } | 388 } |
| 392 | 389 |
| 393 if (!rendering_frame_buffer_) { | 390 if (!rendering_frame_buffer_) { |
| 394 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( | 391 rendering_frame_buffer_.reset(new media::VideoRendererAlgorithm( |
| 395 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, | 392 base::Bind(&WebMediaPlayerMSCompositor::MapTimestampsToRenderTimeTicks, |
| 396 base::Unretained(this)))); | 393 base::Unretained(this)))); |
| 397 } | 394 } |
| 398 } | 395 } |
| 399 | 396 |
| 400 } // namespace content | 397 } // namespace content |
| OLD | NEW |