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

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: rebase 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..bdd10f98005c2461f02ad3d26199cacc5d32a060 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,16 @@ enum SupportedCodecs {
#endif // defined(USE_PROPRIETARY_CODECS)
};
+#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
+
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);
@@ -163,13 +168,38 @@ static void AddPepperBasedWidevine(
AddWidevineWithCodecs(supported_codecs, concrete_key_systems);
}
#elif 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
xhwang 2013/09/18 07:10:57 So there's no way to only define those enum in one
qinmin 2013/09/18 17:19:59 Ya, i agree this is not satisfactory. We have thes
+
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)
+ request.requested_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));
xhwang 2013/09/18 07:10:57 fit in one line?
qinmin 2013/09/18 17:19:59 Done.
+ // TODO(qinmin): Use different key system types for compositing and
+ // non-compositing codecs. Need to ignore the extra bit masks defined in
+ // android if that happens.
SupportedCodecs supported_codecs =
- static_cast<SupportedCodecs>(MP4_AAC | MP4_AVC1);
+ static_cast<SupportedCodecs>(
+ response.compositing_codecs | response.non_compositing_codecs);
AddWidevineWithCodecs(supported_codecs, concrete_key_systems);
-#endif // defined(USE_PROPRIETARY_CODECS)
}
#endif // defined(ENABLE_PEPPER_CDMS)
#endif // defined(WIDEVINE_CDM_AVAILABLE)

Powered by Google App Engine
This is Rietveld 408576698