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

Unified Diff: media/blink/video_frame_compositor.cc

Issue 2631633003: [Video] Only start tracking foreground time if the video was resumed. (Closed)
Patch Set: Split the histogram into paused and disabled track Created 3 years, 11 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
Index: media/blink/video_frame_compositor.cc
diff --git a/media/blink/video_frame_compositor.cc b/media/blink/video_frame_compositor.cc
index 017bedc9ae9fc0b29b18e12c300790a24ca54f3b..c9cce634f81bfff10a56d23d1e3b5dc3ed0788dd 100644
--- a/media/blink/video_frame_compositor.cc
+++ b/media/blink/video_frame_compositor.cc
@@ -189,9 +189,12 @@ base::TimeDelta VideoFrameCompositor::GetCurrentFrameTimestamp() const {
return current_frame_->timestamp();
}
-void VideoFrameCompositor::SetForegroundTime(base::TimeTicks when) {
+void VideoFrameCompositor::SetForegroundTime(
+ base::TimeTicks when,
+ BackgroundVideoOptimization optimization) {
DaleCurtis 2017/01/18 23:39:01 This is polluting VFC with knowledge about Backgro
whywhat 2017/01/19 02:33:58 Hm, ok. Will upload a follow up with this.
whywhat 2017/01/19 03:23:12 Done. Looks neat to me :)
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
foreground_time_ = when;
+ background_video_optimization_ = base::make_optional(optimization);
}
bool VideoFrameCompositor::ProcessNewFrame(
@@ -210,12 +213,21 @@ bool VideoFrameCompositor::ProcessNewFrame(
current_frame_ = frame;
- if (!foreground_time_.is_null()) {
+ if (!foreground_time_.is_null() && background_video_optimization_) {
base::TimeDelta time_to_first_frame =
base::TimeTicks::Now() - foreground_time_;
- UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame",
- time_to_first_frame);
+ if (background_video_optimization_.value() ==
+ BackgroundVideoOptimization::Paused) {
+ UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused",
+ time_to_first_frame);
+ } else if (background_video_optimization_.value() ==
+ BackgroundVideoOptimization::DisabledTrack) {
+ UMA_HISTOGRAM_TIMES(
+ "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack",
+ time_to_first_frame);
+ }
foreground_time_ = base::TimeTicks();
+ background_video_optimization_.reset();
}
return true;

Powered by Google App Engine
This is Rietveld 408576698