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

Unified Diff: media/blink/video_frame_compositor.cc

Issue 2631633003: [Video] Only start tracking foreground time if the video was resumed. (Closed)
Patch Set: Added a comment 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
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..ec2034240c4f13b5ea188176159c35b8774e08c1 100644
--- a/media/blink/video_frame_compositor.cc
+++ b/media/blink/video_frame_compositor.cc
@@ -5,8 +5,8 @@
#include "media/blink/video_frame_compositor.h"
#include "base/bind.h"
+#include "base/callback_helpers.h"
#include "base/message_loop/message_loop.h"
-#include "base/metrics/histogram_macros.h"
#include "base/time/default_tick_clock.h"
#include "base/trace_event/auto_open_close_event.h"
#include "base/trace_event/trace_event.h"
@@ -139,6 +139,7 @@ void VideoFrameCompositor::Stop() {
compositor_task_runner_->PostTask(
FROM_HERE, base::Bind(&VideoFrameCompositor::OnRendererStateUpdate,
base::Unretained(this), false));
+ new_processed_frame_cb_.Reset();
}
void VideoFrameCompositor::PaintSingleFrame(
@@ -189,9 +190,10 @@ base::TimeDelta VideoFrameCompositor::GetCurrentFrameTimestamp() const {
return current_frame_->timestamp();
}
-void VideoFrameCompositor::SetForegroundTime(base::TimeTicks when) {
+void VideoFrameCompositor::SetOnNewProcessedFrameCallback(
+ const OnNewProcessedFrameCB& cb) {
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
- foreground_time_ = when;
+ new_processed_frame_cb_ = cb;
}
bool VideoFrameCompositor::ProcessNewFrame(
@@ -210,13 +212,8 @@ bool VideoFrameCompositor::ProcessNewFrame(
current_frame_ = frame;
- if (!foreground_time_.is_null()) {
- base::TimeDelta time_to_first_frame =
- base::TimeTicks::Now() - foreground_time_;
- UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame",
- time_to_first_frame);
- foreground_time_ = base::TimeTicks();
- }
+ if (!new_processed_frame_cb_.is_null())
+ base::ResetAndReturn(&new_processed_frame_cb_).Run(base::TimeTicks::Now());
return true;
}
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698