Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(371)

Unified Diff: chrome/renderer/media/chrome_key_systems.cc

Issue 23828007: Check whether the Pepper CDM is available before adding the key system. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix bug that broke the test CDM. Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/render_messages.h ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/media/chrome_key_systems.cc
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index be7c4b1e05373b34250e14affc2bf1f95899e60c..e8b5058e8c84c0e9a60cdc8fc91d6bd991ccb211 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -5,6 +5,8 @@
#include "chrome/renderer/media/chrome_key_systems.h"
#include "base/logging.h"
+#include "chrome/common/render_messages.h"
+#include "content/public/renderer/render_thread.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
@@ -30,6 +32,58 @@ static const char kMp4a[] = "mp4a";
static const char kAvc1[] = "avc1";
static const char kMp4aAvc1[] = "mp4a,avc1";
+static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) {
+ KeySystemInfo info(kClearKeyKeySystem);
+
+ info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis));
+ info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8));
+#if defined(USE_PROPRIETARY_CODECS)
+ info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
+ info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1));
+#endif // defined(USE_PROPRIETARY_CODECS)
+
+ info.use_aes_decryptor = true;
+
+ concrete_key_systems->push_back(info);
+}
+
+#if defined(ENABLE_PEPPER_CDMS)
+static bool IsPepperCdmRegistered(const std::string& pepper_type) {
+ bool is_registered = false;
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_IsInternalPluginRegisteredForMimeType(
+ pepper_type, &is_registered));
+
+ return is_registered;
+}
+
+// External Clear Key (used for testing).
+static void AddExternalClearKey(
+ std::vector<KeySystemInfo>* concrete_key_systems) {
+ static const char kExternalClearKeyKeySystem[] =
+ "org.chromium.externalclearkey";
+ static const char kExternalClearKeyPepperType[] =
+ "application/x-ppapi-clearkey-cdm";
+
+ if (!IsPepperCdmRegistered(kExternalClearKeyPepperType))
+ return;
+
+ KeySystemInfo info(kExternalClearKeyKeySystem);
+
+ info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis));
+ info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8));
+#if defined(USE_PROPRIETARY_CODECS)
+ info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
+ info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1));
+#endif // defined(USE_PROPRIETARY_CODECS)
+
+ info.pepper_type = kExternalClearKeyPepperType;
+
+ concrete_key_systems->push_back(info);
+}
+#endif // defined(ENABLE_PEPPER_CDMS)
+
+
#if defined(WIDEVINE_CDM_AVAILABLE)
// Defines bitmask values used to specify supported codecs.
// Each value represents a codec within a specific container.
@@ -51,13 +105,6 @@ static void AddWidevineWithCodecs(
0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
#endif
-#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
- Version glibc_version(gnu_get_libc_version());
- DCHECK(glibc_version.IsValid());
- if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION))
- return;
-#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
-
KeySystemInfo info(kWidevineKeySystem);
if (supported_codecs & WEBM_VP8_AND_VORBIS) {
@@ -90,6 +137,18 @@ static void AddWidevineWithCodecs(
// Supported types are determined at compile time.
static void AddPepperBasedWidevine(
std::vector<KeySystemInfo>* concrete_key_systems) {
+#if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
+ Version glibc_version(gnu_get_libc_version());
+ DCHECK(glibc_version.IsValid());
+ if (glibc_version.IsOlderThan(WIDEVINE_CDM_MIN_GLIBC_VERSION))
+ return;
+#endif // defined(WIDEVINE_CDM_MIN_GLIBC_VERSION)
+
+ if (!IsPepperCdmRegistered(kWidevineCdmPluginMimeType)) {
+ DVLOG(1) << "Widevine CDM is not currently available.";
+ return;
+ }
+
SupportedCodecs supported_codecs = WEBM_VP8_AND_VORBIS;
#if defined(USE_PROPRIETARY_CODECS)
@@ -115,45 +174,6 @@ static void AddAndroidWidevine(
#endif // defined(ENABLE_PEPPER_CDMS)
#endif // defined(WIDEVINE_CDM_AVAILABLE)
-static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) {
- KeySystemInfo info(kClearKeyKeySystem);
-
- info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis));
- info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8));
-#if defined(USE_PROPRIETARY_CODECS)
- info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
- info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1));
-#endif // defined(USE_PROPRIETARY_CODECS)
-
- info.use_aes_decryptor = true;
-
- concrete_key_systems->push_back(info);
-}
-
-#if defined(ENABLE_PEPPER_CDMS)
-// External Clear Key (used for testing).
-static void AddExternalClearKey(
- std::vector<KeySystemInfo>* concrete_key_systems) {
- static const char kExternalClearKeyKeySystem[] =
- "org.chromium.externalclearkey";
- static const char kExternalClearKeyPepperType[] =
- "application/x-ppapi-clearkey-cdm";
-
- KeySystemInfo info(kExternalClearKeyKeySystem);
-
- info.supported_types.push_back(std::make_pair(kAudioWebM, kVorbis));
- info.supported_types.push_back(std::make_pair(kVideoWebM, kVorbisVP8));
-#if defined(USE_PROPRIETARY_CODECS)
- info.supported_types.push_back(std::make_pair(kAudioMp4, kMp4a));
- info.supported_types.push_back(std::make_pair(kVideoMp4, kMp4aAvc1));
-#endif // defined(USE_PROPRIETARY_CODECS)
-
- info.pepper_type = kExternalClearKeyPepperType;
-
- concrete_key_systems->push_back(info);
-}
-#endif // defined(ENABLE_PEPPER_CDMS)
-
void AddChromeKeySystems(std::vector<KeySystemInfo>* key_systems_info) {
AddClearKey(key_systems_info);
« no previous file with comments | « chrome/common/render_messages.h ('k') | content/browser/plugin_service_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698