summaryrefslogtreecommitdiffstats
path: root/media/blink/key_system_config_selector.cc
diff options
context:
space:
mode:
authorddorwin <ddorwin@chromium.org>2016-03-02 21:06:29 -0800
committerCommit bot <commit-bot@chromium.org>2016-03-03 05:07:51 +0000
commitf1f20728a18fff332af52c0e60726a8b34510ba6 (patch)
treef4c5b710675a1a3787b404cd2a31a7d7b7532067 /media/blink/key_system_config_selector.cc
parentfee5771921b6f93f36a3b102c30b3711db8b7b5b (diff)
downloadchromium_src-f1f20728a18fff332af52c0e60726a8b34510ba6.zip
chromium_src-f1f20728a18fff332af52c0e60726a8b34510ba6.tar.gz
chromium_src-f1f20728a18fff332af52c0e60726a8b34510ba6.tar.bz2
EME on Android: Improve accuracy of Key System availability.
Implemented per https://crbug.com/582618#c7. BUG=559236,582618 Review URL: https://codereview.chromium.org/1747073003 Cr-Commit-Position: refs/heads/master@{#378959}
Diffstat (limited to 'media/blink/key_system_config_selector.cc')
-rw-r--r--media/blink/key_system_config_selector.cc27
1 files changed, 17 insertions, 10 deletions
diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc
index 766feda..885049c 100644
--- a/media/blink/key_system_config_selector.cc
+++ b/media/blink/key_system_config_selector.cc
@@ -277,20 +277,25 @@ KeySystemConfigSelector::KeySystemConfigSelector(
KeySystemConfigSelector::~KeySystemConfigSelector() {
}
-bool IsSupportedClearMediaFormat(const std::string& container_mime_type,
- const std::string& codecs) {
+bool IsSupportedMediaFormat(const std::string& container_mime_type,
+ const std::string& codecs,
+ bool use_aes_decryptor) {
std::vector<std::string> codec_vector;
- media::ParseCodecString(codecs, &codec_vector, false);
- media::SupportsType support_result =
- media::IsSupportedEncryptedMediaFormat(container_mime_type, codec_vector);
+ ParseCodecString(codecs, &codec_vector, false);
+ // AesDecryptor decrypts the stream in the demuxer before it reaches the
+ // decoder so check whether the media format is supported when clear.
+ SupportsType support_result =
+ use_aes_decryptor
+ ? IsSupportedMediaFormat(container_mime_type, codec_vector)
+ : IsSupportedEncryptedMediaFormat(container_mime_type, codec_vector);
switch (support_result) {
- case media::IsSupported:
+ case IsSupported:
return true;
- case media::MayBeSupported:
+ case MayBeSupported:
// If no codecs were specified, the best possible result is
// MayBeSupported, indicating support for the container.
return codec_vector.empty();
- case media::IsNotSupported:
+ case IsNotSupported:
return false;
}
NOTREACHED();
@@ -309,8 +314,10 @@ bool KeySystemConfigSelector::IsSupportedContentType(
// is done primarily to validate extended codecs, but it also ensures that the
// CDM cannot support codecs that Chrome does not (which could complicate the
// robustness algorithm).
- if (!IsSupportedClearMediaFormat(container_mime_type, codecs))
+ if (!IsSupportedMediaFormat(container_mime_type, codecs,
+ CanUseAesDecryptor(key_system))) {
return false;
+ }
// TODO(servolk): Converting |container_mime_type| to lower-case could be
// moved to KeySystemsImpl::GetContentTypeConfigRule, plus we could add some
@@ -321,7 +328,7 @@ bool KeySystemConfigSelector::IsSupportedContentType(
// This check does not handle extended codecs, so extended codec information
// is stripped (extended codec information was checked above).
std::vector<std::string> stripped_codec_vector;
- media::ParseCodecString(codecs, &stripped_codec_vector, true);
+ ParseCodecString(codecs, &stripped_codec_vector, true);
EmeConfigRule codecs_rule = key_systems_->GetContentTypeConfigRule(
key_system, media_type, container_lower, stripped_codec_vector);
if (!config_state->IsRuleSupported(codecs_rule))