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

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

Issue 496723003: [Feature might be dropped] VideoPlaybackQuality.totalFrameDelay Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT READY FOR REVIEW Created 6 years, 4 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 | « media/filters/video_renderer_impl.h ('k') | no next file » | 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/filters/video_renderer_impl.h" 5 #include "media/filters/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/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 24 matching lines...) Expand all
35 state_(kUninitialized), 35 state_(kUninitialized),
36 thread_(), 36 thread_(),
37 pending_read_(false), 37 pending_read_(false),
38 drop_frames_(drop_frames), 38 drop_frames_(drop_frames),
39 buffering_state_(BUFFERING_HAVE_NOTHING), 39 buffering_state_(BUFFERING_HAVE_NOTHING),
40 paint_cb_(paint_cb), 40 paint_cb_(paint_cb),
41 last_timestamp_(kNoTimestamp()), 41 last_timestamp_(kNoTimestamp()),
42 last_painted_timestamp_(kNoTimestamp()), 42 last_painted_timestamp_(kNoTimestamp()),
43 frames_decoded_(0), 43 frames_decoded_(0),
44 frames_dropped_(0), 44 frames_dropped_(0),
45 frames_delay_time_(0),
45 is_shutting_down_(false), 46 is_shutting_down_(false),
46 weak_factory_(this) { 47 weak_factory_(this) {
47 DCHECK(!paint_cb_.is_null()); 48 DCHECK(!paint_cb_.is_null());
48 } 49 }
49 50
50 VideoRendererImpl::~VideoRendererImpl() { 51 VideoRendererImpl::~VideoRendererImpl() {
51 DCHECK(task_runner_->BelongsToCurrentThread()); 52 DCHECK(task_runner_->BelongsToCurrentThread());
52 53
53 { 54 {
54 base::AutoLock auto_lock(lock_); 55 base::AutoLock auto_lock(lock_);
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 264
264 scoped_refptr<VideoFrame> next_frame = ready_frames_.front(); 265 scoped_refptr<VideoFrame> next_frame = ready_frames_.front();
265 ready_frames_.pop_front(); 266 ready_frames_.pop_front();
266 frames_decoded_++; 267 frames_decoded_++;
267 268
268 last_timestamp_ = next_frame->timestamp(); 269 last_timestamp_ = next_frame->timestamp();
269 last_painted_timestamp_ = next_frame->timestamp(); 270 last_painted_timestamp_ = next_frame->timestamp();
270 271
271 paint_cb_.Run(next_frame); 272 paint_cb_.Run(next_frame);
272 273
274 base::TimeDelta now = get_time_cb_.Run();
275 frames_delay_time_ += (now - last_painted_timestamp_).InSecondsF();
276
273 task_runner_->PostTask( 277 task_runner_->PostTask(
274 FROM_HERE, 278 FROM_HERE,
275 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr())); 279 base::Bind(&VideoRendererImpl::AttemptRead, weak_factory_.GetWeakPtr()));
276 } 280 }
277 281
278 void VideoRendererImpl::DropNextReadyFrame_Locked() { 282 void VideoRendererImpl::DropNextReadyFrame_Locked() {
279 TRACE_EVENT0("media", "VideoRendererImpl:frameDropped"); 283 TRACE_EVENT0("media", "VideoRendererImpl:frameDropped");
280 284
281 lock_.AssertAcquired(); 285 lock_.AssertAcquired();
282 286
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 void VideoRendererImpl::UpdateStatsAndWait_Locked( 463 void VideoRendererImpl::UpdateStatsAndWait_Locked(
460 base::TimeDelta wait_duration) { 464 base::TimeDelta wait_duration) {
461 lock_.AssertAcquired(); 465 lock_.AssertAcquired();
462 DCHECK_GE(frames_decoded_, 0); 466 DCHECK_GE(frames_decoded_, 0);
463 DCHECK_LE(frames_dropped_, frames_decoded_); 467 DCHECK_LE(frames_dropped_, frames_decoded_);
464 468
465 if (frames_decoded_) { 469 if (frames_decoded_) {
466 PipelineStatistics statistics; 470 PipelineStatistics statistics;
467 statistics.video_frames_decoded = frames_decoded_; 471 statistics.video_frames_decoded = frames_decoded_;
468 statistics.video_frames_dropped = frames_dropped_; 472 statistics.video_frames_dropped = frames_dropped_;
473 statistics.total_frame_delay = frames_delay_time_;
469 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics)); 474 task_runner_->PostTask(FROM_HERE, base::Bind(statistics_cb_, statistics));
470 475
471 frames_decoded_ = 0; 476 frames_decoded_ = 0;
472 frames_dropped_ = 0; 477 frames_dropped_ = 0;
478 frames_delay_time_ = 0;
473 } 479 }
474 480
475 frame_available_.TimedWait(wait_duration); 481 frame_available_.TimedWait(wait_duration);
476 } 482 }
477 483
478 } // namespace media 484 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/video_renderer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698