Index: webkit/renderer/media/crypto/key_systems_info.cc |
diff --git a/webkit/renderer/media/crypto/key_systems_info.cc b/webkit/renderer/media/crypto/key_systems_info.cc |
index 9810c349eaa4baa9b47d72cee3ade5e82935b880..ae322e4bc6d2ad4de989ce6030f8489bf32d8a76 100644 |
--- a/webkit/renderer/media/crypto/key_systems_info.cc |
+++ b/webkit/renderer/media/crypto/key_systems_info.cc |
@@ -6,6 +6,8 @@ |
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
+// The following must be after widevine_cdm_version.h. |
+ |
#if defined(WIDEVINE_CDM_AVAILABLE) && \ |
defined(OS_LINUX) && !defined(OS_CHROMEOS) |
#include <gnu/libc-version.h> |
@@ -13,6 +15,11 @@ |
#include "base/version.h" |
#endif |
+#if defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) |
+#include "base/command_line.h" |
+#include "media/base/media_switches.h" |
+#endif |
+ |
namespace webkit_media { |
static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey"; |
@@ -23,7 +30,6 @@ static const char kExternalClearKeyKeySystem[] = |
#if defined(WIDEVINE_CDM_AVAILABLE) |
// TODO(ddorwin): Automatically support parent systems: http://crbug.com/164303. |
static const char kWidevineBaseKeySystem[] = "com.widevine"; |
-#endif // defined(WIDEVINE_CDM_AVAILABLE) |
#if defined(WIDEVINE_CDM_CENC_SUPPORT_AVAILABLE) |
// The supported codecs depend on what the CDM provides. |
@@ -45,6 +51,12 @@ static const char kWidevineAudioMp4Codecs[] = |
#endif |
#endif // defined(WIDEVINE_CDM_CENC_SUPPORT_AVAILABLE) |
+static inline bool IsWidevine(const std::string& key_system) { |
+ return key_system == kWidevineKeySystem || |
+ key_system == kWidevineBaseKeySystem; |
+} |
+#endif // defined(WIDEVINE_CDM_AVAILABLE) |
+ |
const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[] = { |
// Clear Key. |
{ "video/webm", "vorbis,vp8,vp8.0", kClearKeyKeySystem }, |
@@ -64,10 +76,6 @@ const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[] = { |
#if defined(WIDEVINE_CDM_AVAILABLE) |
// Widevine. |
- // See http://crbug.com/237627. |
-#if defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) |
- { "", "", kWidevineKeySystem }, |
-#else |
{ "video/webm", "vorbis,vp8,vp8.0", kWidevineKeySystem }, |
{ "audio/webm", "vorbis", kWidevineKeySystem }, |
{ "video/webm", "vorbis,vp8,vp8.0", kWidevineBaseKeySystem }, |
@@ -80,7 +88,6 @@ const MediaFormatAndKeySystem kSupportedFormatKeySystemCombinations[] = { |
{ "audio/mp4", kWidevineAudioMp4Codecs, kWidevineBaseKeySystem }, |
#endif // defined(WIDEVINE_CDM_CENC_SUPPORT_AVAILABLE) |
#endif // defined(GOOGLE_CHROME_BUILD) || defined(USE_PROPRIETARY_CODECS) |
-#endif // defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) |
#endif // WIDEVINE_CDM_AVAILABLE |
}; |
@@ -117,8 +124,7 @@ const int kNumKeySystemToUUIDMapping = |
bool IsSystemCompatible(const std::string& key_system) { |
#if defined(WIDEVINE_CDM_AVAILABLE) && \ |
defined(OS_LINUX) && !defined(OS_CHROMEOS) |
- if (key_system == kWidevineKeySystem || |
- key_system == kWidevineBaseKeySystem) { |
+ if (IsWidevine(key_system)) { |
Version glibc_version(gnu_get_libc_version()); |
DCHECK(glibc_version.IsValid()); |
return !glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION); |
@@ -127,6 +133,17 @@ bool IsSystemCompatible(const std::string& key_system) { |
return true; |
} |
+bool IsCanPlayTypeSuppressed(const std::string& key_system) { |
+#if defined(DISABLE_WIDEVINE_CDM_CANPLAYTYPE) |
+ // See http://crbug.com/237627. |
+ if (IsWidevine(key_system) && |
+ !CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kEncryptedMediaCanPlayTypeOverride)) |
+ return true; |
+#endif |
+ return false; |
+} |
+ |
std::string KeySystemNameForUMAGeneric(const std::string& key_system) { |
if (key_system == kClearKeyKeySystem) |
return "ClearKey"; |