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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2821573002: Merge M58: "Don't histogram paint time after ending or seeking." (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index d558fdef403ff7218f355204b6645ca510b81623..545363560a98f971971e7a6a4a7ee6747ec6d82b 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -552,6 +552,10 @@ void WebMediaPlayerImpl::DoSeek(base::TimeDelta time, bool time_updated) {
if (watch_time_reporter_)
watch_time_reporter_->OnSeeking();
+ // Clear any new frame processed callbacks on seek; otherwise we'll end up
+ // logging a time long after the seek completes.
+ frame_time_report_cb_.Cancel();
+
// TODO(sandersd): Move |seeking_| to PipelineController.
// TODO(sandersd): Do we want to reset the idle timer here?
delegate_->SetIdle(delegate_id_, false);
@@ -1250,6 +1254,10 @@ void WebMediaPlayerImpl::OnEnded() {
ended_ = true;
client_->timeChanged();
+ // Clear any new frame processed callbacks on end; otherwise we'll end up
+ // logging a time long after playback ends.
+ frame_time_report_cb_.Cancel();
+
// We don't actually want this to run until |client_| calls seek() or pause(),
// but that should have already happened in timeChanged() and so this is
// expected to be a no-op.
@@ -1480,14 +1488,14 @@ void WebMediaPlayerImpl::OnFrameShown() {
// for.
if ((!paused_ && IsBackgroundOptimizationCandidate()) ||
paused_when_hidden_) {
- VideoFrameCompositor::OnNewProcessedFrameCB new_processed_frame_cb =
- BindToCurrentLoop(base::Bind(
- &WebMediaPlayerImpl::ReportTimeFromForegroundToFirstFrame,
- AsWeakPtr(), base::TimeTicks::Now()));
+ frame_time_report_cb_.Reset(
+ base::Bind(&WebMediaPlayerImpl::ReportTimeFromForegroundToFirstFrame,
+ AsWeakPtr(), base::TimeTicks::Now()));
compositor_task_runner_->PostTask(
FROM_HERE,
base::Bind(&VideoFrameCompositor::SetOnNewProcessedFrameCallback,
- base::Unretained(compositor_), new_processed_frame_cb));
+ base::Unretained(compositor_),
+ BindToCurrentLoop(frame_time_report_cb_.callback())));
}
EnableVideoTrackIfNeeded();
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698