Index: components/cdm/renderer/android_key_systems.cc |
diff --git a/components/cdm/renderer/android_key_systems.cc b/components/cdm/renderer/android_key_systems.cc |
index d1e0f2ad7f4955fdb8b8f40fff829a3fc06eb6ea..e54e504bbccd76cacd27b3c38c664404166c9339 100644 |
--- a/components/cdm/renderer/android_key_systems.cc |
+++ b/components/cdm/renderer/android_key_systems.cc |
@@ -39,10 +39,22 @@ 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; |
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
+ switches::kMediaDrmEnableNonCompositing)) { |
+ codecs = response.non_compositing_codecs; |
+ } |
+ if (codecs != media::EME_CODEC_NONE) { |
AddWidevineWithCodecs( |
WIDEVINE, |
- static_cast<SupportedCodecs>(response.compositing_codecs), |
+ codecs, |
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |
@@ -50,11 +62,15 @@ void AddAndroidWidevine(std::vector<KeySystemInfo>* 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) { |
- // TODO(ddorwin): Remove with unprefixed. http://crbug.com/249976 |
AddWidevineWithCodecs( |
WIDEVINE_HR_NON_COMPOSITING, |
- static_cast<SupportedCodecs>(response.non_compositing_codecs), |
+ response.non_compositing_codecs, |
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent license. |
media::EME_SESSION_TYPE_NOT_SUPPORTED, // Persistent release message. |
media::EME_FEATURE_NOT_SUPPORTED, // Persistent state. |