diff options
author | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-09 21:46:47 +0000 |
---|---|---|
committer | xhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-09 21:46:47 +0000 |
commit | b1809d2598c2fc3eb7641275c7d9d717d3c020c4 (patch) | |
tree | d8968f96b7194b4f4ee7b5ba28d411c4954d11f3 /chrome | |
parent | 5c5ce98f558310dec2d54fa25112bb1d5902dc2a (diff) | |
download | chromium_src-b1809d2598c2fc3eb7641275c7d9d717d3c020c4.zip chromium_src-b1809d2598c2fc3eb7641275c7d9d717d3c020c4.tar.gz chromium_src-b1809d2598c2fc3eb7641275c7d9d717d3c020c4.tar.bz2 |
Reland r262568 "Encrypted Media: Check container mime type in MediaDrmBridge".
This CL relands r262568 with NO additional changes. The original CL was reverted to help investigate some test failure, which turned out to be unrelated to this CL.
Android MediaDrm API supports container mime type check in
isCryptoSchemeSupported (UUID uuid, String mimeType):
http://developer.android.com/reference/android/media/MediaDrm.html#isCryptoSchemeSupported(java.util.UUID, java.lang.String)
This CL hook this API up in MediaDrmBridge.
Also, Chromium will always query the codec/container type it
is interested in (e.g. MP4 and WebM).
TBR=ddorwin@chromium.org,qinmin@chromium.org,dmazzoni@chromium.org
BUG=350481
Review URL: https://codereview.chromium.org/230843004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262828 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/media/encrypted_media_message_filter_android.cc | 28 | ||||
-rw-r--r-- | chrome/renderer/media/chrome_key_systems.cc | 4 |
2 files changed, 18 insertions, 14 deletions
diff --git a/chrome/browser/media/encrypted_media_message_filter_android.cc b/chrome/browser/media/encrypted_media_message_filter_android.cc index bca0225..2048fa8 100644 --- a/chrome/browser/media/encrypted_media_message_filter_android.cc +++ b/chrome/browser/media/encrypted_media_message_filter_android.cc @@ -21,15 +21,22 @@ const size_t kMaxKeySystemLength = 256; // Check whether the available codecs are supported. static android::SupportedCodecs GetSupportedCodecs( - android::SupportedCodecs requested_codecs, + const SupportedKeySystemRequest& request, bool video_must_be_compositable) { + const std::string& key_system = request.key_system; android::SupportedCodecs supported_codecs = android::NO_SUPPORTED_CODECS; - // TODO(qinmin): Remove this DCHECK and query VP8/Vorbis capabilities - // once webm support is added to Android. - DCHECK(!(requested_codecs & android::WEBM_VP8_AND_VORBIS)); + + if ((request.codecs & android::WEBM_VP8_AND_VORBIS) && + MediaDrmBridge::IsKeySystemSupportedWithType(key_system, "video/webm") && + MediaCodecBridge::CanDecode("vp8", !video_must_be_compositable) && + MediaCodecBridge::CanDecode("vorbis", false)) { + supported_codecs = static_cast<android::SupportedCodecs>( + supported_codecs | android::WEBM_VP8_AND_VORBIS); + } #if defined(USE_PROPRIETARY_CODECS) - if ((requested_codecs & android::MP4_AAC) && + if ((request.codecs & android::MP4_AAC) && + MediaDrmBridge::IsKeySystemSupportedWithType(key_system, "video/mp4") && MediaCodecBridge::CanDecode("mp4a", false)) { supported_codecs = static_cast<android::SupportedCodecs>( supported_codecs | android::MP4_AAC); @@ -37,7 +44,8 @@ static android::SupportedCodecs GetSupportedCodecs( // TODO(qinmin): Remove the composition logic when secure contents can be // composited. - if ((requested_codecs & android::MP4_AVC1) && + if ((request.codecs & android::MP4_AVC1) && + MediaDrmBridge::IsKeySystemSupportedWithType(key_system, "video/mp4") && MediaCodecBridge::CanDecode("avc1", !video_must_be_compositable)) { supported_codecs = static_cast<android::SupportedCodecs>( supported_codecs | android::MP4_AVC1); @@ -84,16 +92,14 @@ void EncryptedMediaMessageFilterAndroid::OnGetSupportedKeySystems( return; } - // TODO(qinmin): Convert codecs to container types and check whether they - // are supported with the key system. - if (!MediaDrmBridge::IsKeySystemSupportedWithType(request.key_system, "")) + if (!MediaDrmBridge::IsKeySystemSupported(request.key_system)) return; DCHECK_EQ(request.codecs >> 3, 0) << "unrecognized codec"; response->key_system = request.key_system; // TODO(qinmin): check composition is supported or not. - response->compositing_codecs = GetSupportedCodecs(request.codecs, true); - response->non_compositing_codecs = GetSupportedCodecs(request.codecs, false); + response->compositing_codecs = GetSupportedCodecs(request, true); + response->non_compositing_codecs = GetSupportedCodecs(request, false); } } // namespace chrome diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc index d0a9b58..276c63c 100644 --- a/chrome/renderer/media/chrome_key_systems.cc +++ b/chrome/renderer/media/chrome_key_systems.cc @@ -292,10 +292,8 @@ static void AddAndroidWidevine( SupportedKeySystemResponse response; request.key_system = kWidevineKeySystem; -#if defined(USE_PROPRIETARY_CODECS) request.codecs = static_cast<android::SupportedCodecs>( - android::MP4_AAC | android::MP4_AVC1); -#endif // defined(USE_PROPRIETARY_CODECS) + android::WEBM_VP8_AND_VORBIS | android::MP4_AAC | android::MP4_AVC1); content::RenderThread::Get()->Send( new ChromeViewHostMsg_GetSupportedKeySystems(request, &response)); DCHECK_EQ(response.compositing_codecs >> 3, 0) << "unrecognized codec"; |