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

Side by Side Diff: media/renderers/video_renderer_impl.cc

Issue 1005303004: media: VideoRenderImpl: display last available frame (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use std:min(time before next frame, 10ms) Created 5 years, 9 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 | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(
250 std::min(target_paint_timestamp - now, kIdleTimeDelta));
250 continue; 251 continue;
251 } 252 }
252 253
253 if (now > latest_paint_timestamp && drop_frames_) { 254 if (ready_frames_.size() > 1 && now > latest_paint_timestamp &&
255 drop_frames_) {
254 DropNextReadyFrame_Locked(); 256 DropNextReadyFrame_Locked();
255 continue; 257 continue;
256 } 258 }
257 259
258 // Congratulations! You've made it past the video frame timing gauntlet. 260 // Congratulations! You've made it past the video frame timing gauntlet.
259 // 261 //
260 // At this point enough time has passed that the next frame that ready for 262 // At this point enough time has passed that the next frame that ready for
261 // rendering. 263 // rendering.
262 PaintNextReadyFrame_Locked(); 264 PaintNextReadyFrame_Locked();
263 } 265 }
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); 446 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics));
445 447
446 frames_decoded_ = 0; 448 frames_decoded_ = 0;
447 frames_dropped_ = 0; 449 frames_dropped_ = 0;
448 } 450 }
449 451
450 frame_available_.TimedWait(wait_duration); 452 frame_available_.TimedWait(wait_duration);
451 } 453 }
452 454
453 } // namespace media 455 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/renderers/video_renderer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698