Skip to content

Commit

Permalink
Move CDMs into platform specific paths on Linux
Browse files Browse the repository at this point in the history
Rather than including the CDMs in the base install directory, move them
into subdirectories (e.g. Widevine would be located in
<installdir>/WidevineCdm/_platform_specific/linux_x64/libwidevinecdm.so).
This allows the LICENSE and manifest.json file to be bundled with Chrome
on Linux. Future CL's will use the manifest.json file to determine
the capabilities of the CDM (rather than having them hardcoded as they
are today).

In addition to the unittests below, ran EME browser_tests (both ECK
and Widevine) to check that the library can be loaded from it's new
directory, and built "installer" (although I don't know if whatever
package it creates is installable).

Bug: 971433
Test: CdmPath media_unittests pass
Change-Id: If87f97e3200341941438ccbcbb4a918b1e5d0b50
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1767596
Reviewed-by: Nico Weber <thakis@chromium.org>
Reviewed-by: Michael Moss <mmoss@chromium.org>
Reviewed-by: Xiaohan Wang <xhwang@chromium.org>
Commit-Queue: John Rummell <jrummell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691797}
  • Loading branch information
jrummell-chromium authored and Commit Bot committed Aug 29, 2019
1 parent d4d2481 commit 90c6eb5
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 13 deletions.
6 changes: 4 additions & 2 deletions chrome/installer/linux/common/installer.include
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ stage_install_common() {
fi

# Widevine CDM.
if [ -f "${BUILDDIR}/libwidevinecdm.so" ]; then
if [ -f "${BUILDDIR}/WidevineCdm" ]; then
# No need to strip; libwidevinecdm.so starts out stripped.
install -m ${SHLIB_PERMS} "${BUILDDIR}/libwidevinecdm.so" "${STAGEDIR}/${INSTALLDIR}/"
cp -a "${BUILDDIR}/WidevineCdm" "${STAGEDIR}/${INSTALLDIR}/"
find "${STAGEDIR}/${INSTALLDIR}/WidevineCdm" -type d -exec chmod 755 '{}' \;
find "${STAGEDIR}/${INSTALLDIR}/WidevineCdm" -type f -exec chmod 644 '{}' \;
fi

# ANGLE
Expand Down
7 changes: 3 additions & 4 deletions chrome/tools/build/linux/FILES.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,13 @@ FILES = [
'filename': 'xdg-settings',
'buildtype': ['dev', 'official'],
},
# CDM files (each has an adapter and the actual CDM):
# CDM files (actual CDM + optional manifest):
{
'filename': 'libclearkeycdm.so',
'filename': 'ClearKeyCdm',
'buildtype': ['dev', 'official'],
},
{
'filename': 'libwidevinecdm.so',
'arch': ['64bit'],
'filename': 'WidevineCdm',
'buildtype': ['official'],
'direct_archive': 1,
},
Expand Down
7 changes: 5 additions & 2 deletions media/cdm/cdm_paths_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#include "media/media_buildflags.h"
#include "testing/gtest/include/gtest/gtest.h"

// Only verify platform specific path where CDMs are Chrome components.
#if (defined(OS_MACOSX) || defined(OS_WIN)) && \
// Only verify platform specific path on some platforms.
// TODO(crbug.com/971433). Move the CDMs out of the install directory on
// ChromeOS.
#if (defined(OS_MACOSX) || defined(OS_WIN) || \
(defined(OS_LINUX) && !defined(OS_CHROMEOS))) && \
(defined(ARCH_CPU_X86) || defined(ARCH_CPU_X86_64))
#define CDM_USE_PLATFORM_SPECIFIC_PATH
#endif
Expand Down
9 changes: 6 additions & 3 deletions media/cdm/library_cdm/cdm_paths.gni
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,12 @@ if (current_cpu == "x86" || current_cpu == "x64" || current_cpu == "arm") {
component_arch = "unsupported_arch"
}

# Only enable platform specific path where CDMs are Chrome components.
# Note: |cdm_platform_specific_path| is exported as a BUILDFLAG to cdm_paths.cc.
if ((is_win || is_mac) && (current_cpu == "x86" || current_cpu == "x64")) {
# Enable platform specific paths. This is required when the CDMs are Chrome
# components, but is optional for other platforms.
# Note: |cdm_platform_specific_path| is exported as a BUILDFLAG to
# cdm_paths.cc.
if ((is_win || is_mac || is_desktop_linux) &&
(current_cpu == "x86" || current_cpu == "x64")) {
cdm_platform_specific_path =
"_platform_specific/$component_os" + "_" + "$component_arch"

Expand Down
6 changes: 6 additions & 0 deletions third_party/widevine/cdm/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ if (bundle_widevine_cdm) {
} else if (is_desktop_linux) {
widevine_cdm_version_h_file = "linux/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [ "linux/$widevine_arch/libwidevinecdm.so" ]
widevine_cdm_manifest_and_license_files = [
"linux/$widevine_arch/manifest.json",
"../LICENSE",
]
} else if (is_win) {
widevine_cdm_version_h_file = "win/$widevine_arch/widevine_cdm_version.h"
widevine_cdm_binary_files = [ "win/$widevine_arch/widevinecdm.dll" ]
Expand Down Expand Up @@ -102,6 +106,8 @@ if (widevine_cdm_manifest_and_license_files != []) {
]
}
} else {
assert(!enable_widevine_cdm_component,
"Widevine as a component requires a manifest.")
group("widevine_cdm_manifest_and_license") {
# NOP
}
Expand Down
4 changes: 2 additions & 2 deletions tools/bisect_repackage/bisect_repackage.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
'chromedriver',
'default_apps/',
'icudtl.dat',
'libclearkeycdm.so',
'libwidevinecdm.so',
'ClearKeyCdm/',
'WidevineCdm/',
'locales/',
'nacl_helper',
'nacl_helper_bootstrap',
Expand Down

0 comments on commit 90c6eb5

Please sign in to comment.