From 9b9e0a0bf1ef5b901b4c4c6d2a1a7be13d4bb51a Mon Sep 17 00:00:00 2001 From: Xiaohan Wang <xhwang@chromium.org> Date: Wed, 4 Dec 2024 16:16:56 +0000 Subject: [PATCH] media: Remove IsPotentiallySupportedKeySystem() This function is no longer needed. It was used to filter out key systems that were not known to Chromium and thus were not likely to be implemented in an interoperable way. However, this has not been useful in the past and is creating an exception to have key system specific code in media/. This change removes this function to make it easier to support other key systems. Bug: 378869813 Change-Id: Ic8303a43f2c5804f4e2b16836ae9bff0c518a511 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6056128 Auto-Submit: Xiaohan Wang <xhwang@chromium.org> Reviewed-by: Bo Liu <boliu@chromium.org> Reviewed-by: Sangbaek Park <sangbaekpark@chromium.org> Reviewed-by: John Rummell <jrummell@chromium.org> Commit-Queue: Bo Liu <boliu@chromium.org> Cr-Commit-Position: refs/heads/main@{#1391699} --- .../android_webview/test/KeySystemTest.java | 10 +--- .../test/shell/res/values/config.xml | 2 - media/base/key_systems_impl.cc | 58 ------------------- 3 files changed, 1 insertion(+), 69 deletions(-) diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java index daad6feffaf38..040a348676a05 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java @@ -139,14 +139,6 @@ public class KeySystemTest extends AwParameterizedTest { public void testSupportPlatformKeySystem() throws Throwable { Assert.assertEquals( getPlatformKeySystemExpectations(), - isKeySystemSupported("x-com.oem.test-keysystem")); - } - - @Test - @Feature({"AndroidWebView"}) - @SmallTest - public void testSupportPlatformKeySystemNoPrefix() throws Throwable { - Assert.assertEquals( - "\"NotSupportedError\"", isKeySystemSupported("com.oem.test-keysystem")); + isKeySystemSupported("com.oem.test-keysystem")); } } diff --git a/android_webview/test/shell/res/values/config.xml b/android_webview/test/shell/res/values/config.xml index cf4e355851016..6fe6a42a5057e 100644 --- a/android_webview/test/shell/res/values/config.xml +++ b/android_webview/test/shell/res/values/config.xml @@ -9,8 +9,6 @@ <string-array name="config_key_system_uuid_mapping" translatable="false"> <!-- Use Widevine's UUID to pass the availability-test of MediaDRM plugin --> <!--suppress TypographyDashes --> - <item>"x-com.oem.test-keysystem,EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED"</item> - <!--suppress TypographyDashes --> <item>"com.oem.test-keysystem,EDEF8BA9-79D6-4ACE-A3C8-27DCD51D21ED"</item> </string-array> </resources> diff --git a/media/base/key_systems_impl.cc b/media/base/key_systems_impl.cc index e7517a708a2a5..fb3f5743a8c35 100644 --- a/media/base/key_systems_impl.cc +++ b/media/base/key_systems_impl.cc @@ -24,7 +24,6 @@ #include "media/base/mime_util.h" #include "media/cdm/clear_key_cdm_common.h" #include "media/media_buildflags.h" -#include "third_party/widevine/cdm/widevine_cdm_common.h" namespace media { @@ -187,56 +186,6 @@ class ClearKeyKeySystemInfo : public KeySystemInfo { bool UseAesDecryptor() const final { return true; } }; -// Returns whether the |key_system| is known to Chromium and is thus likely to -// be implemented in an interoperable way. -// True is always returned for a |key_system| that begins with "x-". -// -// As with other web platform features, advertising support for a key system -// implies that it adheres to a defined and interoperable specification. -// -// To ensure interoperability, implementations of a specific |key_system| string -// must conform to a specification for that identifier that defines -// key system-specific behaviors not fully defined by the EME specification. -// That specification should be provided by the owner of the domain that is the -// reverse of the |key_system| string. -// This involves more than calling a library, SDK, or platform API. -// KeySystemsImpl must be populated appropriately, and there will likely be glue -// code to adapt to the API of the library, SDK, or platform API. -// -// Chromium mainline contains this data and glue code for specific key systems, -// which should help ensure interoperability with other implementations using -// these key systems. -// -// If you need to add support for other key systems, ensure that you have -// obtained the specification for how to integrate it with EME, implemented the -// appropriate glue/adapter code, and added all the appropriate data to -// KeySystemsImpl. Only then should you change this function. -static bool IsPotentiallySupportedKeySystem(const std::string& key_system) { - if (key_system == kWidevineKeySystem) - return true; - - if (key_system == kClearKeyKeySystem) { - return true; - } - - // External or MediaFoundation Clear Key is known and supports suffixes for - // testing. - if (IsExternalClearKey(key_system)) - return true; - - // Chromecast defines behaviors for Cast clients within its reverse domain. - const char kChromecastRoot[] = "com.chromecast"; - if (IsSubKeySystemOf(key_system, kChromecastRoot)) - return true; - - // Implementations that do not have a specification or appropriate glue code - // can use the "x-" prefix to avoid conflicting with and advertising support - // for real key system names. Use is discouraged. - const char kExcludedPrefix[] = "x-"; - return base::StartsWith(key_system, kExcludedPrefix, - base::CompareCase::SENSITIVE); -} - // Returns whether distinctive identifiers and persistent state can be reliably // blocked for |key_system_info| (and therefore be safely configurable). static bool CanBlock(const KeySystemInfo& key_system_info) { @@ -391,13 +340,6 @@ void KeySystemsImpl::ProcessSupportedKeySystems(KeySystemInfos key_systems) { DCHECK(key_system->GetDistinctiveIdentifierSupport() != EmeFeatureSupport::INVALID); - if (!IsPotentiallySupportedKeySystem(key_system->GetBaseKeySystemName())) { - // If you encounter this path, see the comments for the function above. - DLOG(ERROR) << "Unsupported name '" << key_system->GetBaseKeySystemName() - << "'. See code comments."; - continue; - } - // Supporting persistent state is a prerequisite for supporting persistent // sessions. if (key_system->GetPersistentStateSupport() ==