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

Unified Diff: media/base/android/media_drm_bridge.cc

Issue 930413003: MediaDrm: Only apply Widevine security levels to the Widevine key system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add creation and SetSecurityLevel tests. Created 5 years, 10 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/base/android/media_drm_bridge.cc
diff --git a/media/base/android/media_drm_bridge.cc b/media/base/android/media_drm_bridge.cc
index a89522df7115e8426a6df794cf6d0323f6fd485f..ecac70483763e99f3c0a60f7794615a6d57a9a2f 100644
--- a/media/base/android/media_drm_bridge.cc
+++ b/media/base/android/media_drm_bridge.cc
@@ -298,6 +298,7 @@ bool MediaDrmBridge::IsAvailable() {
return true;
}
+// TODO(ddorwin): This is specific to Widevine. http://crbug.com/459400
// static
bool MediaDrmBridge::IsSecureDecoderRequired(SecurityLevel security_level) {
DCHECK(IsAvailable());
@@ -305,20 +306,6 @@ bool MediaDrmBridge::IsSecureDecoderRequired(SecurityLevel security_level) {
}
// static
-bool MediaDrmBridge::IsSecurityLevelSupported(const std::string& key_system,
- SecurityLevel security_level) {
- if (!IsAvailable())
- return false;
-
- scoped_ptr<MediaDrmBridge> media_drm_bridge =
- MediaDrmBridge::CreateWithoutSessionSupport(key_system);
- if (!media_drm_bridge)
- return false;
-
- return media_drm_bridge->SetSecurityLevel(security_level);
-}
-
-// static
std::vector<std::string> MediaDrmBridge::GetPlatformKeySystemNames() {
return g_key_system_uuid_manager.Get().GetPlatformKeySystemNames();
}
@@ -404,6 +391,13 @@ scoped_ptr<MediaDrmBridge> MediaDrmBridge::CreateWithoutSessionSupport(
}
bool MediaDrmBridge::SetSecurityLevel(SecurityLevel security_level) {
+ if (security_level != SECURITY_LEVEL_NONE &&
+ !std::equal(scheme_uuid_.begin(), scheme_uuid_.end(), kWidevineUuid)) {
+ NOTREACHED() << "Widevine security level " << security_level
+ << "used with another key system";
+ return false;
+ }
+
JNIEnv* env = AttachCurrentThread();
std::string security_level_str = GetSecurityLevelString(security_level);
@@ -636,7 +630,12 @@ MediaDrmBridge::SecurityLevel MediaDrmBridge::GetSecurityLevel() {
}
bool MediaDrmBridge::IsProtectedSurfaceRequired() {
- return IsSecureDecoderRequired(GetSecurityLevel());
+ // For Widevine, this depends on the security level.
+ if (std::equal(scheme_uuid_.begin(), scheme_uuid_.end(), kWidevineUuid))
+ return IsSecureDecoderRequired(GetSecurityLevel());
+
+ // For other key systems, assume true.
+ return true;
}
void MediaDrmBridge::ResetDeviceCredentials(

Powered by Google App Engine
This is Rietveld 408576698