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

Side by Side Diff: media/blink/webmediaplayer_impl.cc

Issue 2655723002: [Video, Android] Pause video only players ignoring duration and keyframes (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2136 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 return false; 2147 return false;
2148 2148
2149 // Disable video track only for players with audio that match the criteria for 2149 // Disable video track only for players with audio that match the criteria for
2150 // being optimized. 2150 // being optimized.
2151 return hasAudio() && IsBackgroundOptimizationCandidate(); 2151 return hasAudio() && IsBackgroundOptimizationCandidate();
2152 } 2152 }
2153 2153
2154 bool WebMediaPlayerImpl::IsBackgroundOptimizationCandidate() const { 2154 bool WebMediaPlayerImpl::IsBackgroundOptimizationCandidate() const {
2155 DCHECK(main_task_runner_->BelongsToCurrentThread()); 2155 DCHECK(main_task_runner_->BelongsToCurrentThread());
2156 2156
2157 // Don't optimize players being Cast (Android only).
2158 #if defined(OS_ANDROID) // WMPI_CAST 2157 #if defined(OS_ANDROID) // WMPI_CAST
2158 // Don't optimize players being Cast.
2159 if (isRemote()) 2159 if (isRemote())
2160 return false; 2160 return false;
2161
2162 // Video-only players are always optimized (paused) on Android.
2163 // Don't check the keyframe distance and duration.
2164 if (!hasAudio() && hasVideo())
2165 return true;
2161 #endif // defined(OS_ANDROID) 2166 #endif // defined(OS_ANDROID)
2162 2167
2163 // Don't optimize audio-only or streaming players. 2168 // Don't optimize audio-only or streaming players.
2164 if (!hasVideo() || IsStreaming()) 2169 if (!hasVideo() || IsStreaming())
2165 return false; 2170 return false;
2166 2171
2167 // Videos shorter than the maximum allowed keyframe distance can be optimized. 2172 // Videos shorter than the maximum allowed keyframe distance can be optimized.
2168 base::TimeDelta duration = GetPipelineMediaDuration(); 2173 base::TimeDelta duration = GetPipelineMediaDuration();
2169 if (duration < max_keyframe_distance_to_disable_background_video_) 2174 if (duration < max_keyframe_distance_to_disable_background_video_)
2170 return true; 2175 return true;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2235 UMA_HISTOGRAM_TIMES( 2240 UMA_HISTOGRAM_TIMES(
2236 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack", 2241 "Media.Video.TimeFromForegroundToFirstFrame.DisableTrack",
2237 time_to_first_frame); 2242 time_to_first_frame);
2238 } else { 2243 } else {
2239 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused", 2244 UMA_HISTOGRAM_TIMES("Media.Video.TimeFromForegroundToFirstFrame.Paused",
2240 time_to_first_frame); 2245 time_to_first_frame);
2241 } 2246 }
2242 } 2247 }
2243 2248
2244 } // namespace media 2249 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | media/blink/webmediaplayer_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698