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 "chrome/renderer/media/chrome_key_systems.h" | 5 #include "chrome/renderer/media/chrome_key_systems.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
| 14 #include "base/strings/string_split.h" | 14 #include "base/strings/string_split.h" |
| 15 #include "base/strings/utf_string_conversions.h" | 15 #include "base/strings/utf_string_conversions.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 #include "chrome/common/render_messages.h" | 17 #include "chrome/common/render_messages.h" |
| 18 #include "components/cdm/renderer/widevine_key_systems.h" | |
| 19 #include "content/public/renderer/render_thread.h" | 18 #include "content/public/renderer/render_thread.h" |
| 20 #include "media/base/eme_constants.h" | 19 #include "media/base/eme_constants.h" |
| 21 #include "media/media_features.h" | 20 #include "media/media_features.h" |
| 22 | 21 |
| 23 #if defined(OS_ANDROID) | 22 #if defined(OS_ANDROID) |
| 24 #include "components/cdm/renderer/android_key_systems.h" | 23 #include "components/cdm/renderer/android_key_systems.h" |
| 25 #endif | 24 #endif |
| 26 | 25 |
| 27 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 26 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| 28 | 27 |
| 29 // The following must be after widevine_cdm_version.h. | 28 // The following must be after widevine_cdm_version.h. |
| 30 | 29 |
| 31 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 30 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
| 32 #include <gnu/libc-version.h> | 31 #include <gnu/libc-version.h> |
| 33 #include "base/version.h" | 32 #include "base/version.h" |
| 34 #endif | 33 #endif |
| 35 | 34 |
| 36 using media::KeySystemInfo; | 35 using media::KeySystemInfo; |
| 36 using media::KeySystemProperties; | |
| 37 using media::SupportedCodecs; | 37 using media::SupportedCodecs; |
| 38 | 38 |
| 39 #if defined(ENABLE_PEPPER_CDMS) | 39 #if defined(ENABLE_PEPPER_CDMS) |
| 40 static bool IsPepperCdmAvailable( | 40 static bool IsPepperCdmAvailable( |
| 41 const std::string& pepper_type, | 41 const std::string& pepper_type, |
| 42 std::vector<base::string16>* additional_param_names, | 42 std::vector<base::string16>* additional_param_names, |
| 43 std::vector<base::string16>* additional_param_values) { | 43 std::vector<base::string16>* additional_param_values) { |
| 44 bool is_available = false; | 44 bool is_available = false; |
| 45 content::RenderThread::Get()->Send( | 45 content::RenderThread::Get()->Send( |
| 46 new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType( | 46 new ChromeViewHostMsg_IsInternalPluginAvailableForMimeType( |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 143 } | 143 } |
| 144 *codecs = base::SplitString( | 144 *codecs = base::SplitString( |
| 145 codecs_string, std::string(1, kCdmSupportedCodecsValueDelimiter), | 145 codecs_string, std::string(1, kCdmSupportedCodecsValueDelimiter), |
| 146 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 146 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 147 break; | 147 break; |
| 148 } | 148 } |
| 149 } | 149 } |
| 150 } | 150 } |
| 151 | 151 |
| 152 static void AddPepperBasedWidevine( | 152 static void AddPepperBasedWidevine( |
| 153 std::vector<KeySystemInfo>* concrete_key_systems) { | 153 std::vector<std::unique_ptr<KeySystemProperties>>* concrete_key_systems) { |
| 154 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 154 #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
| 155 Version glibc_version(gnu_get_libc_version()); | 155 Version glibc_version(gnu_get_libc_version()); |
| 156 DCHECK(glibc_version.IsValid()); | 156 DCHECK(glibc_version.IsValid()); |
| 157 if (glibc_version < base::Version(WIDEVINE_CDM_MIN_GLIBC_VERSION)) | 157 if (glibc_version < base::Version(WIDEVINE_CDM_MIN_GLIBC_VERSION)) |
| 158 return; | 158 return; |
| 159 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 159 #endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
| 160 | 160 |
| 161 std::vector<base::string16> additional_param_names; | 161 std::vector<base::string16> additional_param_names; |
| 162 std::vector<base::string16> additional_param_values; | 162 std::vector<base::string16> additional_param_values; |
| 163 if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, | 163 if (!IsPepperCdmAvailable(kWidevineCdmPluginMimeType, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 191 #if defined(USE_PROPRIETARY_CODECS) | 191 #if defined(USE_PROPRIETARY_CODECS) |
| 192 if (codecs[i] == kCdmSupportedCodecAvc1) | 192 if (codecs[i] == kCdmSupportedCodecAvc1) |
| 193 supported_codecs |= media::EME_CODEC_MP4_AVC1; | 193 supported_codecs |= media::EME_CODEC_MP4_AVC1; |
| 194 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) | 194 #if BUILDFLAG(ENABLE_MP4_VP9_DEMUXING) |
| 195 if (codecs[i] == kCdmSupportedCodecVp9) | 195 if (codecs[i] == kCdmSupportedCodecVp9) |
| 196 supported_codecs |= media::EME_CODEC_MP4_VP9; | 196 supported_codecs |= media::EME_CODEC_MP4_VP9; |
| 197 #endif | 197 #endif |
| 198 #endif // defined(USE_PROPRIETARY_CODECS) | 198 #endif // defined(USE_PROPRIETARY_CODECS) |
| 199 } | 199 } |
| 200 | 200 |
| 201 cdm::AddWidevineWithCodecs( | 201 concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( |
| 202 supported_codecs, | 202 supported_codecs, |
| 203 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
| 204 media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness. | 204 media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness. |
| 205 media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness. | 205 media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness. |
| 206 media::EmeSessionTypeSupport:: | 206 media::EmeSessionTypeSupport:: |
| 207 SUPPORTED_WITH_IDENTIFIER, // Persistent-license. | 207 SUPPORTED_WITH_IDENTIFIER, // Persistent-license. |
| 208 media::EmeSessionTypeSupport:: | 208 media::EmeSessionTypeSupport:: |
| 209 NOT_SUPPORTED, // Persistent-release-message. | 209 NOT_SUPPORTED, // Persistent-release-message. |
| 210 media::EmeFeatureSupport::REQUESTABLE, // Persistent state. | 210 media::EmeFeatureSupport::REQUESTABLE, // Persistent state. |
| 211 media::EmeFeatureSupport::REQUESTABLE, // Distinctive identifier. | 211 media::EmeFeatureSupport::REQUESTABLE)); // Distinctive identifier. |
| 212 #else // (Desktop) | 212 #else // (Desktop) |
| 213 media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness. | 213 media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness. |
| 214 media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness. | 214 media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness. |
| 215 media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. | 215 media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license. |
| 216 media::EmeSessionTypeSupport:: | 216 media::EmeSessionTypeSupport:: |
| 217 NOT_SUPPORTED, // persistent-release-message. | 217 NOT_SUPPORTED, // persistent-release-message. |
| 218 media::EmeFeatureSupport::REQUESTABLE, // Persistent state. | 218 media::EmeFeatureSupport::REQUESTABLE, // Persistent state. |
| 219 media::EmeFeatureSupport::NOT_SUPPORTED, // Distinctive identifier. | 219 media::EmeFeatureSupport::NOT_SUPPORTED)); // Distinctive identifier. |
| 220 #endif // defined(OS_CHROMEOS) | 220 #endif // defined(OS_CHROMEOS) |
| 221 concrete_key_systems); | |
| 222 } | 221 } |
| 223 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 222 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 224 #endif // defined(ENABLE_PEPPER_CDMS) | 223 #endif // defined(ENABLE_PEPPER_CDMS) |
| 225 | 224 |
| 226 void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) { | 225 void AddChromeKeySystemsInfo(std::vector<KeySystemInfo>* key_systems_info) { |
| 227 #if defined(ENABLE_PEPPER_CDMS) | 226 #if defined(ENABLE_PEPPER_CDMS) |
| 228 AddExternalClearKey(key_systems_info); | 227 AddExternalClearKey(key_systems_info); |
|
ddorwin
2016/04/27 22:41:54
Should we just convert ECK in this CL. Then we wou
halliwell
2016/04/27 23:50:45
We could, was just trying to break up the changes
ddorwin
2016/04/28 01:05:59
Thanks for considering that. In this case, replaci
| |
| 228 #endif | |
| 229 } | |
| 229 | 230 |
| 231 void AddChromeKeySystems( | |
| 232 std::vector<std::unique_ptr<KeySystemProperties>>* key_systems_properties) { | |
| 233 #if defined(ENABLE_PEPPER_CDMS) | |
| 230 #if defined(WIDEVINE_CDM_AVAILABLE) | 234 #if defined(WIDEVINE_CDM_AVAILABLE) |
| 231 AddPepperBasedWidevine(key_systems_info); | 235 AddPepperBasedWidevine(key_systems_properties); |
| 232 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 236 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
| 233 #endif // defined(ENABLE_PEPPER_CDMS) | 237 #endif // defined(ENABLE_PEPPER_CDMS) |
| 234 | 238 |
| 235 #if defined(OS_ANDROID) | 239 #if defined(OS_ANDROID) |
| 236 cdm::AddAndroidWidevine(key_systems_info); | 240 cdm::AddAndroidWidevine(key_systems_properties); |
| 237 #endif // defined(OS_ANDROID) | 241 #endif // defined(OS_ANDROID) |
| 238 } | 242 } |
| OLD | NEW |