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/external_clear_key_key_system_properties.h" | 18 #include "components/cdm/renderer/external_clear_key_key_system_properties.h" |
19 #include "components/cdm/renderer/widevine_key_system_properties.h" | 19 #include "components/cdm/renderer/widevine_key_system_properties.h" |
20 #include "content/public/renderer/render_thread.h" | 20 #include "content/public/renderer/render_thread.h" |
21 #include "media/base/eme_constants.h" | 21 #include "media/base/eme_constants.h" |
22 #include "media/base/key_system_properties.h" | 22 #include "media/base/key_system_properties.h" |
23 #include "media/media_features.h" | |
24 #include "ppapi/features/features.h" | 23 #include "ppapi/features/features.h" |
25 | 24 |
26 #if defined(OS_ANDROID) | 25 #if defined(OS_ANDROID) |
27 #include "components/cdm/renderer/android_key_systems.h" | 26 #include "components/cdm/renderer/android_key_systems.h" |
28 #endif | 27 #endif |
29 | 28 |
30 #if BUILDFLAG(ENABLE_PEPPER_CDMS) | 29 #if BUILDFLAG(ENABLE_PEPPER_CDMS) |
31 #include "base/feature_list.h" | 30 #include "base/feature_list.h" |
32 #include "media/base/media_switches.h" | 31 #include "media/base/media_switches.h" |
33 #endif | 32 #endif |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 additional_param_values, | 173 additional_param_values, |
175 &codecs); | 174 &codecs); |
176 | 175 |
177 SupportedCodecs supported_codecs = media::EME_CODEC_NONE; | 176 SupportedCodecs supported_codecs = media::EME_CODEC_NONE; |
178 | 177 |
179 // Audio codecs are always supported. | 178 // Audio codecs are always supported. |
180 // TODO(sandersd): Distinguish these from those that are directly supported, | 179 // TODO(sandersd): Distinguish these from those that are directly supported, |
181 // as those may offer a higher level of protection. | 180 // as those may offer a higher level of protection. |
182 supported_codecs |= media::EME_CODEC_WEBM_OPUS; | 181 supported_codecs |= media::EME_CODEC_WEBM_OPUS; |
183 supported_codecs |= media::EME_CODEC_WEBM_VORBIS; | 182 supported_codecs |= media::EME_CODEC_WEBM_VORBIS; |
184 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 183 #if defined(USE_PROPRIETARY_CODECS) |
185 supported_codecs |= media::EME_CODEC_MP4_AAC; | 184 supported_codecs |= media::EME_CODEC_MP4_AAC; |
186 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) | 185 #endif // defined(USE_PROPRIETARY_CODECS) |
187 | 186 |
188 for (size_t i = 0; i < codecs.size(); ++i) { | 187 for (size_t i = 0; i < codecs.size(); ++i) { |
189 if (codecs[i] == kCdmSupportedCodecVp8) | 188 if (codecs[i] == kCdmSupportedCodecVp8) |
190 supported_codecs |= media::EME_CODEC_WEBM_VP8; | 189 supported_codecs |= media::EME_CODEC_WEBM_VP8; |
191 if (codecs[i] == kCdmSupportedCodecVp9) | 190 if (codecs[i] == kCdmSupportedCodecVp9) |
192 supported_codecs |= media::EME_CODEC_WEBM_VP9; | 191 supported_codecs |= media::EME_CODEC_WEBM_VP9; |
193 #if BUILDFLAG(USE_PROPRIETARY_CODECS) | 192 #if defined(USE_PROPRIETARY_CODECS) |
194 if (codecs[i] == kCdmSupportedCodecAvc1) | 193 if (codecs[i] == kCdmSupportedCodecAvc1) |
195 supported_codecs |= media::EME_CODEC_MP4_AVC1; | 194 supported_codecs |= media::EME_CODEC_MP4_AVC1; |
196 if (codecs[i] == kCdmSupportedCodecVp9) | 195 if (codecs[i] == kCdmSupportedCodecVp9) |
197 supported_codecs |= media::EME_CODEC_MP4_VP9; | 196 supported_codecs |= media::EME_CODEC_MP4_VP9; |
198 #endif // BUILDFLAG(USE_PROPRIETARY_CODECS) | 197 #endif // defined(USE_PROPRIETARY_CODECS) |
199 } | 198 } |
200 | 199 |
201 using Robustness = cdm::WidevineKeySystemProperties::Robustness; | 200 using Robustness = cdm::WidevineKeySystemProperties::Robustness; |
202 concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( | 201 concrete_key_systems->emplace_back(new cdm::WidevineKeySystemProperties( |
203 supported_codecs, | 202 supported_codecs, |
204 #if defined(OS_CHROMEOS) | 203 #if defined(OS_CHROMEOS) |
205 Robustness::HW_SECURE_ALL, // Maximum audio robustness. | 204 Robustness::HW_SECURE_ALL, // Maximum audio robustness. |
206 Robustness::HW_SECURE_ALL, // Maximim video robustness. | 205 Robustness::HW_SECURE_ALL, // Maximim video robustness. |
207 media::EmeSessionTypeSupport:: | 206 media::EmeSessionTypeSupport:: |
208 SUPPORTED_WITH_IDENTIFIER, // Persistent-license. | 207 SUPPORTED_WITH_IDENTIFIER, // Persistent-license. |
(...skipping 23 matching lines...) Expand all Loading... |
232 #if defined(WIDEVINE_CDM_AVAILABLE) | 231 #if defined(WIDEVINE_CDM_AVAILABLE) |
233 AddPepperBasedWidevine(key_systems_properties); | 232 AddPepperBasedWidevine(key_systems_properties); |
234 #endif // defined(WIDEVINE_CDM_AVAILABLE) | 233 #endif // defined(WIDEVINE_CDM_AVAILABLE) |
235 | 234 |
236 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) | 235 #endif // BUILDFLAG(ENABLE_PEPPER_CDMS) |
237 | 236 |
238 #if defined(OS_ANDROID) | 237 #if defined(OS_ANDROID) |
239 cdm::AddAndroidWidevine(key_systems_properties); | 238 cdm::AddAndroidWidevine(key_systems_properties); |
240 #endif // defined(OS_ANDROID) | 239 #endif // defined(OS_ANDROID) |
241 } | 240 } |
OLD | NEW |