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 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2174 if (duration < max_keyframe_distance_to_disable_background_video_) | 2174 if (duration < max_keyframe_distance_to_disable_background_video_) |
2175 return true; | 2175 return true; |
2176 | 2176 |
2177 // Otherwise, only optimize videos with shorter average keyframe distance. | 2177 // Otherwise, only optimize videos with shorter average keyframe distance. |
2178 PipelineStatistics stats = GetPipelineStatistics(); | 2178 PipelineStatistics stats = GetPipelineStatistics(); |
2179 return stats.video_keyframe_distance_average < | 2179 return stats.video_keyframe_distance_average < |
2180 max_keyframe_distance_to_disable_background_video_; | 2180 max_keyframe_distance_to_disable_background_video_; |
2181 } | 2181 } |
2182 | 2182 |
2183 void WebMediaPlayerImpl::EnableVideoTrackIfNeeded() { | 2183 void WebMediaPlayerImpl::EnableVideoTrackIfNeeded() { |
2184 DCHECK(!IsHidden()); | |
2185 | |
2186 // Don't change video track while the pipeline is resuming or seeking. | 2184 // Don't change video track while the pipeline is resuming or seeking. |
2187 if (is_pipeline_resuming_ || seeking_) | 2185 if (is_pipeline_resuming_ || seeking_) |
2188 return; | 2186 return; |
2189 | 2187 |
2190 if (video_track_disabled_) { | 2188 if (video_track_disabled_) { |
2191 video_track_disabled_ = false; | 2189 video_track_disabled_ = false; |
2192 if (client_->hasSelectedVideoTrack()) { | 2190 if (client_->hasSelectedVideoTrack()) { |
2193 WebMediaPlayer::TrackId trackId = client_->getSelectedVideoTrackId(); | 2191 WebMediaPlayer::TrackId trackId = client_->getSelectedVideoTrackId(); |
2194 selectedVideoTrackChanged(&trackId); | 2192 selectedVideoTrackChanged(&trackId); |
2195 } | 2193 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2240 UMA_HISTOGRAM_TIMES( | 2238 UMA_HISTOGRAM_TIMES( |
2241 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", | 2239 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", |
2242 time_to_first_frame); | 2240 time_to_first_frame); |
2243 } else { | 2241 } else { |
2244 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", | 2242 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", |
2245 time_to_first_frame); | 2243 time_to_first_frame); |
2246 } | 2244 } |
2247 } | 2245 } |
2248 | 2246 |
2249 } // namespace media | 2247 } // namespace media |
OLD | NEW |