media: Move widevine CDM targets to WidevineCdm folder
Put Widevine CDM and adapter in WidevineCdm folder in the output
directory instead of in the output directory directly. This will make it
easier for us to ship manifest.json file alongside with the CDM. It will
also make it easier for use to bundle the CDM on Windows and Mac.
BUG=582622
TEST=Unit tests still pass. Manually tested on Linux.
Review-Url: https://codereview.chromium.org/1957643002
Cr-Commit-Position: refs/heads/master@{#393672}
diff --git a/chrome/BUILD.gn b/chrome/BUILD.gn
index f4860f9..0400fc7 100644
--- a/chrome/BUILD.gn
+++ b/chrome/BUILD.gn
@@ -222,9 +222,10 @@
# On Mac, internal plugins go inside the framework, so these
# dependencies are on chrome.dll.
"//third_party/adobe/flash:flapper_binaries",
- "//third_party/widevine/cdm:widevinecdmadapter",
]
+ data_deps += [ "//third_party/widevine/cdm:widevinecdmadapter" ]
+
if (is_multi_dll_chrome) {
defines += [ "CHROME_MULTIPLE_DLL" ]
data_deps += [ ":chrome_child" ]
diff --git a/chrome/browser/content_settings/content_settings_browsertest.cc b/chrome/browser/content_settings/content_settings_browsertest.cc
index 1d1349c..f5bbfac 100644
--- a/chrome/browser/content_settings/content_settings_browsertest.cc
+++ b/chrome/browser/content_settings/content_settings_browsertest.cc
@@ -322,27 +322,30 @@
// Registers any CDM plugins not registered by default.
void SetUpCommandLine(base::CommandLine* command_line) override {
#if defined(ENABLE_PEPPER_CDMS)
- // Platform-specific filename relative to the chrome executable.
+ // Base path for Clear Key CDM (relative to the chrome executable).
+ const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+
+// Platform-specific filename relative to kClearKeyCdmBaseDirectory.
#if defined(OS_WIN)
- const char kLibraryName[] = "clearkeycdmadapter.dll";
+ const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.dll";
#else // !defined(OS_WIN)
#if defined(OS_MACOSX)
- const char kLibraryName[] = "clearkeycdmadapter.plugin";
+ const char kClearKeyCdmAdapterFileName[] = "clearkeycdmadapter.plugin";
#elif defined(OS_POSIX)
- const char kLibraryName[] = "libclearkeycdmadapter.so";
+ const char kClearKeyCdmAdapterFileName[] = "libclearkeycdmadapter.so";
#endif // defined(OS_MACOSX)
#endif // defined(OS_WIN)
// Append the switch to register the External Clear Key CDM.
base::FilePath::StringType pepper_plugins = BuildPepperPluginRegistration(
- kLibraryName, "Clear Key CDM", kExternalClearKeyMimeType);
+ kClearKeyCdmBaseDirectory, kClearKeyCdmAdapterFileName, "Clear Key CDM",
+ kExternalClearKeyMimeType);
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
// The CDM must be registered when it is a component.
pepper_plugins.append(FILE_PATH_LITERAL(","));
- pepper_plugins.append(
- BuildPepperPluginRegistration(kWidevineCdmAdapterFileName,
- kWidevineCdmDisplayName,
- kWidevineCdmPluginMimeType));
+ pepper_plugins.append(BuildPepperPluginRegistration(
+ kWidevineCdmBaseDirectory, kWidevineCdmAdapterFileName,
+ kWidevineCdmDisplayName, kWidevineCdmPluginMimeType));
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
pepper_plugins);
@@ -434,11 +437,13 @@
// plugin using the provided parameters and a dummy version.
// Multiple results may be passed to kRegisterPepperPlugins, separated by ",".
base::FilePath::StringType BuildPepperPluginRegistration(
+ const char* library_path,
const char* library_name,
const char* display_name,
const char* mime_type) {
base::FilePath plugin_dir;
EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
+ plugin_dir = plugin_dir.AppendASCII(library_path);
base::FilePath plugin_lib = plugin_dir.AppendASCII(library_name);
EXPECT_TRUE(base::PathExists(plugin_lib));
diff --git a/chrome/browser/load_library_perf_test.cc b/chrome/browser/load_library_perf_test.cc
index 5b4fe12..0aa7f02e 100644
--- a/chrome/browser/load_library_perf_test.cc
+++ b/chrome/browser/load_library_perf_test.cc
@@ -16,21 +16,22 @@
#include "testing/perf/perf_test.h"
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
+// Base path for Clear Key CDM (relative to the chrome executable).
+const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+
// Measures the size (bytes) and time to load (sec) of a native library.
-void MeasureSizeAndTimeToLoadNativeLibrary(const base::FilePath& library_name) {
+void MeasureSizeAndTimeToLoadNativeLibrary(const std::string& library_base_dir,
+ const std::string& library_name) {
base::FilePath output_dir;
ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &output_dir));
- base::FilePath library_path = output_dir.Append(library_name);
+ output_dir = output_dir.AppendASCII(library_base_dir);
+ base::FilePath library_path = output_dir.AppendASCII(library_name);
ASSERT_TRUE(base::PathExists(library_path)) << library_path.value();
int64_t size = 0;
ASSERT_TRUE(base::GetFileSize(library_path, &size));
- perf_test::PrintResult("library_size",
- "",
- library_name.AsUTF8Unsafe(),
- static_cast<size_t>(size),
- "bytes",
- true);
+ perf_test::PrintResult("library_size", "", library_name,
+ static_cast<size_t>(size), "bytes", true);
base::NativeLibraryLoadError error;
base::TimeTicks start = base::TimeTicks::Now();
@@ -39,50 +40,50 @@
double delta = (base::TimeTicks::Now() - start).InMillisecondsF();
ASSERT_TRUE(native_library) << "Error loading library: " << error.ToString();
base::UnloadNativeLibrary(native_library);
- perf_test::PrintResult("time_to_load_library",
- "",
- library_name.AsUTF8Unsafe(),
- delta,
- "ms",
+ perf_test::PrintResult("time_to_load_library", "", library_name, delta, "ms",
true);
}
// Use the base name of the library to dynamically get the platform specific
// name. See base::GetNativeLibraryName() for details.
void MeasureSizeAndTimeToLoadNativeLibraryByBaseName(
+ const std::string& library_base_dir,
const std::string& base_library_name) {
- MeasureSizeAndTimeToLoadNativeLibrary(base::FilePath::FromUTF16Unsafe(
- base::GetNativeLibraryName(base::ASCIIToUTF16(base_library_name))));
+ MeasureSizeAndTimeToLoadNativeLibrary(
+ library_base_dir, base::UTF16ToUTF8(base::GetNativeLibraryName(
+ base::ASCIIToUTF16(base_library_name))));
}
#if defined(ENABLE_PEPPER_CDMS)
#if defined(WIDEVINE_CDM_AVAILABLE)
TEST(LoadCDMPerfTest, Widevine) {
- MeasureSizeAndTimeToLoadNativeLibrary(
- base::FilePath::FromUTF8Unsafe(kWidevineCdmFileName));
+ MeasureSizeAndTimeToLoadNativeLibrary(kWidevineCdmBaseDirectory,
+ kWidevineCdmFileName);
}
TEST(LoadCDMPerfTest, WidevineAdapter) {
- MeasureSizeAndTimeToLoadNativeLibrary(
- base::FilePath::FromUTF8Unsafe(kWidevineCdmAdapterFileName));
+ MeasureSizeAndTimeToLoadNativeLibrary(kWidevineCdmBaseDirectory,
+ kWidevineCdmAdapterFileName);
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
TEST(LoadCDMPerfTest, ExternalClearKey) {
#if defined(OS_MACOSX)
- MeasureSizeAndTimeToLoadNativeLibrary(
- base::FilePath::FromUTF8Unsafe("libclearkeycdm.dylib"));
+ MeasureSizeAndTimeToLoadNativeLibrary(kClearKeyCdmBaseDirectory,
+ "libclearkeycdm.dylib");
#else
- MeasureSizeAndTimeToLoadNativeLibraryByBaseName("clearkeycdm");
+ MeasureSizeAndTimeToLoadNativeLibraryByBaseName(kClearKeyCdmBaseDirectory,
+ "clearkeycdm");
#endif // defined(OS_MACOSX)
}
TEST(LoadCDMPerfTest, ExternalClearKeyAdapter) {
#if defined(OS_MACOSX)
- MeasureSizeAndTimeToLoadNativeLibrary(
- base::FilePath::FromUTF8Unsafe("clearkeycdmadapter.plugin"));
+ MeasureSizeAndTimeToLoadNativeLibrary(kClearKeyCdmBaseDirectory,
+ "clearkeycdmadapter.plugin");
#else
- MeasureSizeAndTimeToLoadNativeLibraryByBaseName("clearkeycdmadapter");
+ MeasureSizeAndTimeToLoadNativeLibraryByBaseName(kClearKeyCdmBaseDirectory,
+ "clearkeycdmadapter");
#endif // defined(OS_MACOSX)
}
#endif // defined(ENABLE_PEPPER_CDMS)
diff --git a/chrome/browser/media/encrypted_media_browsertest.cc b/chrome/browser/media/encrypted_media_browsertest.cc
index ffcf367..ed8f2031e 100644
--- a/chrome/browser/media/encrypted_media_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_browsertest.cc
@@ -26,7 +26,10 @@
#include "widevine_cdm_version.h" // In SHARED_INTERMEDIATE_DIR.
#if defined(ENABLE_PEPPER_CDMS)
-// Platform-specific filename relative to the chrome executable.
+// Base path for Clear Key CDM (relative to the chrome executable).
+const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+
+// Platform-specific filename relative to kClearKeyCdmBaseDirectory.
const char kClearKeyCdmAdapterFileName[] =
#if defined(OS_MACOSX)
"clearkeycdmadapter.plugin";
@@ -261,11 +264,13 @@
#if defined(ENABLE_PEPPER_CDMS)
if (IsExternalClearKey(key_system)) {
- RegisterPepperCdm(command_line, kClearKeyCdmAdapterFileName, key_system);
+ RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory,
+ kClearKeyCdmAdapterFileName, key_system);
}
#if defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
else if (IsWidevine(key_system)) { // NOLINT
- RegisterPepperCdm(command_line, kWidevineCdmAdapterFileName, key_system);
+ RegisterPepperCdm(command_line, kWidevineCdmBaseDirectory,
+ kWidevineCdmAdapterFileName, key_system);
}
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(WIDEVINE_CDM_IS_COMPONENT)
#endif // defined(ENABLE_PEPPER_CDMS)
@@ -273,18 +278,24 @@
private:
#if defined(ENABLE_PEPPER_CDMS)
+ // The CDM adapter should be located in |adapter_base_dir| in DIR_MODULE.
void RegisterPepperCdm(base::CommandLine* command_line,
+ const std::string& adapter_base_dir,
const std::string& adapter_name,
const std::string& key_system) {
DCHECK(!is_pepper_cdm_registered_)
<< "RegisterPepperCdm() can only be called once.";
is_pepper_cdm_registered_ = true;
- // Append the switch to register the Clear Key CDM Adapter.
+ // Build the CDM adapter path.
base::FilePath plugin_dir;
EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
+ plugin_dir = plugin_dir.AppendASCII(adapter_base_dir);
+
base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name);
EXPECT_TRUE(base::PathExists(plugin_lib)) << plugin_lib.value();
+
+ // Build pepper plugin registration switch.
base::FilePath::StringType pepper_plugin = plugin_lib.value();
pepper_plugin.append(FILE_PATH_LITERAL("#CDM#0.1.0.0;"));
#if defined(OS_WIN)
@@ -292,6 +303,8 @@
#else
pepper_plugin.append(GetPepperType(key_system));
#endif
+
+ // Append the switch to register the CDM Adapter.
command_line->AppendSwitchNative(switches::kRegisterPepperPlugins,
pepper_plugin);
}
diff --git a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
index d59b992c..6c0b5b8 100644
--- a/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
+++ b/chrome/browser/media/encrypted_media_supported_types_browsertest.cc
@@ -83,8 +83,8 @@
// Expectations for Widevine.
// Note: Widevine is not available on platforms using components because
// RegisterPepperCdm() cannot set the codecs.
-// TODO(ddorwin): Enable these tests after we have the ability to use the CUS
-// in these tests. See http://crbug.com/356833.
+// TODO(xhwang): Enable these tests after we have the ability to use the
+// manifest in these tests. See http://crbug.com/586634
#if defined(WIDEVINE_CDM_AVAILABLE) && !defined(WIDEVINE_CDM_IS_COMPONENT)
#define EXPECT_WV_SUCCESS EXPECT_SUCCESS
#define EXPECT_WV_PROPRIETARY EXPECT_PROPRIETARY
@@ -96,6 +96,23 @@
#endif // defined(WIDEVINE_CDM_AVAILABLE) &&
// !defined(WIDEVINE_CDM_IS_COMPONENT)
+#if defined(ENABLE_PEPPER_CDMS)
+// Base path for Clear Key CDM (relative to the chrome executable).
+const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+
+// Platform-specific filename relative to kClearKeyCdmBaseDirectory.
+const char kClearKeyCdmAdapterFileName[] =
+#if defined(OS_MACOSX)
+ "clearkeycdmadapter.plugin";
+#elif defined(OS_WIN)
+ "clearkeycdmadapter.dll";
+#elif defined(OS_POSIX)
+ "libclearkeycdmadapter.so";
+#endif
+
+const char kClearKeyCdmPluginMimeType[] = "application/x-ppapi-clearkey-cdm";
+#endif // defined(ENABLE_PEPPER_CDMS)
+
}; // namespace
class EncryptedMediaSupportedTypesTest : public InProcessBrowserTest {
@@ -150,6 +167,7 @@
// Update the command line to load |adapter_name| for
// |pepper_type_for_key_system|.
void RegisterPepperCdm(base::CommandLine* command_line,
+ const std::string& adapter_base_dir,
const std::string& adapter_name,
const std::string& pepper_type_for_key_system,
bool expect_adapter_exists = true) {
@@ -160,6 +178,8 @@
// Append the switch to register the appropriate adapter.
base::FilePath plugin_dir;
EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &plugin_dir));
+ plugin_dir = plugin_dir.AppendASCII(adapter_base_dir);
+
base::FilePath plugin_lib = plugin_dir.AppendASCII(adapter_name);
EXPECT_EQ(expect_adapter_exists, base::PathExists(plugin_lib));
base::FilePath::StringType pepper_plugin = plugin_lib.value();
@@ -282,26 +302,15 @@
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
-
- // Platform-specific filename relative to the chrome executable.
- const char adapter_file_name[] =
-#if defined(OS_MACOSX)
- "clearkeycdmadapter.plugin";
-#elif defined(OS_WIN)
- "clearkeycdmadapter.dll";
-#elif defined(OS_POSIX)
- "libclearkeycdmadapter.so";
-#endif
-
- const std::string pepper_name("application/x-ppapi-clearkey-cdm");
- RegisterPepperCdm(command_line, adapter_file_name, pepper_name);
+ RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory,
+ kClearKeyCdmAdapterFileName, kClearKeyCdmPluginMimeType);
}
#endif // defined(ENABLE_PEPPER_CDMS)
};
// TODO(sandersd): Register the Widevine CDM if it is a component. A component
// CDM registered using RegisterPepperCdm() declares support for audio codecs,
-// but not the other codecs we expect. http://crbug.com/356833.
+// but not the other codecs we expect. http://crbug.com/356833
class EncryptedMediaSupportedTypesWidevineTest
: public EncryptedMediaSupportedTypesTest {
};
@@ -313,10 +322,9 @@
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
- RegisterPepperCdm(command_line,
+ RegisterPepperCdm(command_line, kClearKeyCdmBaseDirectory,
"clearkeycdmadapterwrongname.dll",
- "application/x-ppapi-clearkey-cdm",
- false);
+ kClearKeyCdmPluginMimeType, false);
}
};
@@ -326,10 +334,9 @@
protected:
void SetUpCommandLine(base::CommandLine* command_line) override {
EncryptedMediaSupportedTypesTest::SetUpCommandLine(command_line);
- RegisterPepperCdm(command_line,
+ RegisterPepperCdm(command_line, "WidevineCdm",
"widevinecdmadapterwrongname.dll",
- "application/x-ppapi-widevine-cdm",
- false);
+ "application/x-ppapi-widevine-cdm", false);
}
};
#endif // defined(ENABLE_PEPPER_CDMS)
diff --git a/chrome/browser_tests.isolate b/chrome/browser_tests.isolate
index cec61ef8..2880b5b 100644
--- a/chrome/browser_tests.isolate
+++ b/chrome/browser_tests.isolate
@@ -35,8 +35,8 @@
['OS=="linux"', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/libclearkeycdm.so',
- '<(PRODUCT_DIR)/libclearkeycdmadapter.so',
+ '<(PRODUCT_DIR)/ClearKeyCdm/libclearkeycdm.so',
+ '<(PRODUCT_DIR)/ClearKeyCdm/libclearkeycdmadapter.so',
'<(PRODUCT_DIR)/libpower_saver_test_plugin.so',
'<(PRODUCT_DIR)/libppapi_tests.so',
],
@@ -45,8 +45,8 @@
['OS=="linux" and branding=="Chrome" and enable_pepper_cdms==1', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/libwidevinecdm.so',
- '<(PRODUCT_DIR)/libwidevinecdmadapter.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdmadapter.so',
],
},
}],
@@ -183,9 +183,9 @@
['OS=="mac"', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/clearkeycdmadapter.plugin',
+ '<(PRODUCT_DIR)/ClearKeyCdm/clearkeycdmadapter.plugin',
+ '<(PRODUCT_DIR)/ClearKeyCdm/libclearkeycdm.dylib',
'<(PRODUCT_DIR)/content_shell.pak',
- '<(PRODUCT_DIR)/libclearkeycdm.dylib',
'<(PRODUCT_DIR)/osmesa.so',
'<(PRODUCT_DIR)/power_saver_test_plugin.plugin/Contents/MacOS/power_saver_test_plugin',
'<(PRODUCT_DIR)/ppapi_tests.plugin/Contents/MacOS/ppapi_tests',
@@ -195,8 +195,8 @@
['OS=="mac" and branding=="Chrome" and enable_pepper_cdms==1', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/libwidevinecdm.dylib',
- '<(PRODUCT_DIR)/widevinecdmadapter.plugin',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.dylib',
+ '<(PRODUCT_DIR)/WidevineCdm/widevinecdmadapter.plugin',
],
},
}],
@@ -205,8 +205,8 @@
'files': [
'../native_client/build/build_nexe.py',
'<(PRODUCT_DIR)/chrome_elf.dll',
- '<(PRODUCT_DIR)/clearkeycdm.dll',
- '<(PRODUCT_DIR)/clearkeycdmadapter.dll',
+ '<(PRODUCT_DIR)/ClearKeyCdm/clearkeycdm.dll',
+ '<(PRODUCT_DIR)/ClearKeyCdm/clearkeycdmadapter.dll',
'<(PRODUCT_DIR)/crashpad_handler.exe',
'<(PRODUCT_DIR)/power_saver_test_plugin.dll',
'<(PRODUCT_DIR)/ppapi_tests.dll',
@@ -217,8 +217,8 @@
['OS=="win" and branding=="Chrome" and enable_pepper_cdms==1', {
'variables': {
'files': [
- '<(PRODUCT_DIR)/widevinecdm.dll',
- '<(PRODUCT_DIR)/widevinecdmadapter.dll',
+ '<(PRODUCT_DIR)/WidevineCdm/widevinecdm.dll',
+ '<(PRODUCT_DIR)/WidevineCdm/widevinecdmadapter.dll',
],
},
}],
diff --git a/chrome/chrome_dll_bundle.gypi b/chrome/chrome_dll_bundle.gypi
index 985f40d..cf2fccdf 100644
--- a/chrome/chrome_dll_bundle.gypi
+++ b/chrome/chrome_dll_bundle.gypi
@@ -132,14 +132,14 @@
],
},
{
- # This file is used by the component installer.
- # It is not a complete plugin on its own.
- 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Internet Plug-Ins/',
+ # The adapter is not a complete plugin on its own. It needs the Widevine
+ # CDM to work.
+ 'destination': '<(PRODUCT_DIR)/$(CONTENTS_FOLDER_PATH)/Internet Plug-Ins/WidevineCdm',
'files': [],
'conditions': [
['branding == "Chrome"', {
'files': [
- '<(PRODUCT_DIR)/widevinecdmadapter.plugin',
+ '<(PRODUCT_DIR)/WidevineCdm/widevinecdmadapter.plugin',
],
}],
],
diff --git a/chrome/chrome_installer.gypi b/chrome/chrome_installer.gypi
index 325f0b3..839e7606 100644
--- a/chrome/chrome_installer.gypi
+++ b/chrome/chrome_installer.gypi
@@ -525,8 +525,8 @@
'rpm_arch': 'i386',
'packaging_files_binaries': [
'<(PRODUCT_DIR)/nacl_irt_x86_32.nexe',
- '<(PRODUCT_DIR)/libwidevinecdmadapter.so',
- '<(PRODUCT_DIR)/libwidevinecdm.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdmadapter.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.so',
],
'packaging_files_common': [
'<(DEPTH)/build/linux/bin/eu-strip',
@@ -537,8 +537,8 @@
'rpm_arch': 'x86_64',
'packaging_files_binaries': [
'<(PRODUCT_DIR)/nacl_irt_x86_64.nexe',
- '<(PRODUCT_DIR)/libwidevinecdmadapter.so',
- '<(PRODUCT_DIR)/libwidevinecdm.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdmadapter.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.so',
],
'packaging_files_common': [
'<!(which eu-strip)',
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc
index c7462488e..5dfcbcc 100644
--- a/chrome/common/chrome_paths.cc
+++ b/chrome/common/chrome_paths.cc
@@ -345,7 +345,7 @@
case chrome::DIR_COMPONENT_WIDEVINE_CDM:
if (!PathService::Get(chrome::DIR_USER_DATA, &cur))
return false;
- cur = cur.Append(FILE_PATH_LITERAL("WidevineCDM"));
+ cur = cur.AppendASCII(kWidevineCdmBaseDirectory);
break;
#endif // defined(WIDEVINE_CDM_IS_COMPONENT)
// TODO(xhwang): FILE_WIDEVINE_CDM_ADAPTER has different meanings.
@@ -354,6 +354,7 @@
case chrome::FILE_WIDEVINE_CDM_ADAPTER:
if (!GetInternalPluginsDirectory(&cur))
return false;
+ cur = cur.AppendASCII(kWidevineCdmBaseDirectory);
cur = cur.AppendASCII(kWidevineCdmAdapterFileName);
break;
#endif // defined(WIDEVINE_CDM_AVAILABLE) && defined(ENABLE_PEPPER_CDMS)
diff --git a/chrome/installer/linux/BUILD.gn b/chrome/installer/linux/BUILD.gn
index 9f1422a..c467d74e 100644
--- a/chrome/installer/linux/BUILD.gn
+++ b/chrome/installer/linux/BUILD.gn
@@ -220,14 +220,14 @@
if (current_cpu == "x86") {
packaging_files_binaries += [
"$root_out_dir/nacl_irt_x86_32.nexe",
- "$root_out_dir/libwidevinecdmadapter.so",
- "$root_out_dir/libwidevinecdm.so",
+ "$root_out_dir/WidevineCdm/libwidevinecdmadapter.so",
+ "$root_out_dir/WidevineCdm/libwidevinecdm.so",
]
} else if (current_cpu == "x64") {
packaging_files_binaries += [
"$root_out_dir/nacl_irt_x86_64.nexe",
- "$root_out_dir/libwidevinecdmadapter.so",
- "$root_out_dir/libwidevinecdm.so",
+ "$root_out_dir/WidevineCdm/libwidevinecdmadapter.so",
+ "$root_out_dir/WidevineCdm/libwidevinecdm.so",
]
} else if (current_cpu == "arm") {
packaging_files_binaries += [ "$root_out_dir/nacl_irt_arm.nexe" ]
diff --git a/chrome/installer/linux/common/installer.include b/chrome/installer/linux/common/installer.include
index ed85858..08e163d 100644
--- a/chrome/installer/linux/common/installer.include
+++ b/chrome/installer/linux/common/installer.include
@@ -159,9 +159,14 @@
find "${STAGEDIR}/${INSTALLDIR}/locales" -type d -exec chmod 755 '{}' \;
# Widevine CDM.
- if [ -f "${BUILDDIR}/libwidevinecdmadapter.so" ]; then
- install -m 644 -s "${BUILDDIR}/libwidevinecdmadapter.so" "${STAGEDIR}/${INSTALLDIR}/"
- install -m 644 "${BUILDDIR}/libwidevinecdm.so" "${STAGEDIR}/${INSTALLDIR}/"
+ WIDEVINECDM_SRCDIR="${BUILDDIR}/WidevineCdm"
+ WIDEVINECDM_DESTDIR="${STAGEDIR}/${INSTALLDIR}/WidevineCdm"
+ if [ -f "${WIDEVINECDM_SRCDIR}/libwidevinecdmadapter.so" ]; then
+ install -m 755 -d "${WIDEVINECDM_DESTDIR}"
+ install -m 644 -s "${WIDEVINECDM_SRCDIR}/libwidevinecdmadapter.so" \
+ "${WIDEVINECDM_DESTDIR}/"
+ install -m 644 "${WIDEVINECDM_SRCDIR}/libwidevinecdm.so" \
+ "${WIDEVINECDM_DESTDIR}/"
fi
# ANGLE
diff --git a/chrome/installer/mini_installer/chrome.release b/chrome/installer/mini_installer/chrome.release
index 1816869d..1c5a7f1 100644
--- a/chrome/installer/mini_installer/chrome.release
+++ b/chrome/installer/mini_installer/chrome.release
@@ -55,7 +55,7 @@
[GOOGLE_CHROME]
SecondaryTile.png: %(VersionDir)s\
-widevinecdmadapter.dll: %(VersionDir)s\
+WidevineCdm\widevinecdmadapter.dll: %(VersionDir)s\WidevineCdm\
#
# Pepper Flash sub-dir.
#
diff --git a/chrome/tools/build/chromeos/FILES.cfg b/chrome/tools/build/chromeos/FILES.cfg
index 855cabaf..2363a37f 100644
--- a/chrome/tools/build/chromeos/FILES.cfg
+++ b/chrome/tools/build/chromeos/FILES.cfg
@@ -102,20 +102,20 @@
},
# CDM files (each has an adapter and the actual CDM):
{
- 'filename': 'libclearkeycdmadapter.so',
+ 'filename': 'ClearKeyCdm/libclearkeycdmadapter.so',
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'libclearkeycdm.so',
+ 'filename': 'ClearKeyCdm/libclearkeycdm.so',
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'libwidevinecdmadapter.so',
+ 'filename': 'WidevineCdm/libwidevinecdmadapter.so',
'arch': ['32bit', '64bit', 'arm'],
'buildtype': ['official'],
},
{
- 'filename': 'libwidevinecdm.so',
+ 'filename': 'WidevineCdm/libwidevinecdm.so',
'arch': ['32bit', '64bit', 'arm'],
'buildtype': ['official'],
'direct_archive': 1,
diff --git a/chrome/tools/build/linux/FILES.cfg b/chrome/tools/build/linux/FILES.cfg
index 2b3b3b9..495701c 100644
--- a/chrome/tools/build/linux/FILES.cfg
+++ b/chrome/tools/build/linux/FILES.cfg
@@ -109,20 +109,20 @@
},
# CDM files (each has an adapter and the actual CDM):
{
- 'filename': 'libclearkeycdmadapter.so',
+ 'filename': 'ClearKeyCdm/libclearkeycdmadapter.so',
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'libclearkeycdm.so',
+ 'filename': 'ClearKeyCdm/libclearkeycdm.so',
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'libwidevinecdmadapter.so',
+ 'filename': 'WidevineCdm/libwidevinecdmadapter.so',
'arch': ['32bit', '64bit'],
'buildtype': ['official'],
},
{
- 'filename': 'libwidevinecdm.so',
+ 'filename': 'WidevineCdm/libwidevinecdm.so',
'arch': ['32bit', '64bit'],
'buildtype': ['official'],
'direct_archive': 1,
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index 08b8f30..7e224117 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -350,7 +350,7 @@
},
# Widevine CDM adapter files:
{
- 'filename': 'widevinecdmadapter.dll',
+ 'filename': 'WidevineCdm/widevinecdmadapter.dll',
'buildtype': ['official'],
},
# ANGLE files:
diff --git a/media/cdm/external_clear_key_test_helper.cc b/media/cdm/external_clear_key_test_helper.cc
index 1a2a15e..ebdcf7e0 100644
--- a/media/cdm/external_clear_key_test_helper.cc
+++ b/media/cdm/external_clear_key_test_helper.cc
@@ -19,6 +19,8 @@
#define STRINGIFY(X) #X
#define MAKE_STRING(X) STRINGIFY(X)
+const char kClearKeyCdmBaseDirectory[] = "ClearKeyCdm";
+
// File name of the External ClearKey CDM on different platforms.
const base::FilePath::CharType kExternalClearKeyCdmFileName[] =
#if defined(OS_MACOSX)
@@ -40,10 +42,10 @@
void ExternalClearKeyTestHelper::LoadLibrary() {
// Determine the location of the CDM. It is expected to be in the same
// directory as the current module.
- base::FilePath current_module_dir;
- ASSERT_TRUE(PathService::Get(base::DIR_MODULE, ¤t_module_dir));
- library_path_ =
- current_module_dir.Append(base::FilePath(kExternalClearKeyCdmFileName));
+ base::FilePath library_dir;
+ ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &library_dir));
+ library_dir = library_dir.AppendASCII(kClearKeyCdmBaseDirectory);
+ library_path_ = library_dir.Append(kExternalClearKeyCdmFileName);
ASSERT_TRUE(base::PathExists(library_path_)) << library_path_.value();
// Now load the CDM library.
diff --git a/media/cdm/ppapi/BUILD.gn b/media/cdm/ppapi/BUILD.gn
index 4869c620..95f056d 100644
--- a/media/cdm/ppapi/BUILD.gn
+++ b/media/cdm/ppapi/BUILD.gn
@@ -11,6 +11,7 @@
# "use_vpx". These should be added here if necessary but its not clear if
# they are required any more.
shared_library("clearkeycdm") {
+ output_dir = "$root_out_dir/ClearKeyCdm"
sources = [
"cdm_file_io_test.cc",
"cdm_file_io_test.h",
@@ -62,6 +63,8 @@
}
ppapi_cdm_adapter("clearkeycdmadapter") {
+ output_dir = "$root_out_dir/ClearKeyCdm"
+
# Check whether the plugin's origin URL is valid.
defines = [ "CHECK_DOCUMENT_URL" ]
deps = [
diff --git a/media/media.gyp b/media/media.gyp
index f3387a79..fc6b155 100644
--- a/media/media.gyp
+++ b/media/media.gyp
@@ -1327,6 +1327,13 @@
'sources': [
'cdm/cdm_adapter_unittest.cc',
],
+ 'conditions': [
+ ['OS == "mac"', {
+ 'xcode_settings': {
+ 'LD_RUNPATH_SEARCH_PATHS' : [ '@executable_path/ClearKeyCdm' ],
+ },
+ }]
+ ],
}],
['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
'sources': [
diff --git a/media/media_cdm.gypi b/media/media_cdm.gypi
index 5efcb3b..83105e9 100644
--- a/media/media_cdm.gypi
+++ b/media/media_cdm.gypi
@@ -23,6 +23,7 @@
{
# GN version: //media/cdm/ppapi:clearkeycdm
'target_name': 'clearkeycdm',
+ 'product_dir': '<(PRODUCT_DIR)/ClearKeyCdm',
'type': 'none',
# TODO(tomfinegan): Simplify this by unconditionally including all the
# decoders, and changing clearkeycdm to select which decoder to use
@@ -69,7 +70,7 @@
}],
['OS == "mac"', {
'xcode_settings': {
- 'DYLIB_INSTALL_NAME_BASE': '@loader_path',
+ 'DYLIB_INSTALL_NAME_BASE': '@rpath',
},
}]
],
@@ -115,6 +116,7 @@
{
# GN version: //media/cdm/ppapi:clearkeycdmadapter
'target_name': 'clearkeycdmadapter',
+ 'product_dir': '<(PRODUCT_DIR)/ClearKeyCdm',
'type': 'none',
# Check whether the plugin's origin URL is valid.
'defines': ['CHECK_DOCUMENT_URL'],
@@ -134,9 +136,14 @@
'libraries': [
'-lrt',
# Built by clearkeycdm.
- '<(PRODUCT_DIR)/libclearkeycdm.so',
+ '<(PRODUCT_DIR)/ClearKeyCdm/libclearkeycdm.so',
],
}],
+ ['OS == "mac"', {
+ 'xcode_settings': {
+ 'LD_RUNPATH_SEARCH_PATHS' : [ '@loader_path/.' ],
+ },
+ }]
],
},
],
diff --git a/third_party/widevine/cdm/BUILD.gn b/third_party/widevine/cdm/BUILD.gn
index e2093a58..050f78c2 100644
--- a/third_party/widevine/cdm/BUILD.gn
+++ b/third_party/widevine/cdm/BUILD.gn
@@ -67,7 +67,7 @@
copy("widevinecdm") {
sources = widevine_cdm_binary_files
outputs = [
- "$root_out_dir/{{source_file_part}}",
+ "$root_out_dir/WidevineCdm/{{source_file_part}}",
]
# TODO(jrummell)
@@ -77,6 +77,7 @@
assert(!is_chrome_branded, "Branded Chrome should have binary files to copy.")
assert(!is_android, "Android should not have enable_pepper_cdms.")
shared_library("widevinecdm") {
+ output_dir = "$root_out_dir/WidevineCdm"
sources = [
"//media/cdm/stub/stub_cdm.cc",
"//media/cdm/stub/stub_cdm.h",
@@ -124,6 +125,7 @@
ppapi_cdm_adapter("widevinecdmadapter") {
defines = []
+ output_dir = "$root_out_dir/WidevineCdm"
deps = [
":version_h",
":widevinecdm",
@@ -131,14 +133,14 @@
]
if (is_linux) {
- ldflags =
- [ rebase_path("$root_out_dir/libwidevinecdm.so", root_build_dir) ]
+ ldflags = [ rebase_path("$root_out_dir/WidevineCdm/libwidevinecdm.so",
+ root_build_dir) ]
} else if (is_win) {
- ldflags =
- [ rebase_path("$root_out_dir/widevinecdm.dll.lib", root_build_dir) ]
+ ldflags = [ rebase_path("$root_out_dir/WidevineCdm/widevinecdm.dll.lib",
+ root_build_dir) ]
} else if (is_mac) {
- ldflags =
- [ rebase_path("$root_out_dir/libwidevinecdm.dylib", root_build_dir) ]
+ ldflags = [ rebase_path("$root_out_dir/WidevineCdm/libwidevinecdm.dylib",
+ root_build_dir) ]
}
}
} else {
diff --git a/third_party/widevine/cdm/widevine_cdm.gyp b/third_party/widevine/cdm/widevine_cdm.gyp
index 97a416518b..beb971c 100644
--- a/third_party/widevine/cdm/widevine_cdm.gyp
+++ b/third_party/widevine/cdm/widevine_cdm.gyp
@@ -10,6 +10,7 @@
},
'enable_widevine%': '<(enable_widevine)',
'widevine_cdm_version_h_file%': 'widevine_cdm_version.h',
+ # TODO(xhwang): Also include manifest.json.
'widevine_cdm_binary_files%': [],
'conditions': [
[ 'branding == "Chrome"', {
@@ -86,6 +87,7 @@
{
# GN version: //third_party/widevine/cdm:widevinecdmadapter
'target_name': 'widevinecdmadapter',
+ 'product_dir': '<(PRODUCT_DIR)/WidevineCdm',
'type': 'none',
'conditions': [
[ '(branding == "Chrome" or enable_widevine == 1) and enable_pepper_cdms == 1', {
@@ -104,19 +106,19 @@
'libraries': [
'-lrt',
# Copied/created by widevinecdm.
- '<(PRODUCT_DIR)/libwidevinecdm.so',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.so',
],
}],
[ 'OS == "win"', {
'libraries': [
# Copied/created by widevinecdm.
- '<(PRODUCT_DIR)/widevinecdm.dll.lib',
+ '<(PRODUCT_DIR)/WidevineCdm/widevinecdm.dll.lib',
],
}],
[ 'OS == "mac"', {
'libraries': [
# Copied/created by widevinecdm.
- '<(PRODUCT_DIR)/libwidevinecdm.dylib',
+ '<(PRODUCT_DIR)/WidevineCdm/libwidevinecdm.dylib',
],
}],
],
@@ -146,17 +148,16 @@
}],
],
'copies': [{
- # TODO(ddorwin): Do we need a sub-directory? We either need a
- # sub-directory or to rename manifest.json before we can copy it.
- 'destination': '<(PRODUCT_DIR)',
+ 'destination': '<(PRODUCT_DIR)/WidevineCdm',
'files': [ '<@(widevine_cdm_binary_files)' ],
}],
}],
[ 'branding != "Chrome" and enable_widevine == 1', {
+ 'product_dir': '<(PRODUCT_DIR)/WidevineCdm',
'conditions': [
['os_posix == 1 and OS != "mac"', {
'type': 'loadable_module',
- # Note that this causes the binary to be put in PRODUCT_DIR
+ # This causes the binary to be put in <(PRODUCT_DIR)/WidevineCdm
# instead of lib/. This matches what happens in the copy step
# above.
}],
diff --git a/third_party/widevine/cdm/widevine_cdm_common.h b/third_party/widevine/cdm/widevine_cdm_common.h
index b5e51939..0dafb1e 100644
--- a/third_party/widevine/cdm/widevine_cdm_common.h
+++ b/third_party/widevine/cdm/widevine_cdm_common.h
@@ -16,6 +16,9 @@
// This type is used to register the Widevine CDM.
const char kWidevineCdmType[] = "Widevine";
+// Widevine CDM files are in a directory with this name.
+const char kWidevineCdmBaseDirectory[] = "WidevineCdm";
+
// This name is used by UMA. Do not change it!
const char kWidevineKeySystemNameForUMA[] = "Widevine";