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

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

Issue 23513055: Populate canPlayType to renderer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add dcheck 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
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 e8b5058e8c84c0e9a60cdc8fc91d6bd991ccb211..d5da3e63a11a7b9944c90c3d489d72366fa60ef5 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -17,6 +17,10 @@
#include "base/version.h"
#endif
+#if defined(OS_ANDROID)
+#include "chrome/common/encrypted_media_messages_android.h"
+#endif
+
using content::KeySystemInfo;
static const char kClearKeyKeySystem[] = "webkit-org.w3.clearkey";
@@ -95,15 +99,25 @@ enum SupportedCodecs {
#endif // defined(USE_PROPRIETARY_CODECS)
};
+#if defined(OS_ANDROID)
+#define COMPILE_ASSERT_MATCHING_ENUM(name) \
+ COMPILE_ASSERT(static_cast<int>(name) == \
+ static_cast<int>(android::name), \
+ mismatching_enums)
+COMPILE_ASSERT_MATCHING_ENUM(WEBM_VP8_AND_VORBIS);
+COMPILE_ASSERT_MATCHING_ENUM(MP4_AAC);
+COMPILE_ASSERT_MATCHING_ENUM(MP4_AVC1);
+#undef COMPILE_ASSERT_MATCHING_ENUM
+
+static const uint8 kWidevineUuid[16] = {
+ 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
+ 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
+#endif
+
static void AddWidevineWithCodecs(
SupportedCodecs supported_codecs,
std::vector<KeySystemInfo>* concrete_key_systems) {
static const char kWidevineParentKeySystem[] = "com.widevine";
-#if defined(OS_ANDROID)
- static const uint8 kWidevineUuid[16] = {
- 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE,
- 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED };
-#endif
KeySystemInfo info(kWidevineKeySystem);
@@ -165,11 +179,23 @@ static void AddPepperBasedWidevine(
#elif defined(OS_ANDROID)
static void AddAndroidWidevine(
std::vector<KeySystemInfo>* concrete_key_systems) {
+ android::SupportedKeySystemRequest request;
+ android::SupportedKeySystemResponse response;
+
+ request.uuid.insert(request.uuid.begin(), kWidevineUuid,
+ kWidevineUuid + arraysize(kWidevineUuid));
#if defined(USE_PROPRIETARY_CODECS)
- SupportedCodecs supported_codecs =
- static_cast<SupportedCodecs>(MP4_AAC | MP4_AVC1);
- AddWidevineWithCodecs(supported_codecs, concrete_key_systems);
+ request.codecs = static_cast<android::SupportedCodecs>(
+ android::MP4_AAC | android::MP4_AVC1);
#endif // defined(USE_PROPRIETARY_CODECS)
+ content::RenderThread::Get()->Send(
+ new ChromeViewHostMsg_GetSupportedKeySystems(request, &response));
+ // TODO(qinmin): Use different key system types for compositing and
+ // non-compositing codecs.
+ SupportedCodecs supported_codecs = static_cast<SupportedCodecs>(
+ response.compositing_codecs | response.non_compositing_codecs);
+ DCHECK_EQ(supported_codecs >> 3, 0);
ddorwin 2013/09/18 18:13:02 Add something like: << "unrecognized codec";
qinmin 2013/09/18 18:52:20 Done.
+ AddWidevineWithCodecs(supported_codecs, concrete_key_systems);
}
#endif // defined(ENABLE_PEPPER_CDMS)
#endif // defined(WIDEVINE_CDM_AVAILABLE)

Powered by Google App Engine
This is Rietveld 408576698