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

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: rebase 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
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/media/encrypted-media/encrypted-media-requestmediakeysystemaccess.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698