Index: media/blink/video_frame_compositor.cc |
diff --git a/media/blink/video_frame_compositor.cc b/media/blink/video_frame_compositor.cc |
index 7bc98164f8e695570d03bc76248be082cc52d2db..831c71c2cded6f587a9e72817a2c89149f4ed21c 100644 |
--- a/media/blink/video_frame_compositor.cc |
+++ b/media/blink/video_frame_compositor.cc |
@@ -6,6 +6,7 @@ |
#include "base/bind.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" |
@@ -188,6 +189,11 @@ base::TimeDelta VideoFrameCompositor::GetCurrentFrameTimestamp() const { |
return current_frame_->timestamp(); |
} |
+void VideoFrameCompositor::SetShownTimestamp(base::TimeTicks when) { |
+ DCHECK(compositor_task_runner_->BelongsToCurrentThread()); |
+ last_shown_ = when; |
+} |
+ |
bool VideoFrameCompositor::ProcessNewFrame( |
const scoped_refptr<VideoFrame>& frame, |
bool repaint_duplicate_frame) { |
@@ -203,6 +209,14 @@ bool VideoFrameCompositor::ProcessNewFrame( |
rendered_last_frame_ = false; |
current_frame_ = frame; |
+ |
+ if (!last_shown_.is_null()) { |
+ base::TimeDelta time_to_first_frame = base::TimeTicks::Now() - last_shown_; |
+ UMA_HISTOGRAM_TIMES("Media.Video.TimeFromShownToFirstFrame", |
+ time_to_first_frame); |
+ last_shown_ = base::TimeTicks(); |
+ } |
+ |
return true; |
} |