Index: media/blink/video_frame_compositor.h |
diff --git a/media/blink/video_frame_compositor.h b/media/blink/video_frame_compositor.h |
index 02b6077f9605ff25029cfb08da5adefc8c3808e6..1d90126e38c4a164ed6453812b289b1c515ff953 100644 |
--- a/media/blink/video_frame_compositor.h |
+++ b/media/blink/video_frame_compositor.h |
@@ -9,6 +9,7 @@ |
#include "base/memory/ref_counted.h" |
#include "base/single_thread_task_runner.h" |
#include "base/synchronization/lock.h" |
+#include "base/time/tick_clock.h" |
#include "cc/layers/video_frame_provider.h" |
#include "media/base/media_export.h" |
#include "media/base/video_renderer_sink.h" |
@@ -91,12 +92,26 @@ class MEDIA_EXPORT VideoFrameCompositor |
void PaintFrameUsingOldRenderingPath( |
const scoped_refptr<VideoFrame>& frame) override; |
+ void set_tick_clock_for_testing(scoped_ptr<base::TickClock> tick_clock) { |
+ tick_clock_ = tick_clock.Pass(); |
+ } |
+ |
+ base::TimeDelta get_stale_frame_threshold_for_testing() const { |
+ return stale_frame_threshold_; |
+ } |
+ |
+ void clear_current_frame_for_testing() { |
+ current_frame_ = nullptr; |
+ } |
+ |
private: |
// Called on the compositor thread to start or stop rendering if rendering was |
- // previously started or stopped before we had a |callback_|. |
- void OnRendererStateUpdate(); |
+ // previously started or stopped before we had a |client_|. Will only call |
+ // StopRendering() if |stop_if_not_rendering| is true. |
+ void OnRendererStateUpdate(bool new_state); |
scoped_refptr<base::SingleThreadTaskRunner> compositor_task_runner_; |
+ scoped_ptr<base::TickClock> tick_clock_; |
// These callbacks are executed on the compositor thread. |
base::Callback<void(gfx::Size)> natural_size_changed_cb_; |
@@ -105,10 +120,14 @@ class MEDIA_EXPORT VideoFrameCompositor |
// These values are only set and read on the compositor thread. |
cc::VideoFrameProvider::Client* client_; |
scoped_refptr<VideoFrame> current_frame_; |
+ base::TimeTicks last_frame_update_time_; |
+ base::TimeDelta last_interval_; |
+ base::TimeDelta stale_frame_threshold_; |
+ bool rendering_; |
// These values are updated and read from the media and compositor threads. |
base::Lock lock_; |
- bool rendering_; |
+ bool rendered_last_frame_; |
VideoRendererSink::RenderCallback* callback_; |
DISALLOW_COPY_AND_ASSIGN(VideoFrameCompositor); |