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