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

Unified Diff: media/blink/webmediaplayer_impl.cc

Issue 2818823002: [Media] Add a finch trial param for background MediaSource videos (Closed)
Patch Set: Created 3 years, 8 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/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webmediaplayer_impl.cc
diff --git a/media/blink/webmediaplayer_impl.cc b/media/blink/webmediaplayer_impl.cc
index 7c10f9fe3981b98b65561a2e49d7f3a4fe8f9ca8..1c0e215649791c3794e6eebccd40fa29f221163a 100644
--- a/media/blink/webmediaplayer_impl.cc
+++ b/media/blink/webmediaplayer_impl.cc
@@ -237,6 +237,8 @@ WebMediaPlayerImpl::WebMediaPlayerImpl(
observer_(params.media_observer()),
max_keyframe_distance_to_disable_background_video_(
params.max_keyframe_distance_to_disable_background_video()),
+ max_keyframe_distance_to_disable_background_video_mse_(
+ params.max_keyframe_distance_to_disable_background_video_mse()),
enable_instant_source_buffer_gc_(
params.enable_instant_source_buffer_gc()),
embedded_media_experience_enabled_(
@@ -2233,13 +2235,16 @@ bool WebMediaPlayerImpl::IsBackgroundOptimizationCandidate() const {
// Videos shorter than the maximum allowed keyframe distance can be optimized.
base::TimeDelta duration = GetPipelineMediaDuration();
- if (duration < max_keyframe_distance_to_disable_background_video_)
+ base::TimeDelta max_keyframe_distance =
+ (load_type_ == kLoadTypeMediaSource)
+ ? max_keyframe_distance_to_disable_background_video_mse_
+ : max_keyframe_distance_to_disable_background_video_;
+ if (duration < max_keyframe_distance)
return true;
// Otherwise, only optimize videos with shorter average keyframe distance.
PipelineStatistics stats = GetPipelineStatistics();
- return stats.video_keyframe_distance_average <
- max_keyframe_distance_to_disable_background_video_;
+ return stats.video_keyframe_distance_average < max_keyframe_distance;
}
void WebMediaPlayerImpl::UpdateBackgroundVideoOptimizationState() {
« no previous file with comments | « media/blink/webmediaplayer_impl.h ('k') | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698