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() { |