summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjrummell <jrummell@chromium.org>2015-04-21 15:28:34 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-21 22:28:58 +0000
commit01db4c8321aee76ce432561ef492fecb833a6363 (patch)
tree5932b9fbd192f4ac093a071de9e3e63bdca90700
parent0044897feca3e12b01ea0f50939b5a5eb33c6046 (diff)
downloadchromium_src-01db4c8321aee76ce432561ef492fecb833a6363.zip
chromium_src-01db4c8321aee76ce432561ef492fecb833a6363.tar.gz
chromium_src-01db4c8321aee76ce432561ef492fecb833a6363.tar.bz2
Change enums in eme_constants.h to enum classes
BUG=473830 TEST=media_unittests pass Review URL: https://codereview.chromium.org/1093253002 Cr-Commit-Position: refs/heads/master@{#326147}
-rw-r--r--chrome/renderer/media/chrome_key_systems.cc36
-rw-r--r--chromecast/renderer/key_systems_cast.cc27
-rw-r--r--components/cdm/renderer/android_key_systems.cc45
-rw-r--r--content/renderer/media/render_media_client_unittest.cc16
-rw-r--r--media/base/eme_constants.h27
-rw-r--r--media/base/key_system_info.cc8
-rw-r--r--media/base/key_systems.cc48
-rw-r--r--media/base/key_systems_unittest.cc17
-rw-r--r--media/blink/key_system_config_selector.cc98
-rw-r--r--media/blink/key_system_config_selector_unittest.cc48
10 files changed, 184 insertions, 186 deletions
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index 63d4734..7f4c8362 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -87,11 +87,11 @@ static void AddExternalClearKey(
info.max_video_robustness = media::EmeRobustness::EMPTY;
// Persistent sessions are faked.
- info.persistent_license_support = media::EME_SESSION_TYPE_SUPPORTED;
+ info.persistent_license_support = media::EmeSessionTypeSupport::SUPPORTED;
info.persistent_release_message_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_state_support = media::EME_FEATURE_REQUESTABLE;
- info.distinctive_identifier_support = media::EME_FEATURE_NOT_SUPPORTED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_state_support = media::EmeFeatureSupport::REQUESTABLE;
+ info.distinctive_identifier_support = media::EmeFeatureSupport::NOT_SUPPORTED;
info.pepper_type = kExternalClearKeyPepperType;
@@ -193,20 +193,22 @@ static void AddPepperBasedWidevine(
cdm::AddWidevineWithCodecs(
cdm::WIDEVINE, supported_codecs,
#if defined(OS_CHROMEOS)
- media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness.
- media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness.
- // persistent-license.
- media::EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER,
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
- media::EME_FEATURE_REQUESTABLE, // Persistent state.
- media::EME_FEATURE_REQUESTABLE, // Distinctive identifier.
+ media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness.
+ media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness.
+ media::EmeSessionTypeSupport::
+ SUPPORTED_WITH_IDENTIFIER, // Persistent-license.
+ media::EmeSessionTypeSupport::
+ NOT_SUPPORTED, // Persistent-release-message.
+ media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
+ media::EmeFeatureSupport::REQUESTABLE, // Distinctive identifier.
#else // (Desktop)
- media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
- media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
- media::EME_FEATURE_REQUESTABLE, // Persistent state.
- media::EME_FEATURE_NOT_SUPPORTED, // Distinctive identifier.
+ media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
+ media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness.
+ media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
+ media::EmeSessionTypeSupport::
+ NOT_SUPPORTED, // persistent-release-message.
+ media::EmeFeatureSupport::REQUESTABLE, // Persistent state.
+ media::EmeFeatureSupport::NOT_SUPPORTED, // Distinctive identifier.
#endif // defined(OS_CHROMEOS)
concrete_key_systems);
}
diff --git a/chromecast/renderer/key_systems_cast.cc b/chromecast/renderer/key_systems_cast.cc
index 5d3ad1c..c9cae76 100644
--- a/chromecast/renderer/key_systems_cast.cc
+++ b/chromecast/renderer/key_systems_cast.cc
@@ -27,11 +27,13 @@ void AddKeySystemWithCodecs(
::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1;
info.max_audio_robustness = ::media::EmeRobustness::EMPTY;
info.max_video_robustness = ::media::EmeRobustness::EMPTY;
- info.persistent_license_support = ::media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ info.persistent_license_support =
+ ::media::EmeSessionTypeSupport::NOT_SUPPORTED;
info.persistent_release_message_support =
- ::media::EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_state_support = ::media::EME_FEATURE_ALWAYS_ENABLED;
- info.distinctive_identifier_support = ::media::EME_FEATURE_ALWAYS_ENABLED;
+ ::media::EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_state_support = ::media::EmeFeatureSupport::ALWAYS_ENABLED;
+ info.distinctive_identifier_support =
+ ::media::EmeFeatureSupport::ALWAYS_ENABLED;
key_systems_info->push_back(info);
}
@@ -39,15 +41,16 @@ void AddChromecastKeySystems(
std::vector<::media::KeySystemInfo>* key_systems_info) {
#if defined(WIDEVINE_CDM_AVAILABLE)
AddWidevineWithCodecs(
- cdm::WIDEVINE,
- ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1,
- ::media::EmeRobustness::HW_SECURE_ALL, // Max audio robustness.
- ::media::EmeRobustness::HW_SECURE_ALL, // Max video robustness.
- ::media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
- ::media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
+ cdm::WIDEVINE, ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1,
+ ::media::EmeRobustness::HW_SECURE_ALL, // Max audio robustness.
+ ::media::EmeRobustness::HW_SECURE_ALL, // Max video robustness.
+ ::media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
+ ::media::EmeSessionTypeSupport::
+ NOT_SUPPORTED, // persistent-release-message.
// Note: On Chromecast, all CDMs may have persistent state.
- ::media::EME_FEATURE_ALWAYS_ENABLED, // Persistent state.
- ::media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
+ ::media::EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state.
+ ::media::EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive
+ // identifier.
key_systems_info);
#endif
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc
index 8076a2a..28b45eb 100644
--- a/components/cdm/renderer/android_key_systems.cc
+++ b/components/cdm/renderer/android_key_systems.cc
@@ -62,18 +62,18 @@ void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems,
// We are using MediaDrm API on Android and we cannot guarantee that API
// doesn't use persistent storage on the device. Therefore always set
- // persistent state to EME_FEATURE_ALWAYS_ENABLED to err on the safe side.
+ // persistent state to EmeFeatureSupport::ALWAYS_ENABLED to err on the
+ // safe side.
if (codecs != media::EME_CODEC_NONE) {
AddWidevineWithCodecs(
- WIDEVINE,
- codecs,
- max_audio_robustness,
- max_video_robustness,
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
- media::EME_FEATURE_ALWAYS_ENABLED, // Persistent state.
- media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
+ WIDEVINE, codecs, max_audio_robustness, max_video_robustness,
+ media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
+ media::EmeSessionTypeSupport::
+ NOT_SUPPORTED, // persistent-release-message.
+ media::EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state.
+ media::EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive
+ // identifier.
concrete_key_systems);
}
@@ -84,14 +84,15 @@ void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems,
// TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976
if (response.non_compositing_codecs != media::EME_CODEC_NONE) {
AddWidevineWithCodecs(
- WIDEVINE_HR_NON_COMPOSITING,
- response.non_compositing_codecs,
- EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness.
- EmeRobustness::HW_SECURE_ALL, // Max video robustness.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
- media::EME_FEATURE_ALWAYS_ENABLED, // Persistent state.
- media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
+ WIDEVINE_HR_NON_COMPOSITING, response.non_compositing_codecs,
+ EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness.
+ EmeRobustness::HW_SECURE_ALL, // Max video robustness.
+ media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent-license.
+ media::EmeSessionTypeSupport::
+ NOT_SUPPORTED, // persistent-release-message.
+ media::EmeFeatureSupport::ALWAYS_ENABLED, // Persistent state.
+ media::EmeFeatureSupport::ALWAYS_ENABLED, // Distinctive
+ // identifier.
concrete_key_systems);
}
}
@@ -121,11 +122,13 @@ void AddAndroidPlatformKeySystems(
info.max_audio_robustness = EmeRobustness::EMPTY;
info.max_video_robustness = EmeRobustness::EMPTY;
// Assume the worst case (from a user point of view).
- info.persistent_license_support = media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ info.persistent_license_support =
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
info.persistent_release_message_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_state_support = media::EME_FEATURE_ALWAYS_ENABLED;
- info.distinctive_identifier_support = media::EME_FEATURE_ALWAYS_ENABLED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_state_support = media::EmeFeatureSupport::ALWAYS_ENABLED;
+ info.distinctive_identifier_support =
+ media::EmeFeatureSupport::ALWAYS_ENABLED;
concrete_key_systems->push_back(info);
}
}
diff --git a/content/renderer/media/render_media_client_unittest.cc b/content/renderer/media/render_media_client_unittest.cc
index 7ac253e..f40d0c5 100644
--- a/content/renderer/media/render_media_client_unittest.cc
+++ b/content/renderer/media/render_media_client_unittest.cc
@@ -30,13 +30,13 @@ class TestContentRendererClient : public ContentRendererClient {
key_system_info.max_audio_robustness = media::EmeRobustness::EMPTY;
key_system_info.max_video_robustness = media::EmeRobustness::EMPTY;
key_system_info.persistent_license_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
key_system_info.persistent_release_message_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
key_system_info.persistent_state_support =
- media::EME_FEATURE_NOT_SUPPORTED;
+ media::EmeFeatureSupport::NOT_SUPPORTED;
key_system_info.distinctive_identifier_support =
- media::EME_FEATURE_NOT_SUPPORTED;
+ media::EmeFeatureSupport::NOT_SUPPORTED;
key_systems_info->push_back(key_system_info);
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
if (is_extra_key_system_enabled_) {
@@ -45,13 +45,13 @@ class TestContentRendererClient : public ContentRendererClient {
wv_key_system_info.max_audio_robustness = media::EmeRobustness::EMPTY;
wv_key_system_info.max_video_robustness = media::EmeRobustness::EMPTY;
wv_key_system_info.persistent_license_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
wv_key_system_info.persistent_release_message_support =
- media::EME_SESSION_TYPE_NOT_SUPPORTED;
+ media::EmeSessionTypeSupport::NOT_SUPPORTED;
wv_key_system_info.persistent_state_support =
- media::EME_FEATURE_NOT_SUPPORTED;
+ media::EmeFeatureSupport::NOT_SUPPORTED;
wv_key_system_info.distinctive_identifier_support =
- media::EME_FEATURE_NOT_SUPPORTED;
+ media::EmeFeatureSupport::NOT_SUPPORTED;
key_systems_info->push_back(wv_key_system_info);
}
#endif
diff --git a/media/base/eme_constants.h b/media/base/eme_constants.h
index 8bb3883..0b24670 100644
--- a/media/base/eme_constants.h
+++ b/media/base/eme_constants.h
@@ -58,37 +58,30 @@ enum EmeCodec {
typedef uint32_t SupportedCodecs;
-enum EmeSessionTypeSupport {
+enum class EmeSessionTypeSupport {
// Invalid default value.
- EME_SESSION_TYPE_INVALID,
+ INVALID,
// The session type is not supported.
- EME_SESSION_TYPE_NOT_SUPPORTED,
+ NOT_SUPPORTED,
// The session type is supported if a distinctive identifier is available.
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER,
+ SUPPORTED_WITH_IDENTIFIER,
// The session type is always supported.
- EME_SESSION_TYPE_SUPPORTED,
+ SUPPORTED,
};
// Used to declare support for distinctive identifier and persistent state.
// These are purposefully limited to not allow one to require the other, so that
// transitive requirements are not possible. Non-trivial refactoring would be
// required to support transitive requirements.
-enum EmeFeatureSupport {
+enum class EmeFeatureSupport {
// Invalid default value.
- EME_FEATURE_INVALID,
+ INVALID,
// Access to the feature is not supported at all.
- EME_FEATURE_NOT_SUPPORTED,
+ NOT_SUPPORTED,
// Access to the feature may be requested.
- EME_FEATURE_REQUESTABLE,
+ REQUESTABLE,
// Access to the feature cannot be blocked.
- EME_FEATURE_ALWAYS_ENABLED,
-};
-
-// Used to query support for distinctive identifier and persistent state.
-enum EmeFeatureRequirement {
- EME_FEATURE_NOT_ALLOWED,
- EME_FEATURE_OPTIONAL,
- EME_FEATURE_REQUIRED,
+ ALWAYS_ENABLED,
};
enum class EmeMediaType {
diff --git a/media/base/key_system_info.cc b/media/base/key_system_info.cc
index f5ca112..8eec5b1 100644
--- a/media/base/key_system_info.cc
+++ b/media/base/key_system_info.cc
@@ -11,10 +11,10 @@ KeySystemInfo::KeySystemInfo()
supported_codecs(EME_CODEC_NONE),
max_audio_robustness(EmeRobustness::INVALID),
max_video_robustness(EmeRobustness::INVALID),
- persistent_license_support(EME_SESSION_TYPE_INVALID),
- persistent_release_message_support(EME_SESSION_TYPE_INVALID),
- persistent_state_support(EME_FEATURE_INVALID),
- distinctive_identifier_support(EME_FEATURE_INVALID),
+ persistent_license_support(EmeSessionTypeSupport::INVALID),
+ persistent_release_message_support(EmeSessionTypeSupport::INVALID),
+ persistent_state_support(EmeFeatureSupport::INVALID),
+ distinctive_identifier_support(EmeFeatureSupport::INVALID),
use_aes_decryptor(false) {
}
diff --git a/media/base/key_systems.cc b/media/base/key_systems.cc
index 7bbbde7..f899925 100644
--- a/media/base/key_systems.cc
+++ b/media/base/key_systems.cc
@@ -108,10 +108,11 @@ static void AddClearKey(std::vector<KeySystemInfo>* concrete_key_systems) {
info.max_audio_robustness = EmeRobustness::EMPTY;
info.max_video_robustness = EmeRobustness::EMPTY;
- info.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- info.persistent_state_support = EME_FEATURE_NOT_SUPPORTED;
- info.distinctive_identifier_support = EME_FEATURE_NOT_SUPPORTED;
+ info.persistent_license_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_release_message_support =
+ EmeSessionTypeSupport::NOT_SUPPORTED;
+ info.persistent_state_support = EmeFeatureSupport::NOT_SUPPORTED;
+ info.distinctive_identifier_support = EmeFeatureSupport::NOT_SUPPORTED;
info.use_aes_decryptor = true;
@@ -400,31 +401,34 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems(
DCHECK(!info.key_system.empty());
DCHECK(info.max_audio_robustness != EmeRobustness::INVALID);
DCHECK(info.max_video_robustness != EmeRobustness::INVALID);
- DCHECK(info.persistent_license_support != EME_SESSION_TYPE_INVALID);
- DCHECK(info.persistent_release_message_support != EME_SESSION_TYPE_INVALID);
- DCHECK(info.persistent_state_support != EME_FEATURE_INVALID);
- DCHECK(info.distinctive_identifier_support != EME_FEATURE_INVALID);
+ DCHECK(info.persistent_license_support != EmeSessionTypeSupport::INVALID);
+ DCHECK(info.persistent_release_message_support !=
+ EmeSessionTypeSupport::INVALID);
+ DCHECK(info.persistent_state_support != EmeFeatureSupport::INVALID);
+ DCHECK(info.distinctive_identifier_support != EmeFeatureSupport::INVALID);
// Supporting persistent state is a prerequsite for supporting persistent
// sessions.
- if (info.persistent_state_support == EME_FEATURE_NOT_SUPPORTED) {
- DCHECK(info.persistent_license_support == EME_SESSION_TYPE_NOT_SUPPORTED);
+ if (info.persistent_state_support == EmeFeatureSupport::NOT_SUPPORTED) {
+ DCHECK(info.persistent_license_support ==
+ EmeSessionTypeSupport::NOT_SUPPORTED);
DCHECK(info.persistent_release_message_support ==
- EME_SESSION_TYPE_NOT_SUPPORTED);
+ EmeSessionTypeSupport::NOT_SUPPORTED);
}
// persistent-release-message sessions are not currently supported.
// http://crbug.com/448888
DCHECK(info.persistent_release_message_support ==
- EME_SESSION_TYPE_NOT_SUPPORTED);
+ EmeSessionTypeSupport::NOT_SUPPORTED);
// If distinctive identifiers are not supported, then no other features can
// require them.
- if (info.distinctive_identifier_support == EME_FEATURE_NOT_SUPPORTED) {
+ if (info.distinctive_identifier_support ==
+ EmeFeatureSupport::NOT_SUPPORTED) {
DCHECK(info.persistent_license_support !=
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER);
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER);
DCHECK(info.persistent_release_message_support !=
- EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER);
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER);
}
// Distinctive identifiers and persistent state can only be reliably blocked
@@ -438,8 +442,10 @@ void KeySystemsImpl::AddConcreteSupportedKeySystems(
can_block = true;
#endif
if (!can_block) {
- DCHECK(info.distinctive_identifier_support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(info.persistent_state_support == EME_FEATURE_ALWAYS_ENABLED);
+ DCHECK(info.distinctive_identifier_support ==
+ EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(info.persistent_state_support ==
+ EmeFeatureSupport::ALWAYS_ENABLED);
}
DCHECK(!IsSupportedKeySystem(info.key_system))
@@ -776,7 +782,7 @@ EmeSessionTypeSupport KeySystemsImpl::GetPersistentLicenseSessionSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_SESSION_TYPE_INVALID;
+ return EmeSessionTypeSupport::INVALID;
}
return key_system_iter->second.persistent_license_support;
}
@@ -789,7 +795,7 @@ EmeSessionTypeSupport KeySystemsImpl::GetPersistentReleaseMessageSessionSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_SESSION_TYPE_INVALID;
+ return EmeSessionTypeSupport::INVALID;
}
return key_system_iter->second.persistent_release_message_support;
}
@@ -802,7 +808,7 @@ EmeFeatureSupport KeySystemsImpl::GetPersistentStateSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_FEATURE_INVALID;
+ return EmeFeatureSupport::INVALID;
}
return key_system_iter->second.persistent_state_support;
}
@@ -815,7 +821,7 @@ EmeFeatureSupport KeySystemsImpl::GetDistinctiveIdentifierSupport(
concrete_key_system_map_.find(key_system);
if (key_system_iter == concrete_key_system_map_.end()) {
NOTREACHED();
- return EME_FEATURE_INVALID;
+ return EmeFeatureSupport::INVALID;
}
return key_system_iter->second.distinctive_identifier_support;
}
diff --git a/media/base/key_systems_unittest.cc b/media/base/key_systems_unittest.cc
index b80e6a1..611c2b6 100644
--- a/media/base/key_systems_unittest.cc
+++ b/media/base/key_systems_unittest.cc
@@ -193,10 +193,11 @@ void TestMediaClient::AddUsesAesKeySystem(
system.supported_init_data_types = kInitDataTypeMaskWebM;
system.max_audio_robustness = EmeRobustness::EMPTY;
system.max_video_robustness = EmeRobustness::EMPTY;
- system.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- system.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- system.persistent_state_support = EME_FEATURE_NOT_SUPPORTED;
- system.distinctive_identifier_support = EME_FEATURE_NOT_SUPPORTED;
+ system.persistent_license_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ system.persistent_release_message_support =
+ EmeSessionTypeSupport::NOT_SUPPORTED;
+ system.persistent_state_support = EmeFeatureSupport::NOT_SUPPORTED;
+ system.distinctive_identifier_support = EmeFeatureSupport::NOT_SUPPORTED;
system.use_aes_decryptor = true;
key_systems->push_back(system);
}
@@ -210,10 +211,10 @@ void TestMediaClient::AddExternalKeySystem(
ext.supported_init_data_types = kInitDataTypeMaskWebM;
ext.max_audio_robustness = EmeRobustness::EMPTY;
ext.max_video_robustness = EmeRobustness::EMPTY;
- ext.persistent_license_support = EME_SESSION_TYPE_SUPPORTED;
- ext.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
- ext.persistent_state_support = EME_FEATURE_ALWAYS_ENABLED;
- ext.distinctive_identifier_support = EME_FEATURE_ALWAYS_ENABLED;
+ ext.persistent_license_support = EmeSessionTypeSupport::SUPPORTED;
+ ext.persistent_release_message_support = EmeSessionTypeSupport::NOT_SUPPORTED;
+ ext.persistent_state_support = EmeFeatureSupport::ALWAYS_ENABLED;
+ ext.distinctive_identifier_support = EmeFeatureSupport::ALWAYS_ENABLED;
ext.parent_key_system = kExternalParent;
#if defined(ENABLE_PEPPER_CDMS)
ext.pepper_type = "application/x-ppapi-external-cdm";
diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc
index 769f973..67a13e2 100644
--- a/media/blink/key_system_config_selector.cc
+++ b/media/blink/key_system_config_selector.cc
@@ -20,33 +20,21 @@
namespace media {
-namespace {
-
-static EmeFeatureRequirement ConvertRequirement(
- blink::WebMediaKeySystemConfiguration::Requirement requirement) {
- switch (requirement) {
- case blink::WebMediaKeySystemConfiguration::Requirement::Required:
- return EME_FEATURE_REQUIRED;
- case blink::WebMediaKeySystemConfiguration::Requirement::Optional:
- return EME_FEATURE_OPTIONAL;
- case blink::WebMediaKeySystemConfiguration::Requirement::NotAllowed:
- return EME_FEATURE_NOT_ALLOWED;
- }
+using EmeFeatureRequirement =
+ blink::WebMediaKeySystemConfiguration::Requirement;
- NOTREACHED();
- return EME_FEATURE_NOT_ALLOWED;
-}
+namespace {
static EmeConfigRule GetSessionTypeConfigRule(EmeSessionTypeSupport support) {
switch (support) {
- case EME_SESSION_TYPE_INVALID:
+ case EmeSessionTypeSupport::INVALID:
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
- case EME_SESSION_TYPE_NOT_SUPPORTED:
+ case EmeSessionTypeSupport::NOT_SUPPORTED:
return EmeConfigRule::NOT_SUPPORTED;
- case EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER:
+ case EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER:
return EmeConfigRule::IDENTIFIER_AND_PERSISTENCE_REQUIRED;
- case EME_SESSION_TYPE_SUPPORTED:
+ case EmeSessionTypeSupport::SUPPORTED:
return EmeConfigRule::PERSISTENCE_REQUIRED;
}
NOTREACHED();
@@ -56,7 +44,7 @@ static EmeConfigRule GetSessionTypeConfigRule(EmeSessionTypeSupport support) {
static EmeConfigRule GetDistinctiveIdentifierConfigRule(
EmeFeatureSupport support,
EmeFeatureRequirement requirement) {
- if (support == EME_FEATURE_INVALID) {
+ if (support == EmeFeatureSupport::INVALID) {
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
}
@@ -70,24 +58,24 @@ static EmeConfigRule GetDistinctiveIdentifierConfigRule(
// NOT_SUPPORTED I_NOT_ALLOWED I_NOT_ALLOWED NOT_SUPPORTED
// REQUESTABLE I_NOT_ALLOWED SUPPORTED I_REQUIRED
// ALWAYS_ENABLED NOT_SUPPORTED I_REQUIRED I_REQUIRED
- DCHECK(support == EME_FEATURE_NOT_SUPPORTED ||
- support == EME_FEATURE_REQUESTABLE ||
- support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(requirement == EME_FEATURE_NOT_ALLOWED ||
- requirement == EME_FEATURE_OPTIONAL ||
- requirement == EME_FEATURE_REQUIRED);
- if ((support == EME_FEATURE_NOT_SUPPORTED &&
- requirement == EME_FEATURE_REQUIRED) ||
- (support == EME_FEATURE_ALWAYS_ENABLED &&
- requirement == EME_FEATURE_NOT_ALLOWED)) {
+ DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
+ support == EmeFeatureSupport::REQUESTABLE ||
+ support == EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
+ requirement == EmeFeatureRequirement::Optional ||
+ requirement == EmeFeatureRequirement::Required);
+ if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
+ requirement == EmeFeatureRequirement::Required) ||
+ (support == EmeFeatureSupport::ALWAYS_ENABLED &&
+ requirement == EmeFeatureRequirement::NotAllowed)) {
return EmeConfigRule::NOT_SUPPORTED;
}
- if (support == EME_FEATURE_REQUESTABLE &&
- requirement == EME_FEATURE_OPTIONAL) {
+ if (support == EmeFeatureSupport::REQUESTABLE &&
+ requirement == EmeFeatureRequirement::Optional) {
return EmeConfigRule::SUPPORTED;
}
- if (support == EME_FEATURE_NOT_SUPPORTED ||
- requirement == EME_FEATURE_NOT_ALLOWED) {
+ if (support == EmeFeatureSupport::NOT_SUPPORTED ||
+ requirement == EmeFeatureRequirement::NotAllowed) {
return EmeConfigRule::IDENTIFIER_NOT_ALLOWED;
}
return EmeConfigRule::IDENTIFIER_REQUIRED;
@@ -96,7 +84,7 @@ static EmeConfigRule GetDistinctiveIdentifierConfigRule(
static EmeConfigRule GetPersistentStateConfigRule(
EmeFeatureSupport support,
EmeFeatureRequirement requirement) {
- if (support == EME_FEATURE_INVALID) {
+ if (support == EmeFeatureSupport::INVALID) {
NOTREACHED();
return EmeConfigRule::NOT_SUPPORTED;
}
@@ -113,24 +101,24 @@ static EmeConfigRule GetPersistentStateConfigRule(
// NOT_SUPPORTED P_NOT_ALLOWED P_NOT_ALLOWED NOT_SUPPORTED
// REQUESTABLE P_NOT_ALLOWED SUPPORTED P_REQUIRED
// ALWAYS_ENABLED NOT_SUPPORTED P_REQUIRED P_REQUIRED
- DCHECK(support == EME_FEATURE_NOT_SUPPORTED ||
- support == EME_FEATURE_REQUESTABLE ||
- support == EME_FEATURE_ALWAYS_ENABLED);
- DCHECK(requirement == EME_FEATURE_NOT_ALLOWED ||
- requirement == EME_FEATURE_OPTIONAL ||
- requirement == EME_FEATURE_REQUIRED);
- if ((support == EME_FEATURE_NOT_SUPPORTED &&
- requirement == EME_FEATURE_REQUIRED) ||
- (support == EME_FEATURE_ALWAYS_ENABLED &&
- requirement == EME_FEATURE_NOT_ALLOWED)) {
+ DCHECK(support == EmeFeatureSupport::NOT_SUPPORTED ||
+ support == EmeFeatureSupport::REQUESTABLE ||
+ support == EmeFeatureSupport::ALWAYS_ENABLED);
+ DCHECK(requirement == EmeFeatureRequirement::NotAllowed ||
+ requirement == EmeFeatureRequirement::Optional ||
+ requirement == EmeFeatureRequirement::Required);
+ if ((support == EmeFeatureSupport::NOT_SUPPORTED &&
+ requirement == EmeFeatureRequirement::Required) ||
+ (support == EmeFeatureSupport::ALWAYS_ENABLED &&
+ requirement == EmeFeatureRequirement::NotAllowed)) {
return EmeConfigRule::NOT_SUPPORTED;
}
- if (support == EME_FEATURE_REQUESTABLE &&
- requirement == EME_FEATURE_OPTIONAL) {
+ if (support == EmeFeatureSupport::REQUESTABLE &&
+ requirement == EmeFeatureRequirement::Optional) {
return EmeConfigRule::SUPPORTED;
}
- if (support == EME_FEATURE_NOT_SUPPORTED ||
- requirement == EME_FEATURE_NOT_ALLOWED) {
+ if (support == EmeFeatureSupport::NOT_SUPPORTED ||
+ requirement == EmeFeatureRequirement::NotAllowed) {
return EmeConfigRule::PERSISTENCE_NOT_ALLOWED;
}
return EmeConfigRule::PERSISTENCE_REQUIRED;
@@ -426,7 +414,7 @@ KeySystemConfigSelector::GetSupportedConfiguration(
// permission has already been denied. This would happen anyway at step 11.
EmeConfigRule di_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- ConvertRequirement(candidate.distinctiveIdentifier));
+ candidate.distinctiveIdentifier);
if (!config_state->IsRuleSupported(di_rule)) {
DVLOG(2) << "Rejecting requested configuration because "
<< "the distinctiveIdentifier requirement was not supported.";
@@ -448,7 +436,7 @@ KeySystemConfigSelector::GetSupportedConfiguration(
// combination with accumulated configuration, return null.
EmeConfigRule ps_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- ConvertRequirement(candidate.persistentState));
+ candidate.persistentState);
if (!config_state->IsRuleSupported(ps_rule)) {
DVLOG(2) << "Rejecting requested configuration because "
<< "the persistentState requirement was not supported.";
@@ -565,10 +553,10 @@ KeySystemConfigSelector::GetSupportedConfiguration(
blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
EmeConfigRule not_allowed_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- EME_FEATURE_NOT_ALLOWED);
+ EmeFeatureRequirement::NotAllowed);
EmeConfigRule required_rule = GetDistinctiveIdentifierConfigRule(
key_systems_->GetDistinctiveIdentifierSupport(key_system),
- EME_FEATURE_REQUIRED);
+ EmeFeatureRequirement::Required);
bool not_allowed_supported =
config_state->IsRuleSupported(not_allowed_rule);
bool required_supported = config_state->IsRuleSupported(required_rule);
@@ -605,10 +593,10 @@ KeySystemConfigSelector::GetSupportedConfiguration(
blink::WebMediaKeySystemConfiguration::Requirement::Optional) {
EmeConfigRule not_allowed_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- EME_FEATURE_NOT_ALLOWED);
+ EmeFeatureRequirement::NotAllowed);
EmeConfigRule required_rule = GetPersistentStateConfigRule(
key_systems_->GetPersistentStateSupport(key_system),
- EME_FEATURE_REQUIRED);
+ EmeFeatureRequirement::Required);
// |distinctiveIdentifier| should not be affected after it is decided.
DCHECK(not_allowed_rule == EmeConfigRule::NOT_SUPPORTED ||
not_allowed_rule == EmeConfigRule::PERSISTENCE_NOT_ALLOWED);
diff --git a/media/blink/key_system_config_selector_unittest.cc b/media/blink/key_system_config_selector_unittest.cc
index fc6d99a..762db78 100644
--- a/media/blink/key_system_config_selector_unittest.cc
+++ b/media/blink/key_system_config_selector_unittest.cc
@@ -124,15 +124,16 @@ class FakeKeySystems : public KeySystems {
InitDataTypeMask init_data_types = kInitDataTypeMaskNone;
// INVALID so that they must be set in any test that needs them.
- EmeSessionTypeSupport persistent_license = EME_SESSION_TYPE_INVALID;
- EmeSessionTypeSupport persistent_release_message = EME_SESSION_TYPE_INVALID;
+ EmeSessionTypeSupport persistent_license = EmeSessionTypeSupport::INVALID;
+ EmeSessionTypeSupport persistent_release_message =
+ EmeSessionTypeSupport::INVALID;
// Every test implicitly requires these, so they must be set. They are set to
// values that are likely to cause tests to fail if they are accidentally
// depended on. Test cases explicitly depending on them should set them, as
// the default values may be changed.
- EmeFeatureSupport persistent_state = EME_FEATURE_NOT_SUPPORTED;
- EmeFeatureSupport distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ EmeFeatureSupport persistent_state = EmeFeatureSupport::NOT_SUPPORTED;
+ EmeFeatureSupport distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
};
class FakeMediaPermission : public MediaPermission {
@@ -327,7 +328,7 @@ TEST_F(KeySystemConfigSelectorTest, InitDataTypes_SubsetSupported) {
// --- distinctiveIdentifier ---
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Default) {
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -341,7 +342,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Default) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Forced) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -354,7 +355,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Forced) {
}
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Blocked) {
- key_systems_->distinctive_identifier = EME_FEATURE_NOT_SUPPORTED;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::NOT_SUPPORTED;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -366,7 +367,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_Blocked) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RequestsPermission) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -380,7 +381,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RequestsPermission) {
TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RespectsPermission) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.distinctiveIdentifier =
@@ -393,7 +394,7 @@ TEST_F(KeySystemConfigSelectorTest, DistinctiveIdentifier_RespectsPermission) {
// --- persistentState ---
TEST_F(KeySystemConfigSelectorTest, PersistentState_Default) {
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -406,7 +407,7 @@ TEST_F(KeySystemConfigSelectorTest, PersistentState_Default) {
}
TEST_F(KeySystemConfigSelectorTest, PersistentState_Forced) {
- key_systems_->persistent_state = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -419,7 +420,7 @@ TEST_F(KeySystemConfigSelectorTest, PersistentState_Forced) {
}
TEST_F(KeySystemConfigSelectorTest, PersistentState_Blocked) {
- key_systems_->persistent_state = EME_FEATURE_ALWAYS_ENABLED;
+ key_systems_->persistent_state = EmeFeatureSupport::ALWAYS_ENABLED;
blink::WebMediaKeySystemConfiguration config;
config.persistentState =
@@ -442,8 +443,8 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_Empty) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_SubsetSupported) {
// Allow persistent state, as it would be required to be successful.
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_NOT_SUPPORTED;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license = EmeSessionTypeSupport::NOT_SUPPORTED;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
@@ -460,8 +461,8 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_SubsetSupported) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_AllSupported) {
// Allow persistent state, and expect it to be required.
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_SUPPORTED;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license = EmeSessionTypeSupport::SUPPORTED;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(blink::WebEncryptedMediaSessionType::Temporary);
@@ -487,9 +488,10 @@ TEST_F(KeySystemConfigSelectorTest, SessionTypes_AllSupported) {
TEST_F(KeySystemConfigSelectorTest, SessionTypes_PermissionCanBeRequired) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_state = EME_FEATURE_REQUESTABLE;
- key_systems_->persistent_license = EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_state = EmeFeatureSupport::REQUESTABLE;
+ key_systems_->persistent_license =
+ EmeSessionTypeSupport::SUPPORTED_WITH_IDENTIFIER;
std::vector<blink::WebEncryptedMediaSessionType> session_types;
session_types.push_back(
@@ -636,7 +638,7 @@ TEST_F(KeySystemConfigSelectorTest, VideoCapabilities_Robustness_Unsupported) {
TEST_F(KeySystemConfigSelectorTest,
VideoCapabilities_Robustness_PermissionCanBeRequired) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
video_capabilities[0].contentType = "a";
@@ -656,7 +658,7 @@ TEST_F(KeySystemConfigSelectorTest,
TEST_F(KeySystemConfigSelectorTest,
VideoCapabilities_Robustness_PermissionCanBeRecommended) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
std::vector<blink::WebMediaKeySystemMediaCapability> video_capabilities(1);
video_capabilities[0].contentType = "a";
@@ -725,7 +727,7 @@ TEST_F(KeySystemConfigSelectorTest, Configurations_SubsetSupported) {
TEST_F(KeySystemConfigSelectorTest,
Configurations_FirstRequiresPermission_Allowed) {
media_permission_->is_granted = true;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config1;
config1.label = "a";
@@ -744,7 +746,7 @@ TEST_F(KeySystemConfigSelectorTest,
TEST_F(KeySystemConfigSelectorTest,
Configurations_FirstRequiresPermission_Rejected) {
media_permission_->is_granted = false;
- key_systems_->distinctive_identifier = EME_FEATURE_REQUESTABLE;
+ key_systems_->distinctive_identifier = EmeFeatureSupport::REQUESTABLE;
blink::WebMediaKeySystemConfiguration config1;
config1.label = "a";