Index: media/blink/video_frame_compositor.h |
diff --git a/media/blink/video_frame_compositor.h b/media/blink/video_frame_compositor.h |
index 03fb4c5d489f5926b264645fb4ab342c3e247a28..0068933ad9ff2a9918dae9d743e7be0e2cec07ee 100644 |
--- a/media/blink/video_frame_compositor.h |
+++ b/media/blink/video_frame_compositor.h |
@@ -13,6 +13,7 @@ |
#include "base/single_thread_task_runner.h" |
#include "base/synchronization/lock.h" |
#include "base/time/tick_clock.h" |
+#include "base/time/time.h" |
#include "base/timer/timer.h" |
#include "cc/layers/video_frame_provider.h" |
#include "media/base/video_renderer_sink.h" |
@@ -57,6 +58,9 @@ class MEDIA_BLINK_EXPORT VideoFrameCompositor |
: public VideoRendererSink, |
NON_EXPORTED_BASE(public cc::VideoFrameProvider) { |
public: |
+ // Used to report back the time when the new frame has been processed. |
+ using OnNewProcessedFrameCB = base::Callback<void(base::TimeTicks)>; |
+ |
// |compositor_task_runner| is the task runner on which this class will live, |
// though it may be constructed on any thread. |
explicit VideoFrameCompositor( |
@@ -103,10 +107,10 @@ class MEDIA_BLINK_EXPORT VideoFrameCompositor |
// PaintSingleFrame() is not also called while stopped.) |
base::TimeDelta GetCurrentFrameTimestamp() const; |
- // Called when the media player is brought to the foreground. |
- // Used to record the time it takes to process the first frame after that. |
+ // Sets the callback to be run when the new frame has been processed. The |
+ // callback is only run once and then reset. |
// Must be called on the compositor thread. |
- void SetForegroundTime(base::TimeTicks when); |
+ void SetOnNewProcessedFrameCallback(const OnNewProcessedFrameCB& cb); |
void set_tick_clock_for_testing(std::unique_ptr<base::TickClock> tick_clock) { |
tick_clock_ = std::move(tick_clock); |
@@ -162,7 +166,7 @@ class MEDIA_BLINK_EXPORT VideoFrameCompositor |
bool new_background_frame_; |
base::TimeDelta last_interval_; |
base::TimeTicks last_background_render_; |
- base::TimeTicks foreground_time_; |
+ OnNewProcessedFrameCB new_processed_frame_cb_; |
// These values are set on the compositor thread, but also read on the media |
// thread when the VFC is stopped. |