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

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

Issue 2696423003: Don't pause suspended videos with no audio. (Closed)
Patch Set: Added WMPI tests Created 3 years, 9 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 2087 matching lines...) Expand 10 before | Expand all | Expand 10 after
2098 data_source_memory_usage / 1024); 2098 data_source_memory_usage / 1024);
2099 } 2099 }
2100 if (demuxer_) { 2100 if (demuxer_) {
2101 UMA_HISTOGRAM_MEMORY_KB("Media.WebMediaPlayerImpl.Memory.Demuxer", 2101 UMA_HISTOGRAM_MEMORY_KB("Media.WebMediaPlayerImpl.Memory.Demuxer",
2102 demuxer_memory_usage / 1024); 2102 demuxer_memory_usage / 1024);
2103 } 2103 }
2104 } 2104 }
2105 2105
2106 void WebMediaPlayerImpl::ScheduleIdlePauseTimer() { 2106 void WebMediaPlayerImpl::ScheduleIdlePauseTimer() {
2107 // Only schedule the pause timer if we're not paused or paused but going to 2107 // Only schedule the pause timer if we're not paused or paused but going to
2108 // resume when foregrounded, and are suspended. 2108 // resume when foregrounded, and are suspended and have audio.
2109 if ((paused_ && !paused_when_hidden_) || !pipeline_controller_.IsSuspended()) 2109 if ((paused_ && !paused_when_hidden_) ||
2110 !pipeline_controller_.IsSuspended() || !hasAudio()) {
2110 return; 2111 return;
2112 }
2111 2113
2112 #if defined(OS_ANDROID) 2114 #if defined(OS_ANDROID)
2113 // Remote players will be suspended and locally paused. 2115 // Remote players will be suspended and locally paused.
2114 if (isRemote()) 2116 if (isRemote())
2115 return; 2117 return;
2116 #endif 2118 #endif
2117 2119
2118 // Idle timeout chosen arbitrarily. 2120 // Idle timeout chosen arbitrarily.
2119 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), 2121 background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5),
2120 this, &WebMediaPlayerImpl::OnPause); 2122 this, &WebMediaPlayerImpl::OnPause);
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
2315 2317
2316 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) { 2318 void WebMediaPlayerImpl::RecordUnderflowDuration(base::TimeDelta duration) {
2317 DCHECK(data_source_ || chunk_demuxer_); 2319 DCHECK(data_source_ || chunk_demuxer_);
2318 if (data_source_) 2320 if (data_source_)
2319 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration); 2321 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration", duration);
2320 else 2322 else
2321 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration); 2323 UMA_HISTOGRAM_TIMES("Media.UnderflowDuration.MSE", duration);
2322 } 2324 }
2323 2325
2324 } // namespace media 2326 } // 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