Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(426)

Unified Diff: media/blink/key_system_config_selector.cc

Issue 1911953003: EME: Correctly handle container-only contentType strings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: changes Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 885049c83872d0e5f80ec16863f6b8a501777af0..9e933f37a157ec9ce5fe7efbf69817251d600cda 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).

Powered by Google App Engine
This is Rietveld 408576698