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 1fa26eb2ec5f0249e7ca656f9f8d1fcbe2ee1066..9c5dba1e71b32b42d9c2e01b7f8b4cdf9c7df77b 100644 |
| --- a/chrome/renderer/media/chrome_key_systems.cc |
| +++ b/chrome/renderer/media/chrome_key_systems.cc |
| @@ -19,6 +19,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"; |
| @@ -100,13 +104,16 @@ enum SupportedCodecs { |
| enum WidevineCdmType { |
| WIDEVINE, |
| WIDEVINE_HR, |
| + WIDEVINE_HRSURFACE, |
| }; |
| +#if !defined(OS_ANDROID) |
| static bool IsWidevineHrSupported() { |
| // TODO(jrummell): Need to call CheckPlatformState() but it is |
| // asynchronous, and needs to be done in the browser. |
| return false; |
| } |
| +#endif |
| // Return |name|'s parent key system. |
| static std::string GetDirectParentName(std::string name) { |
| @@ -115,6 +122,21 @@ static std::string GetDirectParentName(std::string name) { |
| return name.substr(0, last_period); |
| } |
| +#if defined(OS_ANDROID) |
|
ddorwin
2013/09/18 23:48:07
These should be up with the enum after the rebase.
qinmin
2013/09/19 00:02:55
Done.
|
| +#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( |
| WidevineCdmType widevine_cdm_type, |
| SupportedCodecs supported_codecs, |
| @@ -130,6 +152,9 @@ static void AddWidevineWithCodecs( |
| case WIDEVINE_HR: |
| info.key_system.append(".hr"); |
| break; |
| + case WIDEVINE_HRSURFACE: |
| + info.key_system.append(".hrsurface"); |
| + break; |
| default: |
| NOTREACHED(); |
| } |
| @@ -152,9 +177,6 @@ static void AddWidevineWithCodecs( |
| #if defined(ENABLE_PEPPER_CDMS) |
| info.pepper_type = kWidevineCdmPluginMimeType; |
| #elif defined(OS_ANDROID) |
| - static const uint8 kWidevineUuid[16] = { |
| - 0xED, 0xEF, 0x8B, 0xA9, 0x79, 0xD6, 0x4A, 0xCE, |
| - 0xA3, 0xC8, 0x27, 0xDC, 0xD5, 0x1D, 0x21, 0xED }; |
| info.uuid.assign(kWidevineUuid, kWidevineUuid + arraysize(kWidevineUuid)); |
| #endif // defined(ENABLE_PEPPER_CDMS) |
| @@ -196,14 +218,28 @@ static void AddPepperBasedWidevine( |
| #elif defined(OS_ANDROID) |
| static void AddAndroidWidevine( |
| std::vector<KeySystemInfo>* concrete_key_systems) { |
| -#if defined(USE_PROPRIETARY_CODECS) |
| - SupportedCodecs supported_codecs = |
| - static_cast<SupportedCodecs>(MP4_AAC | MP4_AVC1); |
| - AddWidevineWithCodecs(WIDEVINE, supported_codecs, concrete_key_systems); |
| + android::SupportedKeySystemRequest request; |
| + android::SupportedKeySystemResponse response; |
| - if (IsWidevineHrSupported()) |
| - AddWidevineWithCodecs(WIDEVINE_HR, supported_codecs, concrete_key_systems); |
| + request.uuid.insert(request.uuid.begin(), kWidevineUuid, |
| + kWidevineUuid + arraysize(kWidevineUuid)); |
| +#if defined(USE_PROPRIETARY_CODECS) |
| + 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)); |
| + DCHECK_EQ(response.compositing_codecs >> 3, 0) << "unrecognized codec"; |
| + DCHECK_EQ(response.non_compositing_codecs >> 3, 0) << "unrecognized codec"; |
| + AddWidevineWithCodecs( |
|
ddorwin
2013/09/18 23:48:07
might not matter in practice, but we should only a
qinmin
2013/09/19 00:02:55
Added a if statement here to check if the returned
|
| + WIDEVINE, |
| + static_cast<SupportedCodecs>(response.compositing_codecs), |
| + concrete_key_systems); |
| + |
| + AddWidevineWithCodecs( |
| + WIDEVINE_HRSURFACE, |
| + static_cast<SupportedCodecs>(response.non_compositing_codecs), |
| + concrete_key_systems); |
| } |
| #endif // defined(ENABLE_PEPPER_CDMS) |
| #endif // defined(WIDEVINE_CDM_AVAILABLE) |