Chromium Code Reviews| 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..6298bd5d7545f3bfae88839098be649fc9888ba4 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/widevine_cdm_constants.h" |
| +#include "content/public/renderer/render_thread.h" |
| #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. |
| @@ -15,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"; |
| @@ -41,15 +47,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 |
| #if defined(WIDEVINE_CDM_MIN_GLIBC_VERSION) |
| Version glibc_version(gnu_get_libc_version()); |
| @@ -104,13 +111,38 @@ static void AddPepperBasedWidevine( |
| AddWidevineWithCodecs(supported_codecs, concrete_key_systems); |
| } |
| #elif defined(OS_ANDROID) |
| + |
| +#define COMPILE_ASSERT_MATCHING_ENUM(name) \ |
|
ddorwin
2013/09/18 03:58:31
Maybe put this up at line 51 so it's near the enum
qinmin
2013/09/18 05:08:21
Done.
|
| + 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 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)); |
| + // TODO(qinmin): Use different key system types for compositing and |
| + // non-compositing codecs. Need to ignore the extra bit masks defined in |
|
ddorwin
2013/09/18 03:58:31
What extra bit masks?
qinmin
2013/09/18 05:08:21
The COMPILER_ASSERT only catches the 3 known enums
ddorwin
2013/09/18 05:19:54
You could do a runtime check on the results:
DCHEC
qinmin
2013/09/18 17:51:37
seems I missed it, a DCHECK is added here and in t
|
| + // 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) |