Skip to content

Commit

Permalink
build: [gyp] cdm key system support behind flag (electron#671)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepak1556 authored and alexeykuzmin committed Sep 4, 2018
1 parent a664c70 commit 65e44d0
Show file tree
Hide file tree
Showing 6 changed files with 68 additions and 4 deletions.
26 changes: 23 additions & 3 deletions chromiumcontent/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import("//build/config/c++/c++.gni")
import("//build/config/features.gni")
import("//build/split_static_library.gni")
import("//libchromiumcontent/chromiumcontent/config/features.gni")
import("//third_party/widevine/cdm/widevine.gni")

group("targets") {
deps = []
Expand All @@ -11,7 +12,6 @@ group("targets") {
if (is_electron_build) {
deps += [
"//components/prefs",
"//components/cdm/renderer",
"//components/cookie_config",
"//components/security_state/content",
"//components/security_state/core",
Expand All @@ -28,8 +28,6 @@ group("targets") {
"//net:net_with_v8",
"//third_party/libyuv",
"//third_party/webrtc/modules/desktop_capture",
"//third_party/widevine/cdm:headers",
"//third_party/widevine/cdm:widevinecdmadapter",
"//tools/v8_context_snapshot",
"//ui/content_accelerators",
"//ui/display",
Expand All @@ -47,6 +45,10 @@ group("targets") {
deps += [ ":pepper_flash" ]
}

if (enable_widevine) {
deps += [ ":cdm_support" ]
}

if (is_component_build) {
deps += [
":desktop_capture",
Expand Down Expand Up @@ -486,3 +488,21 @@ component("pepper_flash") {
]
}
}

static_library("cdm_support") {
sources = [
"//chrome/common/widevine_cdm_constants.cc",
"//chrome/common/widevine_cdm_constants.h",
"//chrome/renderer/media/chrome_key_systems.cc",
"//chrome/renderer/media/chrome_key_systems.h",
"//chrome/renderer/media/chrome_key_systems_provider.cc",
"//chrome/renderer/media/chrome_key_systems_provider.h",
]
public_deps = [
"//media",
]
deps = [
"//components/cdm/renderer",
"//third_party/widevine/cdm:headers",
]
}
1 change: 1 addition & 0 deletions chromiumcontent/args/shared_library.gn
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ symbol_level = 2
use_allocator = "none" # on Linux this defaults to "tcmalloc", but tcmalloc deadlocks when Electron CI tests are run inside Docker
enable_nacl = false
enable_widevine = true
enable_cdm_host_verification = false
proprietary_codecs = true
is_component_ffmpeg = true
ffmpeg_branding = "Chrome"
Expand Down
1 change: 1 addition & 0 deletions chromiumcontent/args/static_library.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ is_official_build = true
symbol_level = 2
enable_nacl = false
enable_widevine = true
enable_cdm_host_verification = false
proprietary_codecs = true
is_component_ffmpeg = true
ffmpeg_branding = "Chrome"
Expand Down
6 changes: 6 additions & 0 deletions patches/common/chromium/.patches.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -442,3 +442,9 @@ patches:
description: |
Re-enable GPU acceleration for recent VMWare drivers.
Backports https://chromium-review.googlesource.com/952778
-
author: deepak1556 <hop2deep@gmail.com>
file: chrome_key_systems.patch
description: |
Disable persiste licence support check for widevine cdm,
as its not supported in the current version of chrome.
29 changes: 29 additions & 0 deletions patches/common/chromium/chrome_key_systems.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/chrome/renderer/media/chrome_key_systems.cc b/chrome/renderer/media/chrome_key_systems.cc
index f3033337199b..856bc8f0b143 100644
--- a/chrome/renderer/media/chrome_key_systems.cc
+++ b/chrome/renderer/media/chrome_key_systems.cc
@@ -14,7 +14,9 @@
#include "base/strings/string_split.h"
#include "base/strings/utf_string_conversions.h"
#include "build/build_config.h"
+#if 0
#include "chrome/renderer/chrome_render_thread_observer.h"
+#endif
#include "components/cdm/renderer/external_clear_key_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "content/public/renderer/render_thread.h"
@@ -140,12 +142,14 @@ static void AddExternalClearKey(
#if defined(WIDEVINE_CDM_AVAILABLE)
// Returns persistent-license session support.
EmeSessionTypeSupport GetPersistentLicenseSupport(bool supported_by_the_cdm) {
+#if 0
// Do not support persistent-license if the process cannot persist data.
// TODO(crbug.com/457487): Have a better plan on this. See bug for details.
if (ChromeRenderThreadObserver::is_incognito_process()) {
DVLOG(2) << __func__ << ": Not supported in incognito process.";
return EmeSessionTypeSupport::NOT_SUPPORTED;
}
+#endif

if (!supported_by_the_cdm) {
DVLOG(2) << __func__ << ": Not supported by the CDM.";
9 changes: 8 additions & 1 deletion script/create-dist
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ INCLUDE_DIRS = [
'cc',
'chrome/browser/renderer_host/pepper',
'chrome/browser/ui/libgtkui',
'chrome/common',
'chrome/renderer/media',
'chrome/renderer/pepper',
'components/cdm',
'components/component_updater',
Expand Down Expand Up @@ -582,6 +584,12 @@ def copy_generated_sources(target_arch, component, ninja):
relative_to=os.path.join(output_dir, 'gen'),
destination=os.path.join(target_dir, 'gen'),
ninja=ninja)
if component == 'static_library' or component == 'shared_library':
# Copy widevine cdm generated header.
copy_source_file(os.path.join(output_dir, 'gen', 'widevine_cdm_version.h'),
relative_to=os.path.join(output_dir, 'gen'),
destination=os.path.join(target_dir, 'gen'),
ninja=ninja)

def copy_locales(target_arch, component, ninja):
output_dir = get_output_dir(SOURCE_ROOT, target_arch, component)
Expand Down Expand Up @@ -626,7 +634,6 @@ def copy_headers(relative_path, relative_to, destination, ninja):
continue
copy_source_file(os.path.join(dirpath, filename), relative_to=relative_to, destination=destination, ninja=ninja)


def copy_source_file(absolute_path, relative_to, destination, ninja):
relative_path = os.path.relpath(absolute_path, start=relative_to)
final_path = os.path.join(destination, relative_path)
Expand Down

0 comments on commit 65e44d0

Please sign in to comment.