Chromium Code Reviews| 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/base/media.h" | 5 #include "media/base/media.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 96 // we have enough data to support the primacy of the unified media pipeline; | 96 // we have enough data to support the primacy of the unified media pipeline; |
| 97 // see http://crbug.com/533190 for details. | 97 // see http://crbug.com/533190 for details. |
| 98 // | 98 // |
| 99 // Note: It's important to query the field trial state first, to ensure that | 99 // Note: It's important to query the field trial state first, to ensure that |
| 100 // UMA reports the correct group. | 100 // UMA reports the correct group. |
| 101 const std::string group_name = | 101 const std::string group_name = |
| 102 base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial"); | 102 base::FieldTrialList::FindFullName("UnifiedMediaPipelineTrial"); |
| 103 const bool enabled_via_cli = | 103 const bool enabled_via_cli = |
| 104 base::CommandLine::ForCurrentProcess()->HasSwitch( | 104 base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 105 switches::kEnableUnifiedMediaPipeline); | 105 switches::kEnableUnifiedMediaPipeline); |
| 106 return enabled_via_cli || | 106 // TODO(watk, dalecurtis): AVDA has bugs on API level 16 and 17 so it's |
| 107 base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); | 107 // disabled for now. http://crbug.com/597467 |
| 108 const bool api_level_supported = | |
| 109 base::android::BuildInfo::GetInstance()->sdk_int() >= 18; | |
| 110 | |
| 111 if (enabled_via_cli) | |
|
DaleCurtis
2016/03/24 03:16:44
Seems cleaner as return "enabled_via_cli || api_le
| |
| 112 return true; | |
| 113 if (!api_level_supported) | |
| 114 return false; | |
| 115 return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE); | |
| 108 } | 116 } |
| 109 | 117 |
| 110 bool IsUnifiedMediaPipelineEnabledForMse() { | 118 bool IsUnifiedMediaPipelineEnabledForMse() { |
| 111 // Don't check IsUnifiedMediaPipelineEnabled() here since we don't want MSE to | 119 // Don't check IsUnifiedMediaPipelineEnabled() here since we don't want MSE to |
| 112 // be enabled via experiment yet; only when the existing implementation can't | 120 // be enabled via experiment yet; only when the existing implementation can't |
| 113 // be used (i.e. MediaCodec unavailable). | 121 // be used (i.e. MediaCodec unavailable). |
| 114 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 122 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 115 switches::kEnableUnifiedMediaPipeline) || | 123 switches::kEnableUnifiedMediaPipeline) || |
| 116 !MediaCodecUtil::IsMediaCodecAvailable(); | 124 !MediaCodecUtil::IsMediaCodecAvailable(); |
| 117 } | 125 } |
| 118 | 126 |
| 119 bool ArePlatformDecodersAvailable() { | 127 bool ArePlatformDecodersAvailable() { |
| 120 return IsUnifiedMediaPipelineEnabled() | 128 return IsUnifiedMediaPipelineEnabled() |
| 121 ? HasPlatformDecoderSupport() | 129 ? HasPlatformDecoderSupport() |
| 122 : MediaCodecUtil::IsMediaCodecAvailable(); | 130 : MediaCodecUtil::IsMediaCodecAvailable(); |
| 123 } | 131 } |
| 124 #endif | 132 #endif |
| 125 | 133 |
| 126 } // namespace media | 134 } // namespace media |
| OLD | NEW |