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

Unified Diff: chrome/browser/media/encrypted_media_message_filter_android.cc

Issue 230843004: Reland r262568 "Encrypted Media: Check container mime type in MediaDrmBridge". (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « no previous file | chrome/renderer/media/chrome_key_systems.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/encrypted_media_message_filter_android.cc
diff --git a/chrome/browser/media/encrypted_media_message_filter_android.cc b/chrome/browser/media/encrypted_media_message_filter_android.cc
index bca0225d1da64f436a793086d5bd6ef8d0ce7342..2048fa8470c1b1a166f5ac53c9569dc25565e0cd 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
« no previous file with comments | « no previous file | chrome/renderer/media/chrome_key_systems.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698