summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android_webview/renderer/aw_key_systems.cc3
-rw-r--r--chrome/renderer/media/chrome_key_systems.cc4
-rw-r--r--components/cdm.gypi8
-rw-r--r--components/cdm/browser/cdm_message_filter_android.cc16
-rw-r--r--components/cdm/browser/cdm_message_filter_android.h9
-rw-r--r--components/cdm/common/cdm_messages_android.h11
-rw-r--r--components/cdm/renderer/android_key_systems.cc73
-rw-r--r--components/cdm/renderer/android_key_systems.h24
-rw-r--r--components/cdm/renderer/widevine_key_systems.cc34
-rw-r--r--components/cdm/renderer/widevine_key_systems.h5
-rw-r--r--media/base/android/media_drm_bridge.cc19
-rw-r--r--media/base/android/media_drm_bridge.h4
12 files changed, 160 insertions, 50 deletions
diff --git a/android_webview/renderer/aw_key_systems.cc b/android_webview/renderer/aw_key_systems.cc
index fb17c01..2076c92 100644
--- a/android_webview/renderer/aw_key_systems.cc
+++ b/android_webview/renderer/aw_key_systems.cc
@@ -3,13 +3,14 @@
// found in the LICENSE file.
#include "android_webview/renderer/aw_key_systems.h"
-#include "components/cdm/renderer/widevine_key_systems.h"
+#include "components/cdm/renderer/android_key_systems.h"
namespace android_webview {
void AwAddKeySystems(
std::vector<content::KeySystemInfo>* key_systems_info) {
cdm::AddAndroidWidevine(key_systems_info);
+ cdm::AddAndroidPlatformKeySystems(key_systems_info);
}
} // namespace android_webview
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index 818d401..e8099fb 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -15,6 +15,10 @@
#include "components/cdm/renderer/widevine_key_systems.h"
#include "content/public/renderer/render_thread.h"
+#if defined(OS_ANDROID)
+#include "components/cdm/renderer/android_key_systems.h"
+#endif
+
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
// The following must be after widevine_cdm_version.h.
diff --git a/components/cdm.gypi b/components/cdm.gypi
index 14f92341..9ae2843 100644
--- a/components/cdm.gypi
+++ b/components/cdm.gypi
@@ -36,6 +36,14 @@
'cdm/renderer/widevine_key_systems.cc',
'cdm/renderer/widevine_key_systems.h',
],
+ 'conditions': [
+ ['OS == "android"', {
+ 'sources': [
+ 'cdm/renderer/android_key_systems.cc',
+ 'cdm/renderer/android_key_systems.h',
+ ],
+ }],
+ ],
},
],
'conditions': [
diff --git a/components/cdm/browser/cdm_message_filter_android.cc b/components/cdm/browser/cdm_message_filter_android.cc
index 2bda860..ccea5fe 100644
--- a/components/cdm/browser/cdm_message_filter_android.cc
+++ b/components/cdm/browser/cdm_message_filter_android.cc
@@ -5,6 +5,7 @@
#include "components/cdm/browser/cdm_message_filter_android.h"
#include <string>
+#include <vector>
#include "components/cdm/common/cdm_messages_android.h"
#include "ipc/ipc_message_macros.h"
@@ -73,8 +74,10 @@ CdmMessageFilterAndroid::~CdmMessageFilterAndroid() {}
bool CdmMessageFilterAndroid::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(CdmMessageFilterAndroid, message)
- IPC_MESSAGE_HANDLER(ChromeViewHostMsg_GetSupportedKeySystems,
- OnGetSupportedKeySystems)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_QueryKeySystemSupport,
+ OnQueryKeySystemSupport)
+ IPC_MESSAGE_HANDLER(ChromeViewHostMsg_GetPlatformKeySystemNames,
+ OnGetPlatformKeySystemNames)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -83,11 +86,11 @@ bool CdmMessageFilterAndroid::OnMessageReceived(const IPC::Message& message) {
void CdmMessageFilterAndroid::OverrideThreadForMessage(
const IPC::Message& message, BrowserThread::ID* thread) {
// Move the IPC handling to FILE thread as it is not very cheap.
- if (message.type() == ChromeViewHostMsg_GetSupportedKeySystems::ID)
+ if (message.type() == ChromeViewHostMsg_QueryKeySystemSupport::ID)
*thread = BrowserThread::FILE;
}
-void CdmMessageFilterAndroid::OnGetSupportedKeySystems(
+void CdmMessageFilterAndroid::OnQueryKeySystemSupport(
const SupportedKeySystemRequest& request,
SupportedKeySystemResponse* response) {
if (!response) {
@@ -110,4 +113,9 @@ void CdmMessageFilterAndroid::OnGetSupportedKeySystems(
response->non_compositing_codecs = GetSupportedCodecs(request, false);
}
+void CdmMessageFilterAndroid::OnGetPlatformKeySystemNames(
+ std::vector<std::string>* key_systems) {
+ *key_systems = MediaDrmBridge::GetPlatformKeySystemNames();
+}
+
} // namespace cdm
diff --git a/components/cdm/browser/cdm_message_filter_android.h b/components/cdm/browser/cdm_message_filter_android.h
index 47aa445..5388648 100644
--- a/components/cdm/browser/cdm_message_filter_android.h
+++ b/components/cdm/browser/cdm_message_filter_android.h
@@ -29,10 +29,11 @@ class CdmMessageFilterAndroid
const IPC::Message& message,
content::BrowserThread::ID* thread) OVERRIDE;
- // Retrieve the supported key systems.
- void OnGetSupportedKeySystems(
- const SupportedKeySystemRequest& request,
- SupportedKeySystemResponse* response);
+ // Query the key system information.
+ void OnQueryKeySystemSupport(const SupportedKeySystemRequest& request,
+ SupportedKeySystemResponse* response);
+
+ void OnGetPlatformKeySystemNames(std::vector<std::string>* key_systems);
DISALLOW_COPY_AND_ASSIGN(CdmMessageFilterAndroid);
};
diff --git a/components/cdm/common/cdm_messages_android.h b/components/cdm/common/cdm_messages_android.h
index e63f81b..f78674d 100644
--- a/components/cdm/common/cdm_messages_android.h
+++ b/components/cdm/common/cdm_messages_android.h
@@ -29,8 +29,15 @@ IPC_STRUCT_END()
// Messages sent from the renderer to the browser.
-// Synchronously get a list of supported EME key systems.
+// Synchronously query key system information. If the key system is supported,
+// the response will be populated.
IPC_SYNC_MESSAGE_CONTROL1_1(
- ChromeViewHostMsg_GetSupportedKeySystems,
+ ChromeViewHostMsg_QueryKeySystemSupport,
SupportedKeySystemRequest /* key system information request */,
SupportedKeySystemResponse /* key system information response */)
+
+// Synchronously get a list of platform-supported EME key system names that
+// are not explicitly handled by Chrome.
+IPC_SYNC_MESSAGE_CONTROL0_1(
+ ChromeViewHostMsg_GetPlatformKeySystemNames,
+ std::vector<std::string> /* key system names */)
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc
new file mode 100644
index 0000000..5c3837c8
--- /dev/null
+++ b/components/cdm/renderer/android_key_systems.cc
@@ -0,0 +1,73 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/cdm/renderer/android_key_systems.h"
+
+#include <string>
+#include <vector>
+
+#include "base/logging.h"
+#include "components/cdm/common/cdm_messages_android.h"
+#include "components/cdm/renderer/widevine_key_systems.h"
+#include "content/public/renderer/render_thread.h"
+
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+
+using content::KeySystemInfo;
+using content::SupportedCodecs;
+
+namespace cdm {
+
+static SupportedKeySystemResponse QueryKeySystemSupport(
+ const std::string& key_system) {
+ SupportedKeySystemRequest request;
+ SupportedKeySystemResponse response;
+
+ request.key_system = key_system;
+ request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL;
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_QueryKeySystemSupport(request, &response));
+ DCHECK(!(response.compositing_codecs & ~content::EME_CODEC_ALL))
+ << "unrecognized codec";
+ DCHECK(!(response.non_compositing_codecs & ~content::EME_CODEC_ALL))
+ << "unrecognized codec";
+ return response;
+}
+
+void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) {
+ SupportedKeySystemResponse response = QueryKeySystemSupport(
+ kWidevineKeySystem);
+ if (response.compositing_codecs != content::EME_CODEC_NONE) {
+ AddWidevineWithCodecs(
+ WIDEVINE,
+ static_cast<SupportedCodecs>(response.compositing_codecs),
+ concrete_key_systems);
+ }
+
+ if (response.non_compositing_codecs != content::EME_CODEC_NONE) {
+ AddWidevineWithCodecs(
+ WIDEVINE_HR_NON_COMPOSITING,
+ static_cast<SupportedCodecs>(response.non_compositing_codecs),
+ concrete_key_systems);
+ }
+}
+
+void AddAndroidPlatformKeySystems(
+ std::vector<KeySystemInfo>* concrete_key_systems) {
+ std::vector<std::string> key_system_names;
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_GetPlatformKeySystemNames(&key_system_names));
+
+ for (std::vector<std::string>::const_iterator it = key_system_names.begin();
+ it != key_system_names.end(); ++it) {
+ SupportedKeySystemResponse response = QueryKeySystemSupport(*it);
+ if (response.compositing_codecs != content::EME_CODEC_NONE) {
+ KeySystemInfo info(*it);
+ info.supported_codecs = response.compositing_codecs;
+ concrete_key_systems->push_back(info);
+ }
+ }
+}
+
+} // namespace cdm
diff --git a/components/cdm/renderer/android_key_systems.h b/components/cdm/renderer/android_key_systems.h
new file mode 100644
index 0000000..36be6c9
--- /dev/null
+++ b/components/cdm/renderer/android_key_systems.h
@@ -0,0 +1,24 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_CDM_RENDERER_ANDROID_KEY_SYSTEMS_H_
+#define COMPONENTS_CDM_RENDERER_ANDROID_KEY_SYSTEMS_H_
+
+#include <vector>
+
+#include "content/public/renderer/key_system_info.h"
+
+namespace cdm {
+
+void AddAndroidWidevine(
+ std::vector<content::KeySystemInfo>* concrete_key_systems);
+
+// Add platform-supported key systems which are not explicitly handled
+// by Chrome.
+void AddAndroidPlatformKeySystems(
+ std::vector<content::KeySystemInfo>* concrete_key_systems);
+
+} // namespace cdm
+
+#endif // COMPONENTS_CDM_RENDERER_ANDROID_KEY_SYSTEMS_H_
diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc
index c913fe0..2a41322 100644
--- a/components/cdm/renderer/widevine_key_systems.cc
+++ b/components/cdm/renderer/widevine_key_systems.cc
@@ -8,11 +8,8 @@
#include <vector>
#include "base/logging.h"
-#include "components/cdm/common/cdm_messages_android.h"
-#include "content/public/renderer/key_system_info.h"
-#include "content/public/renderer/render_thread.h"
-#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(WIDEVINE_CDM_AVAILABLE)
@@ -59,35 +56,6 @@ void AddWidevineWithCodecs(WidevineCdmType widevine_cdm_type,
concrete_key_systems->push_back(info);
}
-#if defined(OS_ANDROID)
-void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) {
- SupportedKeySystemRequest request;
- SupportedKeySystemResponse response;
-
- request.key_system = kWidevineKeySystem;
- request.codecs = content::EME_CODEC_WEBM_ALL | content::EME_CODEC_MP4_ALL;
- content::RenderThread::Get()->Send(
- new ChromeViewHostMsg_GetSupportedKeySystems(request, &response));
- DCHECK(response.compositing_codecs & content::EME_CODEC_ALL)
- << "unrecognized codec";
- DCHECK(response.non_compositing_codecs & content::EME_CODEC_ALL)
- << "unrecognized codec";
- if (response.compositing_codecs != content::EME_CODEC_NONE) {
- AddWidevineWithCodecs(
- WIDEVINE,
- static_cast<SupportedCodecs>(response.compositing_codecs),
- concrete_key_systems);
- }
-
- if (response.non_compositing_codecs != content::EME_CODEC_NONE) {
- AddWidevineWithCodecs(
- WIDEVINE_HR_NON_COMPOSITING,
- static_cast<SupportedCodecs>(response.non_compositing_codecs),
- concrete_key_systems);
- }
-}
-#endif // OS_ANDROID
-
} // namespace cdm
#endif // defined(WIDEVINE_CDM_AVAILABLE)
diff --git a/components/cdm/renderer/widevine_key_systems.h b/components/cdm/renderer/widevine_key_systems.h
index 3bed60c..ab1966f 100644
--- a/components/cdm/renderer/widevine_key_systems.h
+++ b/components/cdm/renderer/widevine_key_systems.h
@@ -23,11 +23,6 @@ void AddWidevineWithCodecs(
content::SupportedCodecs supported_codecs,
std::vector<content::KeySystemInfo>* concrete_key_systems);
-#if defined(OS_ANDROID)
-void AddAndroidWidevine(
- std::vector<content::KeySystemInfo>* concrete_key_systems);
-#endif // defined(OS_ANDROID)
-
} // namespace cdm
#endif // COMPONENTS_CDM_RENDERER_WIDEVINE_KEY_SYSTEMS_H_
diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc
index fc0288a..60215ea 100644
--- a/media/base/android/media_drm_bridge.cc
+++ b/media/base/android/media_drm_bridge.cc
@@ -73,6 +73,7 @@ class KeySystemUuidManager {
KeySystemUuidManager();
UUID GetUUID(const std::string& key_system);
void AddMapping(const std::string& key_system, const UUID& uuid);
+ std::vector<std::string> GetPlatformKeySystemNames();
private:
typedef base::hash_map<std::string, UUID> KeySystemUuidMap;
@@ -105,6 +106,17 @@ void KeySystemUuidManager::AddMapping(const std::string& key_system,
key_system_uuid_map_[key_system] = uuid;
}
+std::vector<std::string> KeySystemUuidManager::GetPlatformKeySystemNames() {
+ std::vector<std::string> key_systems;
+ for (KeySystemUuidMap::iterator it = key_system_uuid_map_.begin();
+ it != key_system_uuid_map_.end(); ++it) {
+ // Rule out the key system handled by Chrome explicitly.
+ if (it->first != kWidevineKeySystem)
+ key_systems.push_back(it->first);
+ }
+ return key_systems;
+}
+
base::LazyInstance<KeySystemUuidManager>::Leaky g_key_system_uuid_manager =
LAZY_INSTANCE_INITIALIZER;
@@ -264,13 +276,18 @@ bool MediaDrmBridge::IsSecurityLevelSupported(const std::string& key_system,
return media_drm_bridge->SetSecurityLevel(security_level);
}
-//static
+// static
void MediaDrmBridge::AddKeySystemUuidMapping(const std::string& key_system,
const std::vector<uint8>& uuid) {
g_key_system_uuid_manager.Get().AddMapping(key_system, uuid);
}
// static
+std::vector<std::string> MediaDrmBridge::GetPlatformKeySystemNames() {
+ return g_key_system_uuid_manager.Get().GetPlatformKeySystemNames();
+}
+
+// static
bool MediaDrmBridge::IsKeySystemSupported(const std::string& key_system) {
DCHECK(!key_system.empty());
return IsKeySystemSupportedWithTypeImpl(key_system, "");
diff --git a/media/base/android/media_drm_bridge.h b/media/base/android/media_drm_bridge.h
index a7a28bd..8c33a33 100644
--- a/media/base/android/media_drm_bridge.h
+++ b/media/base/android/media_drm_bridge.h
@@ -48,6 +48,10 @@ class MEDIA_EXPORT MediaDrmBridge : public BrowserCdm {
// Checks whether |key_system| is supported.
static bool IsKeySystemSupported(const std::string& key_system);
+ // Returns the list of the platform-supported key system names that
+ // are not handled by Chrome explicitly.
+ static std::vector<std::string> GetPlatformKeySystemNames();
+
// Adds a new |key_system| with the associated |uuid|.
// This is used for other platforms to have a chance to register their
// own UUID mapping.