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

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

Issue 1815293003: Drop media session on playback error; avoids idle suspension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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 920 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 931 }
932 932
933 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { 933 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) {
934 DVLOG(1) << __FUNCTION__; 934 DVLOG(1) << __FUNCTION__;
935 DCHECK(main_task_runner_->BelongsToCurrentThread()); 935 DCHECK(main_task_runner_->BelongsToCurrentThread());
936 DCHECK_NE(error, PIPELINE_OK); 936 DCHECK_NE(error, PIPELINE_OK);
937 937
938 if (suppress_destruction_errors_) 938 if (suppress_destruction_errors_)
939 return; 939 return;
940 940
941 // Release the delegate for player errors; this drops the media session and
942 // avoids idle suspension from ticking.
943 if (delegate_)
944 delegate_->PlayerGone(delegate_id_);
945
941 #if defined(OS_ANDROID) 946 #if defined(OS_ANDROID)
942 // For 10% of pipeline decode failures log the playback URL. The URL is set 947 // For 10% of pipeline decode failures log the playback URL. The URL is set
943 // as the crash-key 'subresource_url' during DoLoad(). 948 // as the crash-key 'subresource_url' during DoLoad().
944 // 949 //
945 // TODO(dalecurtis): This is temporary to track down higher than average 950 // TODO(dalecurtis): This is temporary to track down higher than average
946 // decode failure rates for video-only content. See http://crbug.com/595076. 951 // decode failure rates for video-only content. See http://crbug.com/595076.
947 if (base::RandDouble() <= 0.1 && error == PIPELINE_ERROR_DECODE) 952 if (base::RandDouble() <= 0.1 && error == PIPELINE_ERROR_DECODE)
948 base::debug::DumpWithoutCrashing(); 953 base::debug::DumpWithoutCrashing();
949 #endif 954 #endif
950 955
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { 1517 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() {
1513 #if defined(OS_ANDROID) 1518 #if defined(OS_ANDROID)
1514 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); 1519 return !hasVideo() || (delegate_ && !delegate_->IsHidden());
1515 #else 1520 #else
1516 // On non-Android platforms Resume() is always allowed. 1521 // On non-Android platforms Resume() is always allowed.
1517 return true; 1522 return true;
1518 #endif 1523 #endif
1519 } 1524 }
1520 1525
1521 } // namespace media 1526 } // 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