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

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

Issue 1816173003: Merge M50: "Drop media session on playback error; avoids idle suspension." (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 989 matching lines...) Expand 10 before | Expand all | Expand 10 after
1000 } 1000 }
1001 1001
1002 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { 1002 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) {
1003 DVLOG(1) << __FUNCTION__; 1003 DVLOG(1) << __FUNCTION__;
1004 DCHECK(main_task_runner_->BelongsToCurrentThread()); 1004 DCHECK(main_task_runner_->BelongsToCurrentThread());
1005 DCHECK_NE(error, PIPELINE_OK); 1005 DCHECK_NE(error, PIPELINE_OK);
1006 1006
1007 if (suppress_destruction_errors_) 1007 if (suppress_destruction_errors_)
1008 return; 1008 return;
1009 1009
1010 // Release the delegate for player errors; this drops the media session and
1011 // avoids idle suspension from ticking.
1012 if (delegate_)
1013 delegate_->PlayerGone(delegate_id_);
1014
1010 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); 1015 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error));
1011 1016
1012 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { 1017 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) {
1013 // Any error that occurs before reaching ReadyStateHaveMetadata should 1018 // Any error that occurs before reaching ReadyStateHaveMetadata should
1014 // be considered a format error. 1019 // be considered a format error.
1015 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); 1020 SetNetworkState(WebMediaPlayer::NetworkStateFormatError);
1016 return; 1021 return;
1017 } 1022 }
1018 1023
1019 SetNetworkState(PipelineErrorToNetworkState(error)); 1024 SetNetworkState(PipelineErrorToNetworkState(error));
(...skipping 619 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 << ", Video: " << stats.video_memory_usage << ", DataSource: " 1644 << ", Video: " << stats.video_memory_usage << ", DataSource: "
1640 << (data_source_ ? data_source_->GetMemoryUsage() : 0) 1645 << (data_source_ ? data_source_->GetMemoryUsage() : 0)
1641 << ", Demuxer: " << demuxer_memory_usage; 1646 << ", Demuxer: " << demuxer_memory_usage;
1642 1647
1643 const int64_t delta = current_memory_usage - last_reported_memory_usage_; 1648 const int64_t delta = current_memory_usage - last_reported_memory_usage_;
1644 last_reported_memory_usage_ = current_memory_usage; 1649 last_reported_memory_usage_ = current_memory_usage;
1645 adjust_allocated_memory_cb_.Run(delta); 1650 adjust_allocated_memory_cb_.Run(delta);
1646 } 1651 }
1647 1652
1648 } // namespace media 1653 } // 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