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

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

Issue 1827283002: media: Cancel any pending pipeline restart when the player is hidden (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2661
Patch Set: Created 4 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 | no next file » | 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 1123 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 switches::kDisableMediaSuspend)) { 1134 switches::kDisableMediaSuspend)) {
1135 return; 1135 return;
1136 } 1136 }
1137 1137
1138 #if defined(OS_ANDROID) 1138 #if defined(OS_ANDROID)
1139 // If we're remote, the pipeline should already be suspended. 1139 // If we're remote, the pipeline should already be suspended.
1140 if (isRemote()) 1140 if (isRemote())
1141 return; 1141 return;
1142 #endif 1142 #endif
1143 1143
1144 if (must_suspend || (paused_ && ended_) || hasVideo()) 1144 if (must_suspend || (paused_ && ended_) || hasVideo()) {
1145 // If we're in the middle of a suspend/resume cycle we no longer want to
1146 // resume when the suspend completes.
1147 pending_suspend_resume_cycle_ = false;
1145 ScheduleSuspend(); 1148 ScheduleSuspend();
1149 }
1146 } 1150 }
1147 1151
1148 void WebMediaPlayerImpl::ScheduleSuspend() { 1152 void WebMediaPlayerImpl::ScheduleSuspend() {
1149 if (!pipeline_.IsRunning()) 1153 if (!pipeline_.IsRunning())
1150 return; 1154 return;
1151 1155
1152 // Always reset the buffering strategy to normal when suspending for hidden to 1156 // Always reset the buffering strategy to normal when suspending for hidden to
1153 // prevent an idle network connection from lingering. 1157 // prevent an idle network connection from lingering.
1154 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal); 1158 setBufferingStrategy(WebMediaPlayer::BufferingStrategy::Normal);
1155 if (resuming_ || seeking_) { 1159 if (resuming_ || seeking_) {
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after
1644 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1648 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1645 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1649 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1646 << ", Demuxer: " << demuxer_memory_usage; 1650 << ", Demuxer: " << demuxer_memory_usage;
1647 1651
1648 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1652 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1649 last_reported_memory_usage_ = current_memory_usage; 1653 last_reported_memory_usage_ = current_memory_usage;
1650 adjust_allocated_memory_cb_.Run(delta); 1654 adjust_allocated_memory_cb_.Run(delta);
1651 } 1655 }
1652 1656
1653 } // namespace media 1657 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698