OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderers/video_renderer_impl.h" | 5 #include "media/renderers/video_renderer_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
239 // the accuracy of our frame timing code. http://crbug.com/149829 | 239 // the accuracy of our frame timing code. http://crbug.com/149829 |
240 if (last_timestamp_ == kNoTimestamp()) { | 240 if (last_timestamp_ == kNoTimestamp()) { |
241 latest_paint_timestamp = base::TimeDelta::Max(); | 241 latest_paint_timestamp = base::TimeDelta::Max(); |
242 } else { | 242 } else { |
243 base::TimeDelta duration = target_paint_timestamp - last_timestamp_; | 243 base::TimeDelta duration = target_paint_timestamp - last_timestamp_; |
244 latest_paint_timestamp = target_paint_timestamp + duration; | 244 latest_paint_timestamp = target_paint_timestamp + duration; |
245 } | 245 } |
246 | 246 |
247 // Remain idle until we've reached our target paint window. | 247 // Remain idle until we've reached our target paint window. |
248 if (now < target_paint_timestamp) { | 248 if (now < target_paint_timestamp) { |
249 UpdateStatsAndWait_Locked(kIdleTimeDelta); | 249 UpdateStatsAndWait_Locked(target_paint_timestamp - now); |
DaleCurtis
2015/03/24 17:25:23
std::max(target_paint_timestamp - now, kIdleTimeDe
DaleCurtis
2015/03/24 17:47:57
Whoops, yes.
llandwerlin-old
2015/03/24 17:52:00
Done.
| |
250 continue; | 250 continue; |
251 } | 251 } |
252 | 252 |
253 if (now > latest_paint_timestamp && drop_frames_) { | 253 if (ready_frames_.size() > 1 && now > latest_paint_timestamp && |
254 drop_frames_) { | |
254 DropNextReadyFrame_Locked(); | 255 DropNextReadyFrame_Locked(); |
255 continue; | 256 continue; |
256 } | 257 } |
257 | 258 |
258 // Congratulations! You've made it past the video frame timing gauntlet. | 259 // Congratulations! You've made it past the video frame timing gauntlet. |
259 // | 260 // |
260 // At this point enough time has passed that the next frame that ready for | 261 // At this point enough time has passed that the next frame that ready for |
261 // rendering. | 262 // rendering. |
262 PaintNextReadyFrame_Locked(); | 263 PaintNextReadyFrame_Locked(); |
263 } | 264 } |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
444 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); | 445 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); |
445 | 446 |
446 frames_decoded_ = 0; | 447 frames_decoded_ = 0; |
447 frames_dropped_ = 0; | 448 frames_dropped_ = 0; |
448 } | 449 } |
449 | 450 |
450 frame_available_.TimedWait(wait_duration); | 451 frame_available_.TimedWait(wait_duration); |
451 } | 452 } |
452 | 453 |
453 } // namespace media | 454 } // namespace media |
OLD | NEW |