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 <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
12 #include "base/strings/string_split.h" | 12 #include "base/strings/string_split.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "chrome/common/render_messages.h" | 14 #include "chrome/common/render_messages.h" |
15 #include "components/cdm/renderer/widevine_key_systems.h" | 15 #include "components/cdm/renderer/widevine_key_systems.h" |
16 #include "content/public/renderer/render_thread.h" | 16 #include "content/public/renderer/render_thread.h" |
17 #include "media/base/eme_constants.h" | 17 #include "media/base/eme_constants.h" |
18 | 18 |
19 #if defined(OS_ANDROID) | 19 #if defined(OS_ANDROID) |
20 #include "components/cdm/renderer/android_key_systems.h" | 20 #include "components/cdm/renderer/android_key_systems.h" |
21 #endif | 21 #endif |
22 | 22 |
23 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. | 23 #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
24 | 24 |
25 // The following must be after widevine_cdm_version.h. | 25 // The following must be after widevine_cdm_version.h. |
26 | 26 |
27 #if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) | 27 #if defined(ENABLE_WIDEVINE_CDM) && defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
28 #include <gnu/libc-version.h> | 28 #include <gnu/libc-version.h> |
29 #include "base/version.h" | 29 #include "base/version.h" |
30 #endif | 30 #endif |
31 | 31 |
32 using media::KeySystemInfo; | 32 using media::KeySystemInfo; |
33 using media::SupportedCodecs; | 33 using media::SupportedCodecs; |
34 | 34 |
35 #if defined(ENABLE_PEPPER_CDMS) | 35 #if defined(ENABLE_PEPPER_CDMS) |
36 static bool IsPepperCdmAvailable( | 36 static bool IsPepperCdmAvailable( |
37 const std::string& pepper_type, | 37 const std::string& pepper_type, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // will be refused by ClearKeyCdm. This is to test the CDM initialization | 97 // will be refused by ClearKeyCdm. This is to test the CDM initialization |
98 // failure case. | 98 // failure case. |
99 info.key_system = kExternalClearKeyInitializeFailKeySystem; | 99 info.key_system = kExternalClearKeyInitializeFailKeySystem; |
100 concrete_key_systems->push_back(info); | 100 concrete_key_systems->push_back(info); |
101 | 101 |
102 // A key system that triggers a crash in ClearKeyCdm. | 102 // A key system that triggers a crash in ClearKeyCdm. |
103 info.key_system = kExternalClearKeyCrashKeySystem; | 103 info.key_system = kExternalClearKeyCrashKeySystem; |
104 concrete_key_systems->push_back(info); | 104 concrete_key_systems->push_back(info); |
105 } | 105 } |
106 | 106 |
107 #if defined(WIDEVINE_CDM_AVAILABLE) | 107 #if defined(ENABLE_WIDEVINE_CDM) |
108 // This function finds "codecs" and parses the value into the vector |codecs|. | 108 // This function finds "codecs" and parses the value into the vector |codecs|. |
109 // Converts the codec strings to UTF-8 since we only expect ASCII strings and | 109 // Converts the codec strings to UTF-8 since we only expect ASCII strings and |
110 // this simplifies the rest of the code in this file. | 110 // this simplifies the rest of the code in this file. |
111 void GetSupportedCodecsForPepperCdm( | 111 void GetSupportedCodecsForPepperCdm( |
112 const std::vector<base::string16>& additional_param_names, | 112 const std::vector<base::string16>& additional_param_names, |
113 const std::vector<base::string16>& additional_param_values, | 113 const std::vector<base::string16>& additional_param_values, |
114 std::vector<std::string>* codecs) { | 114 std::vector<std::string>* codecs) { |
115 DCHECK(codecs->empty()); | 115 DCHECK(codecs->empty()); |
116 DCHECK_EQ(additional_param_names.size(), additional_param_values.size()); | 116 DCHECK_EQ(additional_param_names.size(), additional_param_values.size()); |
117 for (size_t i = 0; i < additional_param_names.size(); ++i) { | 117 for (size_t i = 0; i < additional_param_names.size(); ++i) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 #if defined(USE_PROPRIETARY_CODECS) | 175 #if defined(USE_PROPRIETARY_CODECS) |
176 if (codecs[i] == kCdmSupportedCodecAvc1) | 176 if (codecs[i] == kCdmSupportedCodecAvc1) |
177 supported_codecs |= media::EME_CODEC_MP4_AVC1; | 177 supported_codecs |= media::EME_CODEC_MP4_AVC1; |
178 #endif // defined(USE_PROPRIETARY_CODECS) | 178 #endif // defined(USE_PROPRIETARY_CODECS) |
179 } | 179 } |
180 | 180 |
181 cdm::AddWidevineWithCodecs(cdm::WIDEVINE, | 181 cdm::AddWidevineWithCodecs(cdm::WIDEVINE, |
182 supported_codecs, | 182 supported_codecs, |
183 concrete_key_systems); | 183 concrete_key_systems); |
184 } | 184 } |
185 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 185 #endif // defined(ENABLE_WIDEVINE_CDM) |
186 #endif // defined(ENABLE_PEPPER_CDMS) | 186 #endif // defined(ENABLE_PEPPER_CDMS) |
187 | 187 |
188 void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) { | 188 void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) { |
189 #if defined(ENABLE_PEPPER_CDMS) | 189 #if defined(ENABLE_PEPPER_CDMS) |
190 AddExternalClearKey(key_systems_info); | 190 AddExternalClearKey(key_systems_info); |
191 | 191 |
192 #if defined(WIDEVINE_CDM_AVAILABLE) | 192 #if defined(ENABLE_WIDEVINE_CDM) |
193 AddPepperBasedWidevine(key_systems_info); | 193 AddPepperBasedWidevine(key_systems_info); |
194 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 194 #endif // defined(ENABLE_WIDEVINE_CDM) |
195 #endif // defined(ENABLE_PEPPER_CDMS) | 195 #endif // defined(ENABLE_PEPPER_CDMS) |
196 | 196 |
197 #if defined(OS_ANDROID) | 197 #if defined(OS_ANDROID) |
198 cdm::AddAndroidWidevine(key_systems_info); | 198 cdm::AddAndroidWidevine(key_systems_info); |
199 #endif // defined(OS_ANDROID) | 199 #endif // defined(OS_ANDROID) |
200 } | 200 } |
OLD | NEW |