OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "media/blink/webmediaplayer_impl.h" | 5 #include "media/blink/webmediaplayer_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cmath> | 8 #include <cmath> |
9 #include <limits> | 9 #include <limits> |
10 #include <string> | 10 #include <string> |
(...skipping 2160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2171 if (duration < max_keyframe_distance_to_disable_background_video_) | 2171 if (duration < max_keyframe_distance_to_disable_background_video_) |
2172 return true; | 2172 return true; |
2173 | 2173 |
2174 // Otherwise, only optimize videos with shorter average keyframe distance. | 2174 // Otherwise, only optimize videos with shorter average keyframe distance. |
2175 PipelineStatistics stats = GetPipelineStatistics(); | 2175 PipelineStatistics stats = GetPipelineStatistics(); |
2176 return stats.video_keyframe_distance_average < | 2176 return stats.video_keyframe_distance_average < |
2177 max_keyframe_distance_to_disable_background_video_; | 2177 max_keyframe_distance_to_disable_background_video_; |
2178 } | 2178 } |
2179 | 2179 |
2180 void WebMediaPlayerImpl::EnableVideoTrackIfNeeded() { | 2180 void WebMediaPlayerImpl::EnableVideoTrackIfNeeded() { |
2181 DCHECK(!IsHidden()); | |
2182 | |
2183 // Don't change video track while the pipeline is resuming or seeking. | 2181 // Don't change video track while the pipeline is resuming or seeking. |
2184 if (is_pipeline_resuming_ || seeking_) | 2182 if (is_pipeline_resuming_ || seeking_) |
2185 return; | 2183 return; |
2186 | 2184 |
2187 if (video_track_disabled_) { | 2185 if (video_track_disabled_) { |
2188 video_track_disabled_ = false; | 2186 video_track_disabled_ = false; |
2189 if (client_->hasSelectedVideoTrack()) { | 2187 if (client_->hasSelectedVideoTrack()) { |
2190 WebMediaPlayer::TrackId trackId = client_->getSelectedVideoTrackId(); | 2188 WebMediaPlayer::TrackId trackId = client_->getSelectedVideoTrackId(); |
2191 selectedVideoTrackChanged(&trackId); | 2189 selectedVideoTrackChanged(&trackId); |
2192 } | 2190 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2237 UMA_HISTOGRAM_TIMES( | 2235 UMA_HISTOGRAM_TIMES( |
2238 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", | 2236 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", |
2239 time_to_first_frame); | 2237 time_to_first_frame); |
2240 } else { | 2238 } else { |
2241 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", | 2239 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", |
2242 time_to_first_frame); | 2240 time_to_first_frame); |
2243 } | 2241 } |
2244 } | 2242 } |
2245 | 2243 |
2246 } // namespace media | 2244 } // namespace media |
OLD | NEW |