diff options
author | sandersd <sandersd@chromium.org> | 2015-05-14 21:21:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-15 04:22:14 +0000 |
commit | d7411976f6467bf4519f66f32b4459717e7352d7 (patch) | |
tree | c7d1fc7a2e2254e20c9f9af1695a0c77fba552d0 /media/blink/key_system_config_selector.cc | |
parent | 55c065b684f16cee1c73e7ef803764f22a4fb281 (diff) | |
download | chromium_src-d7411976f6467bf4519f66f32b4459717e7352d7.zip chromium_src-d7411976f6467bf4519f66f32b4459717e7352d7.tar.gz chromium_src-d7411976f6467bf4519f66f32b4459717e7352d7.tar.bz2 |
Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid.
This completes the path from the secure surface preference, through requestMediaKeySystemAccess() and finally to CDM creation on Android where secure codecs are enabled. With this change, configs requiring secure codes are rejected without the preference and the CDM is only configures to use hardware-secure codecs if the config requires it.
There is a separate bug (http://crbug.com/478185) for implementing similar plumbing for the use of secure surfaces.
BUG=467779
Committed: https://crrev.com/9ce0a551c7f1d79dea793b5691473ef9d5fb9326
Cr-Commit-Position: refs/heads/master@{#330008}
Review URL: https://codereview.chromium.org/1131753003
Cr-Commit-Position: refs/heads/master@{#330040}
Diffstat (limited to 'media/blink/key_system_config_selector.cc')
-rw-r--r-- | media/blink/key_system_config_selector.cc | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc index f34bd8f..24cbf9f 100644 --- a/media/blink/key_system_config_selector.cc +++ b/media/blink/key_system_config_selector.cc @@ -8,6 +8,7 @@ #include "base/logging.h" #include "base/strings/string_util.h" #include "base/strings/utf_string_conversions.h" +#include "media/base/cdm_config.h" #include "media/base/key_systems.h" #include "media/base/media_permission.h" #include "media/blink/webmediaplayer_util.h" @@ -131,8 +132,8 @@ struct KeySystemConfigSelector::SelectionRequest { blink::WebVector<blink::WebMediaKeySystemConfiguration> candidate_configurations; blink::WebSecurityOrigin security_origin; - base::Callback<void(const blink::WebMediaKeySystemConfiguration&, bool)> - succeeded_cb; + base::Callback<void(const blink::WebMediaKeySystemConfiguration&, + const CdmConfig&)> succeeded_cb; base::Callback<void(const blink::WebString&)> not_supported_cb; bool was_permission_requested = false; bool is_permission_granted = false; @@ -158,8 +159,8 @@ class KeySystemConfigSelector::ConfigState { bool IsIdentifierRecommended() const { return is_identifier_recommended_; } - bool AreSecureCodecsRequired() const { - return are_secure_codecs_required_; + bool AreHwSecureCodecsRequired() const { + return are_hw_secure_codecs_required_; } // Checks whether a rule is compatible with all previously added rules. @@ -182,10 +183,10 @@ class KeySystemConfigSelector::ConfigState { case EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED: return (!is_identifier_not_allowed_ && IsPermissionPossible() && !is_persistence_not_allowed_); - case EmeConfigRule::SECURE_CODECS_NOT_ALLOWED: - return !are_secure_codecs_required_; - case EmeConfigRule::SECURE_CODECS_REQUIRED: - return !are_secure_codecs_not_allowed_; + case EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED: + return !are_hw_secure_codecs_required_; + case EmeConfigRule::HW_SECURE_CODECS_REQUIRED: + return !are_hw_secure_codecs_not_allowed_; case EmeConfigRule::SUPPORTED: return true; } @@ -219,11 +220,11 @@ class KeySystemConfigSelector::ConfigState { is_identifier_required_ = true; is_persistence_required_ = true; return; - case EmeConfigRule::SECURE_CODECS_NOT_ALLOWED: - are_secure_codecs_not_allowed_ = true; + case EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED: + are_hw_secure_codecs_not_allowed_ = true; return; - case EmeConfigRule::SECURE_CODECS_REQUIRED: - are_secure_codecs_required_ = true; + case EmeConfigRule::HW_SECURE_CODECS_REQUIRED: + are_hw_secure_codecs_required_ = true; return; case EmeConfigRule::SUPPORTED: return; @@ -255,8 +256,8 @@ class KeySystemConfigSelector::ConfigState { // Whether a rule has been added that requires or blocks hardware-secure // codecs. - bool are_secure_codecs_required_ = false; - bool are_secure_codecs_not_allowed_ = false; + bool are_hw_secure_codecs_required_ = false; + bool are_hw_secure_codecs_not_allowed_ = false; }; KeySystemConfigSelector::KeySystemConfigSelector( @@ -673,8 +674,8 @@ void KeySystemConfigSelector::SelectConfig( candidate_configurations, const blink::WebSecurityOrigin& security_origin, bool are_secure_codecs_supported, - base::Callback<void(const blink::WebMediaKeySystemConfiguration&, bool)> - succeeded_cb, + base::Callback<void(const blink::WebMediaKeySystemConfiguration&, + const CdmConfig&)> succeeded_cb, base::Callback<void(const blink::WebString&)> not_supported_cb) { // Continued from requestMediaKeySystemAccess(), step 7, from // https://w3c.github.io/encrypted-media/#requestmediakeysystemaccess @@ -723,10 +724,11 @@ void KeySystemConfigSelector::SelectConfigInternal( ConfigState config_state(request->was_permission_requested, request->is_permission_granted); DCHECK(config_state.IsRuleSupported( - EmeConfigRule::SECURE_CODECS_NOT_ALLOWED)); + EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED)); if (!request->are_secure_codecs_supported) - config_state.AddRule(EmeConfigRule::SECURE_CODECS_NOT_ALLOWED); + config_state.AddRule(EmeConfigRule::HW_SECURE_CODECS_NOT_ALLOWED); blink::WebMediaKeySystemConfiguration accumulated_configuration; + CdmConfig cdm_config; ConfigurationSupport support = GetSupportedConfiguration( request->key_system, request->candidate_configurations[i], &config_state, &accumulated_configuration); @@ -746,8 +748,15 @@ void KeySystemConfigSelector::SelectConfigInternal( weak_factory_.GetWeakPtr(), base::Passed(&request))); return; case CONFIGURATION_SUPPORTED: - request->succeeded_cb.Run(accumulated_configuration, - config_state.AreSecureCodecsRequired()); + cdm_config.allow_distinctive_identifier = + (accumulated_configuration.distinctiveIdentifier == + blink::WebMediaKeySystemConfiguration::Requirement::Required); + cdm_config.allow_persistent_state = + (accumulated_configuration.persistentState == + blink::WebMediaKeySystemConfiguration::Requirement::Required); + cdm_config.use_hw_secure_codecs = + config_state.AreHwSecureCodecsRequired(); + request->succeeded_cb.Run(accumulated_configuration, cdm_config); return; } } |