| OLD | NEW |
| 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> |
| 11 #include <utility> | 11 #include <utility> |
| 12 | 12 |
| 13 #include "base/bind.h" | 13 #include "base/bind.h" |
| 14 #include "base/bind_helpers.h" | 14 #include "base/bind_helpers.h" |
| 15 #include "base/callback.h" | 15 #include "base/callback.h" |
| 16 #include "base/callback_helpers.h" | 16 #include "base/callback_helpers.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/debug/alias.h" | 18 #include "base/debug/alias.h" |
| 19 #include "base/debug/crash_logging.h" | 19 #include "base/debug/crash_logging.h" |
| 20 #include "base/debug/dump_without_crashing.h" |
| 20 #include "base/metrics/histogram.h" | 21 #include "base/metrics/histogram.h" |
| 22 #include "base/rand_util.h" |
| 21 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
| 22 #include "base/synchronization/waitable_event.h" | 24 #include "base/synchronization/waitable_event.h" |
| 23 #include "base/task_runner_util.h" | 25 #include "base/task_runner_util.h" |
| 24 #include "base/thread_task_runner_handle.h" | 26 #include "base/thread_task_runner_handle.h" |
| 25 #include "base/trace_event/trace_event.h" | 27 #include "base/trace_event/trace_event.h" |
| 26 #include "build/build_config.h" | 28 #include "build/build_config.h" |
| 27 #include "cc/blink/web_layer_impl.h" | 29 #include "cc/blink/web_layer_impl.h" |
| 28 #include "cc/layers/video_layer.h" | 30 #include "cc/layers/video_layer.h" |
| 29 #include "gpu/blink/webgraphicscontext3d_impl.h" | 31 #include "gpu/blink/webgraphicscontext3d_impl.h" |
| 30 #include "media/audio/null_audio_sink.h" | 32 #include "media/audio/null_audio_sink.h" |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 903 } | 905 } |
| 904 | 906 |
| 905 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { | 907 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { |
| 906 DVLOG(1) << __FUNCTION__; | 908 DVLOG(1) << __FUNCTION__; |
| 907 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 909 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 908 DCHECK_NE(error, PIPELINE_OK); | 910 DCHECK_NE(error, PIPELINE_OK); |
| 909 | 911 |
| 910 if (suppress_destruction_errors_) | 912 if (suppress_destruction_errors_) |
| 911 return; | 913 return; |
| 912 | 914 |
| 915 #if defined(OS_ANDROID) |
| 916 // For 10% of pipeline decode failures log the playback URL. The URL is set |
| 917 // as the crash-key 'subresource_url' during DoLoad(). |
| 918 // |
| 919 // TODO(dalecurtis): This is temporary to track down higher than average |
| 920 // decode failure rates for video-only content. See http://crbug.com/595076. |
| 921 if (base::RandDouble() <= 0.1 && error == PIPELINE_ERROR_DECODE) |
| 922 base::debug::DumpWithoutCrashing(); |
| 923 #endif |
| 924 |
| 913 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); | 925 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); |
| 914 | 926 |
| 915 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { | 927 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { |
| 916 // Any error that occurs before reaching ReadyStateHaveMetadata should | 928 // Any error that occurs before reaching ReadyStateHaveMetadata should |
| 917 // be considered a format error. | 929 // be considered a format error. |
| 918 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); | 930 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); |
| 919 return; | 931 return; |
| 920 } | 932 } |
| 921 | 933 |
| 922 SetNetworkState(PipelineErrorToNetworkState(error)); | 934 SetNetworkState(PipelineErrorToNetworkState(error)); |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1464 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1476 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
| 1465 #if defined(OS_ANDROID) | 1477 #if defined(OS_ANDROID) |
| 1466 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1478 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
| 1467 #else | 1479 #else |
| 1468 // On non-Android platforms Resume() is always allowed. | 1480 // On non-Android platforms Resume() is always allowed. |
| 1469 return true; | 1481 return true; |
| 1470 #endif | 1482 #endif |
| 1471 } | 1483 } |
| 1472 | 1484 |
| 1473 } // namespace media | 1485 } // namespace media |
| OLD | NEW |