summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 00:19:12 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-09 00:19:12 +0000
commitf6824cadc9cd083edd146120622e8e6184d105ef (patch)
treee76c052d9b45f21a056088eab79aa3f7c46ef9c7 /chrome
parent694ffab8fbe7a05c10d694a109fc430cfc3ba472 (diff)
downloadchromium_src-f6824cadc9cd083edd146120622e8e6184d105ef.zip
chromium_src-f6824cadc9cd083edd146120622e8e6184d105ef.tar.gz
chromium_src-f6824cadc9cd083edd146120622e8e6184d105ef.tar.bz2
Encrypted Media: Check container mime type in MediaDrmBridge.
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). BUG=350481 Review URL: https://codereview.chromium.org/229203002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@262568 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/media/encrypted_media_message_filter_android.cc28
-rw-r--r--chrome/renderer/media/chrome_key_systems.cc4
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";