Index: media/blink/key_system_config_selector.cc |
diff --git a/media/blink/key_system_config_selector.cc b/media/blink/key_system_config_selector.cc |
index f48f34b22ca22cf9c8c0403500b054bae971fdc0..ec36f2e7c1b671da1465899ee15d10094064c402 100644 |
--- a/media/blink/key_system_config_selector.cc |
+++ b/media/blink/key_system_config_selector.cc |
@@ -310,20 +310,33 @@ bool KeySystemConfigSelector::IsSupportedContentType( |
const std::string& container_mime_type, |
const std::string& codecs, |
KeySystemConfigSelector::ConfigState* config_state) { |
+ // From RFC6838: "Both top-level type and subtype names are case-insensitive." |
+ std::string container_lower = base::ToLowerASCII(container_mime_type); |
+ |
+ // contentTypes must provide a codec string unless the container implies a |
+ // particular codec. For EME, none of the currently supported containers |
+ // imply a codec, so |codecs| must be provided. |
+ if (codecs.empty()) { |
+ // Since the spec didn't initially require this, add an exemption for |
+ // some existing containers to give clients time to adapt. |
+ // TODO(jrummell): Remove this exemption once the number of contentTypes |
+ // without codecs drops low enough (UMA added in the blink code). |
+ // http://crbug.com/605661. |
+ if (container_lower != "audio/webm" && container_lower != "video/webm" && |
+ container_lower != "audio/mp4" && container_lower != "video/mp4") { |
+ return false; |
+ } |
+ } |
+ |
// Check that |container_mime_type| and |codecs| are supported by Chrome. This |
// is done primarily to validate extended codecs, but it also ensures that the |
// CDM cannot support codecs that Chrome does not (which could complicate the |
// robustness algorithm). |
- if (!IsSupportedMediaFormat(container_mime_type, codecs, |
+ if (!IsSupportedMediaFormat(container_lower, codecs, |
CanUseAesDecryptor(key_system))) { |
return false; |
} |
- // TODO(servolk): Converting |container_mime_type| to lower-case could be |
- // moved to KeySystemsImpl::GetContentTypeConfigRule, plus we could add some |
- // upper-case container name test cases in media/base/key_systems_unittest.cc. |
- std::string container_lower = base::ToLowerASCII(container_mime_type); |
- |
// Check that |container_mime_type| and |codecs| are supported by the CDM. |
// This check does not handle extended codecs, so extended codec information |
// is stripped (extended codec information was checked above). |
@@ -574,6 +587,7 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
} |
// 10.3. Add video capabilities to accumulated configuration. |
+ accumulated_configuration->hasVideoCapabilities = true; |
accumulated_configuration->videoCapabilities = video_capabilities; |
} |
@@ -592,6 +606,7 @@ KeySystemConfigSelector::GetSupportedConfiguration( |
} |
// 11.3. Add audio capabilities to accumulated configuration. |
+ accumulated_configuration->hasAudioCapabilities = true; |
accumulated_configuration->audioCapabilities = audio_capabilities; |
} |