summaryrefslogtreecommitdiffstats
path: root/components/cdm
diff options
context:
space:
mode:
authorsandersd <sandersd@chromium.org>2015-03-25 12:53:06 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-25 19:54:38 +0000
commita8a9143d9373e1ae47f30d3da14c051d16188b3e (patch)
tree20796ef8d0a1e51b0988aa8ea5ace1a515ef61e6 /components/cdm
parentf1eb0a7e1062b0ea684727df4d61c55a75fe4a87 (diff)
downloadchromium_src-a8a9143d9373e1ae47f30d3da14c051d16188b3e.zip
chromium_src-a8a9143d9373e1ae47f30d3da14c051d16188b3e.tar.gz
chromium_src-a8a9143d9373e1ae47f30d3da14c051d16188b3e.tar.bz2
Implement robustness strings in requestMediaKeySystemAccess().
BUG=442586,460616 Review URL: https://codereview.chromium.org/1005903003 Cr-Commit-Position: refs/heads/master@{#322219}
Diffstat (limited to 'components/cdm')
-rw-r--r--components/cdm/renderer/android_key_systems.cc45
-rw-r--r--components/cdm/renderer/widevine_key_systems.cc4
-rw-r--r--components/cdm/renderer/widevine_key_systems.h2
3 files changed, 43 insertions, 8 deletions
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc
index d1e0f2a..e773656 100644
--- a/components/cdm/renderer/android_key_systems.cc
+++ b/components/cdm/renderer/android_key_systems.cc
@@ -7,14 +7,17 @@
#include <string>
#include <vector>
+#include "base/command_line.h"
#include "base/logging.h"
#include "components/cdm/common/cdm_messages_android.h"
#include "components/cdm/renderer/widevine_key_systems.h"
#include "content/public/renderer/render_thread.h"
#include "media/base/eme_constants.h"
+#include "media/base/media_switches.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+using media::EmeRobustness;
using media::KeySystemInfo;
using media::SupportedCodecs;
@@ -39,24 +42,48 @@ static SupportedKeySystemResponse QueryKeySystemSupport(
void AddAndroidWidevine(std::vector<KeySystemInfo>* concrete_key_systems) {
SupportedKeySystemResponse response = QueryKeySystemSupport(
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(
WIDEVINE,
- static_cast<SupportedCodecs>(response.compositing_codecs),
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message.
+ 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_NOT_SUPPORTED, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
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) {
- // TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976
AddWidevineWithCodecs(
WIDEVINE_HR_NON_COMPOSITING,
- static_cast<SupportedCodecs>(response.non_compositing_codecs),
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license.
- media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message.
+ 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_NOT_SUPPORTED, // Persistent state.
media::EME_FEATURE_ALWAYS_ENABLED, // Distinctive identifier.
concrete_key_systems);
@@ -85,6 +112,8 @@ void AddAndroidPlatformKeySystems(
if (response.compositing_codecs & media::EME_CODEC_MP4_ALL)
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
#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).
info.persistent_license_support = media::EME_SESSION_TYPE_NOT_SUPPORTED;
info.persistent_release_message_support =
diff --git a/components/cdm/renderer/widevine_key_systems.cc b/components/cdm/renderer/widevine_key_systems.cc
index 037df1b..ec38ab6 100644
--- a/components/cdm/renderer/widevine_key_systems.cc
+++ b/components/cdm/renderer/widevine_key_systems.cc
@@ -29,6 +29,8 @@ static std::string GetDirectParentName(std::string name) {
void AddWidevineWithCodecs(
WidevineCdmType widevine_cdm_type,
SupportedCodecs supported_codecs,
+ media::EmeRobustness max_audio_robustness,
+ media::EmeRobustness max_video_robustness,
media::EmeSessionTypeSupport persistent_license_support,
media::EmeSessionTypeSupport persistent_release_message_support,
media::EmeFeatureSupport persistent_state_support,
@@ -66,6 +68,8 @@ void AddWidevineWithCodecs(
info.supported_init_data_types |= media::EME_INIT_DATA_TYPE_CENC;
#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_release_message_support = persistent_release_message_support;
info.persistent_state_support = persistent_state_support;
diff --git a/components/cdm/renderer/widevine_key_systems.h b/components/cdm/renderer/widevine_key_systems.h
index 15c55da..dc05bb8 100644
--- a/components/cdm/renderer/widevine_key_systems.h
+++ b/components/cdm/renderer/widevine_key_systems.h
@@ -22,6 +22,8 @@ enum WidevineCdmType {
void AddWidevineWithCodecs(
WidevineCdmType widevine_cdm_type,
media::SupportedCodecs supported_codecs,
+ media::EmeRobustness max_audio_robustness,
+ media::EmeRobustness max_video_robustness,
media::EmeSessionTypeSupport persistent_license_support,
media::EmeSessionTypeSupport persistent_release_message_support,
media::EmeFeatureSupport persistent_state_support,