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

Unified Diff: media/blink/webmediaplayer_impl.h

Issue 2611333003: [Video] Disable bg optimization if avg keyframe distance is >10s (Closed)
Patch Set: Rebase the test 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/base/pipeline_status.h ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.h
diff --git a/media/blink/webmediaplayer_impl.h b/media/blink/webmediaplayer_impl.h
index 274381c4dab02947fc8b3e4afca378c99eae7629..1ce44b504902a279949f428f0adc5f5183292430 100644
--- a/media/blink/webmediaplayer_impl.h
+++ b/media/blink/webmediaplayer_impl.h
@@ -17,8 +17,10 @@
#include "base/memory/linked_ptr.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "base/threading/thread.h"
#include "base/time/default_tick_clock.h"
+#include "base/time/time.h"
#include "base/timer/elapsed_timer.h"
#include "base/timer/timer.h"
#include "build/build_config.h"
@@ -395,6 +397,12 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// - right after the pipeline has resumed if the video is not hidden.
void EnableVideoTrackIfNeeded();
+ // Overrides the pipeline statistics returned by GetStatistics() for tests.
+ void SetPipelineStatisticsForTest(const PipelineStatistics& stats);
+
+ // Returns the pipeline statistics or the value overridden by tests.
+ PipelineStatistics GetPipelineStatistics() const;
+
blink::WebLocalFrame* frame_;
// The playback state last reported to |delegate_|, to avoid setting duplicate
@@ -623,12 +631,21 @@ class MEDIA_BLINK_EXPORT WebMediaPlayerImpl
// Whether the player is currently in autoplay muted state.
bool autoplay_muted_ = false;
+ // The maximum video keyframe distance that allows triggering background
+ // playback optimizations.
+ // 10 seconds by default but can be overridden by a Finch experiment.
+ base::TimeDelta max_keyframe_distance_to_disable_background_video_ =
+ base::TimeDelta::FromSeconds(10);
+
// Whether disabled the video track as an optimization.
bool video_track_disabled_ = false;
// Whether the pipeline is being resumed at the moment.
bool is_pipeline_resuming_ = false;
+ // Pipeline statistics overridden by tests.
+ base::Optional<PipelineStatistics> pipeline_statistics_for_test_;
+
DISALLOW_COPY_AND_ASSIGN(WebMediaPlayerImpl);
};
« no previous file with comments | « media/base/pipeline_status.h ('k') | media/blink/webmediaplayer_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698