| 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" | |
| 21 #include "base/metrics/histogram.h" | 20 #include "base/metrics/histogram.h" |
| 22 #include "base/rand_util.h" | |
| 23 #include "base/single_thread_task_runner.h" | 21 #include "base/single_thread_task_runner.h" |
| 24 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
| 25 #include "base/task_runner_util.h" | 23 #include "base/task_runner_util.h" |
| 26 #include "base/thread_task_runner_handle.h" | 24 #include "base/thread_task_runner_handle.h" |
| 27 #include "base/trace_event/trace_event.h" | 25 #include "base/trace_event/trace_event.h" |
| 28 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 29 #include "cc/blink/web_layer_impl.h" | 27 #include "cc/blink/web_layer_impl.h" |
| 30 #include "cc/layers/video_layer.h" | 28 #include "cc/layers/video_layer.h" |
| 31 #include "gpu/blink/webgraphicscontext3d_impl.h" | 29 #include "gpu/blink/webgraphicscontext3d_impl.h" |
| 32 #include "media/audio/null_audio_sink.h" | 30 #include "media/audio/null_audio_sink.h" |
| (...skipping 872 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 905 } | 903 } |
| 906 | 904 |
| 907 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { | 905 void WebMediaPlayerImpl::OnPipelineError(PipelineStatus error) { |
| 908 DVLOG(1) << __FUNCTION__; | 906 DVLOG(1) << __FUNCTION__; |
| 909 DCHECK(main_task_runner_->BelongsToCurrentThread()); | 907 DCHECK(main_task_runner_->BelongsToCurrentThread()); |
| 910 DCHECK_NE(error, PIPELINE_OK); | 908 DCHECK_NE(error, PIPELINE_OK); |
| 911 | 909 |
| 912 if (suppress_destruction_errors_) | 910 if (suppress_destruction_errors_) |
| 913 return; | 911 return; |
| 914 | 912 |
| 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 | |
| 925 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); | 913 media_log_->AddEvent(media_log_->CreatePipelineErrorEvent(error)); |
| 926 | 914 |
| 927 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { | 915 if (ready_state_ == WebMediaPlayer::ReadyStateHaveNothing) { |
| 928 // Any error that occurs before reaching ReadyStateHaveMetadata should | 916 // Any error that occurs before reaching ReadyStateHaveMetadata should |
| 929 // be considered a format error. | 917 // be considered a format error. |
| 930 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); | 918 SetNetworkState(WebMediaPlayer::NetworkStateFormatError); |
| 931 return; | 919 return; |
| 932 } | 920 } |
| 933 | 921 |
| 934 SetNetworkState(PipelineErrorToNetworkState(error)); | 922 SetNetworkState(PipelineErrorToNetworkState(error)); |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { | 1464 bool WebMediaPlayerImpl::IsAutomaticResumeAllowed() { |
| 1477 #if defined(OS_ANDROID) | 1465 #if defined(OS_ANDROID) |
| 1478 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); | 1466 return !hasVideo() || (delegate_ && !delegate_->IsHidden()); |
| 1479 #else | 1467 #else |
| 1480 // On non-Android platforms Resume() is always allowed. | 1468 // On non-Android platforms Resume() is always allowed. |
| 1481 return true; | 1469 return true; |
| 1482 #endif | 1470 #endif |
| 1483 } | 1471 } |
| 1484 | 1472 |
| 1485 } // namespace media | 1473 } // namespace media |
| OLD | NEW |