Commit a8a9143d authored by sandersd's avatar sandersd Committed by Commit bot

Implement robustness strings in requestMediaKeySystemAccess().

BUG=442586,460616

Review URL: https://codereview.chromium.org/1005903003

Cr-Commit-Position: refs/heads/master@{#322219}
parent f1eb0a7e
...@@ -75,22 +75,22 @@ static void AddExternalClearKey( ...@@ -75,22 +75,22 @@ static void AddExternalClearKey(
KeySystemInfo info; KeySystemInfo info;
info.key_system = kExternalClearKeyKeySystem; info.key_system = kExternalClearKeyKeySystem;
info.supported_codecs = media::EME_CODEC_WEBM_ALL;
info.supported_init_data_types = info.supported_init_data_types =
media::EME_INIT_DATA_TYPE_WEBM | media::EME_INIT_DATA_TYPE_KEYIDS; media::EME_INIT_DATA_TYPE_WEBM | media::EME_INIT_DATA_TYPE_KEYIDS;
info.supported_codecs = media::EME_CODEC_WEBM_ALL;
#if defined(USE_PROPRIETARY_CODECS) #if defined(USE_PROPRIETARY_CODECS)
info.supported_codecs |= media::EME_CODEC_MP4_ALL;
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
info.supported_codecs |= media::EME_CODEC_MP4_ALL;
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
info.max_audio_robustness = media::EmeRobustness::EMPTY;
info.max_video_robustness = media::EmeRobustness::EMPTY;
// Persistent sessions are faked. // Persistent sessions are faked.
info.persistent_license_support = media::EME_SESSION_TYPE_SUPPORTED; info.persistent_license_support = media::EME_SESSION_TYPE_SUPPORTED;
info.persistent_release_message_support = info.persistent_release_message_support =
media::EME_SESSION_TYPE_NOT_SUPPORTED; media::EME_SESSION_TYPE_NOT_SUPPORTED;
// TODO(sandersd): Using ALWAYS_ENABLED prevents "not-allowed" from info.persistent_state_support = media::EME_FEATURE_REQUESTABLE;
// succeeding. Change this to REQUESTABLE once the state can be blocked.
// http://crbug.com/457482
info.persistent_state_support = media::EME_FEATURE_ALWAYS_ENABLED;
info.distinctive_identifier_support = media::EME_FEATURE_NOT_SUPPORTED; info.distinctive_identifier_support = media::EME_FEATURE_NOT_SUPPORTED;
info.pepper_type = kExternalClearKeyPepperType; info.pepper_type = kExternalClearKeyPepperType;
...@@ -193,24 +193,21 @@ static void AddPepperBasedWidevine( ...@@ -193,24 +193,21 @@ static void AddPepperBasedWidevine(
cdm::AddWidevineWithCodecs( cdm::AddWidevineWithCodecs(
cdm::WIDEVINE, supported_codecs, cdm::WIDEVINE, supported_codecs,
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// Persistent licenses are supported if remote attestation succeeds. media::EmeRobustness::HW_SECURE_ALL, // Maximum audio robustness.
media::EME_SESSION_TYPE_SUPPORTED_WITH_PERMISSION, media::EmeRobustness::HW_SECURE_ALL, // Maximim video robustness.
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. // persistent-license.
// TODO(sandersd): Using ALWAYS_ENABLED prevents "not-allowed" from media::EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER,
// succeeding. Change this to REQUESTABLE once the state can be blocked. media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
// http://crbug.com/457482 media::EME_FEATURE_REQUESTABLE, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Persistent state. // Distinctive identifier.
// A distinctive identifier will be available if remote attestation media::EME_FEATURE_REQUESTABLE_WITH_IDENTIFIER,
// succeeds.
media::EME_FEATURE_REQUESTABLE_WITH_PERMISSION,
#else // (Desktop) #else // (Desktop)
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. media::EmeRobustness::SW_SECURE_CRYPTO, // Maximum audio robustness.
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. media::EmeRobustness::SW_SECURE_DECODE, // Maximum video robustness.
// TODO(sandersd): Using ALWAYS_ENABLED prevents "not-allowed" from media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
// succeeding. Change this to REQUESTABLE once the state can be blocked. media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
// http://crbug.com/457482 media::EME_FEATURE_REQUESTABLE, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Persistent state. media::EME_FEATURE_NOT_SUPPORTED, // Distinctive identifier.
media::EME_FEATURE_NOT_SUPPORTED, // Distinctive identifier.
#endif // defined(OS_CHROMEOS) #endif // defined(OS_CHROMEOS)
concrete_key_systems); concrete_key_systems);
} }
......
...@@ -22,9 +22,11 @@ void AddKeySystemWithCodecs( ...@@ -22,9 +22,11 @@ void AddKeySystemWithCodecs(
std::vector<::media::KeySystemInfo>* key_systems_info) { std::vector<::media::KeySystemInfo>* key_systems_info) {
::media::KeySystemInfo info; ::media::KeySystemInfo info;
info.key_system = key_system_name; info.key_system = key_system_name;
info.supported_init_data_types = ::media::EME_INIT_DATA_TYPE_CENC;
info.supported_codecs = info.supported_codecs =
::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1; ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1;
info.supported_init_data_types = ::media::EME_INIT_DATA_TYPE_CENC; 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::EME_SESSION_TYPE_NOT_SUPPORTED;
info.persistent_release_message_support = info.persistent_release_message_support =
::media::EME_SESSION_TYPE_NOT_SUPPORTED; ::media::EME_SESSION_TYPE_NOT_SUPPORTED;
...@@ -39,8 +41,10 @@ void AddChromecastKeySystems( ...@@ -39,8 +41,10 @@ void AddChromecastKeySystems(
AddWidevineWithCodecs( AddWidevineWithCodecs(
cdm::WIDEVINE, cdm::WIDEVINE,
::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1, ::media::EME_CODEC_MP4_AAC | ::media::EME_CODEC_MP4_AVC1,
::media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. ::media::EmeRobustness::HW_SECURE_ALL, // Max audio robustness.
::media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. ::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.
::media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. ::media::EME_FEATURE_NOT_SUPPORTED, // Persistent state.
::media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. ::media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
key_systems_info); key_systems_info);
......
...@@ -7,14 +7,17 @@ ...@@ -7,14 +7,17 @@
#include <string> #include <string>
#include <vector> #include <vector>
#include "base/command_line.h"
#include "base/logging.h" #include "base/logging.h"
#include "components/cdm/common/cdm_messages_android.h" #include "components/cdm/common/cdm_messages_android.h"
#include "components/cdm/renderer/widevine_key_systems.h" #include "components/cdm/renderer/widevine_key_systems.h"
#include "content/public/renderer/render_thread.h" #include "content/public/renderer/render_thread.h"
#include "media/base/eme_constants.h" #include "media/base/eme_constants.h"
#include "media/base/media_switches.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR. #include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
using media::EmeRobustness;
using media::KeySystemInfo; using media::KeySystemInfo;
using media::SupportedCodecs; using media::SupportedCodecs;
...@@ -39,24 +42,48 @@ static SupportedKeySystemResponse QueryKeySystemSupport( ...@@ -39,24 +42,48 @@ static SupportedKeySystemResponse QueryKeySystemSupport(
void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) { void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) {
SupportedKeySystemResponse response = QueryKeySystemSupport( SupportedKeySystemResponse response = QueryKeySystemSupport(
kWidevineKeySystem); kWidevineKeySystem);
if (response.compositing_codecs != media::EME_CODEC_NONE) {
// When creating the WIDEVINE key system, BrowserCdmFactoryAndroid configures
// the CDM's security level based on the --mediadrm-enable-non-compositing
// flag (L1 if the flag is enabled, L3 otherwise). Therefore the supported
// codec/robustenss combinations depend on that flag.
// TODO(sandersd): For unprefixed, set the security level based on the
// requested robustness instead of the flag. http://crbug.com/467779
SupportedCodecs codecs = response.compositing_codecs;
EmeRobustness max_audio_robustness = EmeRobustness::SW_SECURE_CRYPTO;
EmeRobustness max_video_robustness = EmeRobustness::SW_SECURE_CRYPTO;
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kMediaDrmEnableNonCompositing)) {
codecs = response.non_compositing_codecs;
max_audio_robustness = EmeRobustness::HW_SECURE_CRYPTO;
max_video_robustness = EmeRobustness::HW_SECURE_ALL;
}
if (codecs != media::EME_CODEC_NONE) {
AddWidevineWithCodecs( AddWidevineWithCodecs(
WIDEVINE, WIDEVINE,
static_cast<SupportedCodecs>(response.compositing_codecs), codecs,
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. max_audio_robustness,
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. max_video_robustness,
media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-license.
media::EME_SESSION_TYPE_NOT_SUPPORTED, // persistent-release-message.
media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. media::EME_FEATURE_NOT_SUPPORTED, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
concrete_key_systems); concrete_key_systems);
} }
// For compatibility with the prefixed API, register a separate L1 key system.
// When creating the WIDEVINE_HR_NON_COMPOSITING key system,
// BrowserCdmFactoryAndroid does not configure the CDM's security level (that
// is, leaves it as L1); therefore only secure codecs are supported.
// TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976
if (response.non_compositing_codecs != media::EME_CODEC_NONE) { if (response.non_compositing_codecs != media::EME_CODEC_NONE) {
// TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976
AddWidevineWithCodecs( AddWidevineWithCodecs(
WIDEVINE_HR_NON_COMPOSITING, WIDEVINE_HR_NON_COMPOSITING,
static_cast<SupportedCodecs>(response.non_compositing_codecs), response.non_compositing_codecs,
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. EmeRobustness::HW_SECURE_CRYPTO, // Max audio robustness.
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. 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_NOT_SUPPORTED, // Persistent state. media::EME_FEATURE_NOT_SUPPORTED, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier. media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
concrete_key_systems); concrete_key_systems);
...@@ -85,6 +112,8 @@ void AddAndroidPlatformKeySystems( ...@@ -85,6 +112,8 @@ void AddAndroidPlatformKeySystems(
if (response.compositing_codecs & media::EME_CODEC_MP4_ALL) if (response.compositing_codecs & media::EME_CODEC_MP4_ALL)
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
info.max_audio_robustness = EmeRobustness::EMPTY;
info.max_video_robustness = EmeRobustness::EMPTY;
// Assume the worst case (from a user point of view). // 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::EME_SESSION_TYPE_NOT_SUPPORTED;
info.persistent_release_message_support = info.persistent_release_message_support =
......
...@@ -29,6 +29,8 @@ static std::string GetDirectParentName(std::string name) { ...@@ -29,6 +29,8 @@ static std::string GetDirectParentName(std::string name) {
void AddWidevineWithCodecs( void AddWidevineWithCodecs(
WidevineCdmType widevine_cdm_type, WidevineCdmType widevine_cdm_type,
SupportedCodecs supported_codecs, SupportedCodecs supported_codecs,
media::EmeRobustness max_audio_robustness,
media::EmeRobustness max_video_robustness,
media::EmeSessionTypeSupport persistent_license_support, media::EmeSessionTypeSupport persistent_license_support,
media::EmeSessionTypeSupport persistent_release_message_support, media::EmeSessionTypeSupport persistent_release_message_support,
media::EmeFeatureSupport persistent_state_support, media::EmeFeatureSupport persistent_state_support,
...@@ -66,6 +68,8 @@ void AddWidevineWithCodecs( ...@@ -66,6 +68,8 @@ void AddWidevineWithCodecs(
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC; info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
#endif // defined(USE_PROPRIETARY_CODECS) #endif // defined(USE_PROPRIETARY_CODECS)
info.max_audio_robustness = max_audio_robustness;
info.max_video_robustness = max_video_robustness;
info.persistent_license_support = persistent_license_support; info.persistent_license_support = persistent_license_support;
info.persistent_release_message_support = persistent_release_message_support; info.persistent_release_message_support = persistent_release_message_support;
info.persistent_state_support = persistent_state_support; info.persistent_state_support = persistent_state_support;
......
...@@ -22,6 +22,8 @@ enum WidevineCdmType { ...@@ -22,6 +22,8 @@ enum WidevineCdmType {
void AddWidevineWithCodecs( void AddWidevineWithCodecs(
WidevineCdmType widevine_cdm_type, WidevineCdmType widevine_cdm_type,
media::SupportedCodecs supported_codecs, media::SupportedCodecs supported_codecs,
media::EmeRobustness max_audio_robustness,
media::EmeRobustness max_video_robustness,
media::EmeSessionTypeSupport persistent_license_support, media::EmeSessionTypeSupport persistent_license_support,
media::EmeSessionTypeSupport persistent_release_message_support, media::EmeSessionTypeSupport persistent_release_message_support,
media::EmeFeatureSupport persistent_state_support, media::EmeFeatureSupport persistent_state_support,
......
...@@ -27,6 +27,8 @@ class TestContentRendererClient : public ContentRendererClient { ...@@ -27,6 +27,8 @@ class TestContentRendererClient : public ContentRendererClient {
// TODO(sandersd): Was this supposed to be added to the list? // TODO(sandersd): Was this supposed to be added to the list?
media::KeySystemInfo key_system_info; media::KeySystemInfo key_system_info;
key_system_info.key_system = "test.keysystem"; key_system_info.key_system = "test.keysystem";
key_system_info.max_audio_robustness = media::EmeRobustness::EMPTY;
key_system_info.max_video_robustness = media::EmeRobustness::EMPTY;
key_system_info.persistent_license_support = key_system_info.persistent_license_support =
media::EME_SESSION_TYPE_NOT_SUPPORTED; media::EME_SESSION_TYPE_NOT_SUPPORTED;
key_system_info.persistent_release_message_support = key_system_info.persistent_release_message_support =
...@@ -40,6 +42,8 @@ class TestContentRendererClient : public ContentRendererClient { ...@@ -40,6 +42,8 @@ class TestContentRendererClient : public ContentRendererClient {
if (is_extra_key_system_enabled_) { if (is_extra_key_system_enabled_) {
media::KeySystemInfo wv_key_system_info; media::KeySystemInfo wv_key_system_info;
wv_key_system_info.key_system = kWidevineKeySystem; wv_key_system_info.key_system = kWidevineKeySystem;
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 = wv_key_system_info.persistent_license_support =
media::EME_SESSION_TYPE_NOT_SUPPORTED; media::EME_SESSION_TYPE_NOT_SUPPORTED;
wv_key_system_info.persistent_release_message_support = wv_key_system_info.persistent_release_message_support =
......
...@@ -34,7 +34,7 @@ scoped_ptr<BrowserCdm> BrowserCdmFactoryAndroid::CreateBrowserCdm( ...@@ -34,7 +34,7 @@ scoped_ptr<BrowserCdm> BrowserCdmFactoryAndroid::CreateBrowserCdm(
} }
// TODO(xhwang/ddorwin): Pass the security level from key system. // TODO(xhwang/ddorwin): Pass the security level from key system.
// http://crbug.com/459400 // http://crbug.com/467779
if (key_system == kWidevineKeySystem) { if (key_system == kWidevineKeySystem) {
MediaDrmBridge::SecurityLevel security_level = MediaDrmBridge::SecurityLevel security_level =
MediaDrmBridge::SECURITY_LEVEL_3; MediaDrmBridge::SECURITY_LEVEL_3;
......
...@@ -55,32 +55,75 @@ enum EmeSessionTypeSupport { ...@@ -55,32 +55,75 @@ enum EmeSessionTypeSupport {
EME_SESSION_TYPE_INVALID, EME_SESSION_TYPE_INVALID,
// The session type is not supported. // The session type is not supported.
EME_SESSION_TYPE_NOT_SUPPORTED, EME_SESSION_TYPE_NOT_SUPPORTED,
// The session type is supported if the encrypted media permission is granted. // The session type is supported if a distinctive identifier is available.
EME_SESSION_TYPE_SUPPORTED_WITH_PERMISSION, EME_SESSION_TYPE_SUPPORTED_WITH_IDENTIFIER,
// The session type is always supported. // The session type is always supported.
EME_SESSION_TYPE_SUPPORTED, EME_SESSION_TYPE_SUPPORTED,
}; };
// Used to declare support for distinctive identifier and persistent state.
enum EmeFeatureSupport { enum EmeFeatureSupport {
// Invalid default value. // Invalid default value.
EME_FEATURE_INVALID, EME_FEATURE_INVALID,
// Access to the feature is not supported at all. // Access to the feature is not supported at all.
EME_FEATURE_NOT_SUPPORTED, EME_FEATURE_NOT_SUPPORTED,
// Access to the feature may be requested if the encrypted media permission is // Access to the feature may be requested if a distinctive identifier is
// granted. // available. (This is the correct choice for declaring support for a
EME_FEATURE_REQUESTABLE_WITH_PERMISSION, // requestable distinctive identifier.)
EME_FEATURE_REQUESTABLE_WITH_IDENTIFIER,
// Access to the feature may be requested. // Access to the feature may be requested.
EME_FEATURE_REQUESTABLE, EME_FEATURE_REQUESTABLE,
// Access to the feature cannot be blocked. // Access to the feature cannot be blocked.
EME_FEATURE_ALWAYS_ENABLED, EME_FEATURE_ALWAYS_ENABLED,
}; };
// Used to query support for distinctive identifier and persistent state.
enum EmeFeatureRequirement { enum EmeFeatureRequirement {
EME_FEATURE_NOT_ALLOWED, EME_FEATURE_NOT_ALLOWED,
EME_FEATURE_OPTIONAL, EME_FEATURE_OPTIONAL,
EME_FEATURE_REQUIRED, EME_FEATURE_REQUIRED,
}; };
enum class EmeMediaType {
AUDIO,
VIDEO,
};
// Robustness values understood by KeySystems.
// Note: KeySystems expects this ordering (in GetRobustnessConfigRule()),
// changes may be required there if this list changes.
enum class EmeRobustness {
INVALID,
EMPTY,
SW_SECURE_CRYPTO,
SW_SECURE_DECODE,
HW_SECURE_CRYPTO,
HW_SECURE_DECODE,
HW_SECURE_ALL,
};
// Configuration rules indicate the configuration state required to support a
// configuration option (note: a configuration option may be disallowing a
// feature). Configuration rules are used to answer queries about distinctive
// identifier, persistent state, and robustness requirements, as well as to
// describe support for different session types.
//
// If in the future there are reasons to request user permission other than
// access to a distinctive identifier, then additional rules should be added.
// Rules are implemented in ConfigState and are otherwise opaque.
enum class EmeConfigRule {
// The configuration option is not supported.
NOT_SUPPORTED,
// The configuration option is supported if a distinctive identifier is
// available.
IDENTIFIER_REQUIRED,
// The configuration option is supported, but the user experience may be
// improved if a distinctive identifier is available.
IDENTIFIER_RECOMMENDED,
// The configuration option is supported without conditions.
SUPPORTED,
};
} // namespace media } // namespace media
#endif // MEDIA_BASE_EME_CONSTANTS_H_ #endif // MEDIA_BASE_EME_CONSTANTS_H_
...@@ -9,6 +9,8 @@ namespace media { ...@@ -9,6 +9,8 @@ namespace media {
KeySystemInfo::KeySystemInfo() KeySystemInfo::KeySystemInfo()
: supported_init_data_types(EME_INIT_DATA_TYPE_NONE), : supported_init_data_types(EME_INIT_DATA_TYPE_NONE),
supported_codecs(EME_CODEC_NONE), supported_codecs(EME_CODEC_NONE),
max_audio_robustness(EmeRobustness::INVALID),
max_video_robustness(EmeRobustness::INVALID),
persistent_license_support(EME_SESSION_TYPE_INVALID), persistent_license_support(EME_SESSION_TYPE_INVALID),
persistent_release_message_support(EME_SESSION_TYPE_INVALID), persistent_release_message_support(EME_SESSION_TYPE_INVALID),
persistent_state_support(EME_FEATURE_INVALID), persistent_state_support(EME_FEATURE_INVALID),
......
...@@ -35,13 +35,10 @@ struct MEDIA_EXPORT KeySystemInfo { ...@@ -35,13 +35,10 @@ struct MEDIA_EXPORT KeySystemInfo {
std::string key_system; std::string key_system;
// Specifies registered initialization data types supported by |key_system|.
SupportedInitDataTypes supported_init_data_types; SupportedInitDataTypes supported_init_data_types;
// Specifies codecs supported by |key_system|.
SupportedCodecs supported_codecs; SupportedCodecs supported_codecs;
EmeRobustness max_audio_robustness;
// Specifies session types and features supported by |key_system|. EmeRobustness max_video_robustness;
EmeSessionTypeSupport persistent_license_support; EmeSessionTypeSupport persistent_license_support;
EmeSessionTypeSupport persistent_release_message_support; EmeSessionTypeSupport persistent_release_message_support;
EmeFeatureSupport persistent_state_support; EmeFeatureSupport persistent_state_support;
......
This diff is collapsed.
...@@ -85,27 +85,32 @@ MEDIA_EXPORT std::string GetPepperType( ...@@ -85,27 +85,32 @@ MEDIA_EXPORT std::string GetPepperType(
const std::string& concrete_key_system); const std::string& concrete_key_system);
#endif #endif
// Returns whether |key_system| supports persistent-license sessions. // Returns the configuration rule for supporting a robustness requirement.
MEDIA_EXPORT bool IsPersistentLicenseSessionSupported( // TODO(sandersd): Also take a list of codecs, as they may affect the result.
MEDIA_EXPORT EmeConfigRule GetRobustnessConfigRule(
const std::string& key_system, const std::string& key_system,
bool is_permission_granted); EmeMediaType media_type,
const std::string& requested_robustness);
// Returns whether |key_system| supports persistent-release-message sessions. // Returns the configuration rule for supporting persistent-license sessions.
MEDIA_EXPORT bool IsPersistentReleaseMessageSessionSupported( MEDIA_EXPORT EmeConfigRule GetPersistentLicenseSessionConfigRule(
const std::string& key_system, const std::string& key_system);
bool is_permission_granted);
// Returns the configuration rule for supporting persistent-release-message
// sessions.
MEDIA_EXPORT EmeConfigRule GetPersistentReleaseMessageSessionConfigRule(
const std::string& key_system);
// Returns whether |key_system| supports persistent state as requested. // Returns the configuration rule for supporting a persistent state requirement.
MEDIA_EXPORT bool IsPersistentStateRequirementSupported( MEDIA_EXPORT EmeConfigRule GetPersistentStateConfigRule(
const std::string& key_system, const std::string& key_system,
EmeFeatureRequirement requirement, EmeFeatureRequirement requirement);
bool is_permission_granted);
// Returns whether |key_system| supports distinctive identifiers as requested. // Returns the configuration rule for supporting a distinctive identifier
MEDIA_EXPORT bool IsDistinctiveIdentifierRequirementSupported( // requirement.
MEDIA_EXPORT EmeConfigRule GetDistinctiveIdentifierConfigRule(
const std::string& key_system, const std::string& key_system,
EmeFeatureRequirement requirement, EmeFeatureRequirement requirement);
bool is_permission_granted);
#if defined(UNIT_TEST) #if defined(UNIT_TEST)
// Helper functions to add container/codec types for testing purposes. // Helper functions to add container/codec types for testing purposes.
......
...@@ -166,6 +166,8 @@ void TestMediaClient::AddUsesAesKeySystem( ...@@ -166,6 +166,8 @@ void TestMediaClient::AddUsesAesKeySystem(
system.supported_codecs = EME_CODEC_WEBM_ALL; system.supported_codecs = EME_CODEC_WEBM_ALL;
system.supported_codecs |= TEST_CODEC_FOO_ALL; system.supported_codecs |= TEST_CODEC_FOO_ALL;
system.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; system.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM;
system.max_audio_robustness = EmeRobustness::EMPTY;
system.max_video_robustness = EmeRobustness::EMPTY;
system.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED; system.persistent_license_support = EME_SESSION_TYPE_NOT_SUPPORTED;
system.persistent_release_message_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.persistent_state_support = EME_FEATURE_NOT_SUPPORTED;
...@@ -181,6 +183,8 @@ void TestMediaClient::AddExternalKeySystem( ...@@ -181,6 +183,8 @@ void TestMediaClient::AddExternalKeySystem(
ext.supported_codecs = EME_CODEC_WEBM_ALL; ext.supported_codecs = EME_CODEC_WEBM_ALL;
ext.supported_codecs |= TEST_CODEC_FOO_ALL; ext.supported_codecs |= TEST_CODEC_FOO_ALL;
ext.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM; ext.supported_init_data_types = EME_INIT_DATA_TYPE_WEBM;
ext.max_audio_robustness = EmeRobustness::EMPTY;
ext.max_video_robustness = EmeRobustness::EMPTY;
ext.persistent_license_support = EME_SESSION_TYPE_SUPPORTED; ext.persistent_license_support = EME_SESSION_TYPE_SUPPORTED;
ext.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED; ext.persistent_release_message_support = EME_SESSION_TYPE_NOT_SUPPORTED;
ext.persistent_state_support = EME_FEATURE_ALWAYS_ENABLED; ext.persistent_state_support = EME_FEATURE_ALWAYS_ENABLED;
......
This diff is collapsed.
...@@ -85,8 +85,10 @@ PlayerUtils.registerEMEEventListeners = function(player) { ...@@ -85,8 +85,10 @@ PlayerUtils.registerEMEEventListeners = function(player) {
this.registerDefaultEventListeners(player); this.registerDefaultEventListeners(player);
Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem); Utils.timeLog('Setting video media keys: ' + player.testConfig.keySystem);
var persistentState = player.testConfig.sessionToLoad ? "required"
: "optional";
return navigator.requestMediaKeySystemAccess( return navigator.requestMediaKeySystemAccess(
player.testConfig.keySystem, [{}]) player.testConfig.keySystem, [{persistentState: persistentState}])
.then(function(access) { return access.createMediaKeys(); }) .then(function(access) { return access.createMediaKeys(); })
.then(function(mediaKeys) { .then(function(mediaKeys) {
return player.video.setMediaKeys(mediaKeys); return player.video.setMediaKeys(mediaKeys);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment