Commit 002af4fc authored by Yuchen Liu's avatar Yuchen Liu Committed by Commit Bot

[Fuchsia][EME] Enable Widevine

1. Turn on flag 'enable_widevine' and
'ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION'.

2. Add widevine key system config.

Bug: 991723
Test: Shaka player demo "Dig the Uke".
Change-Id: I49a7661fb4b8b5732b597622f9d496ea611dc9ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1783802
Commit-Queue: Yuchen Liu <yucliu@chromium.org>
Reviewed-by: default avatarSergey Ulanov <sergeyu@chromium.org>
Reviewed-by: default avatarXiaohan Wang <xhwang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#694945}
parent 601f3149
...@@ -1994,7 +1994,7 @@ jumbo_source_set("browser") { ...@@ -1994,7 +1994,7 @@ jumbo_source_set("browser") {
] ]
} }
if (is_chromeos || is_android || is_chromecast) { if (is_chromeos || is_android || is_chromecast || is_fuchsia) {
defines += [ "ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION" ] defines += [ "ENABLE_PROTECTED_MEDIA_IDENTIFIER_PERMISSION" ]
} }
......
...@@ -67,6 +67,7 @@ component("web_engine_core") { ...@@ -67,6 +67,7 @@ component("web_engine_core") {
":web_engine_pak", ":web_engine_pak",
"//base", "//base",
"//base:base_static", "//base:base_static",
"//components/cdm/renderer",
"//components/version_info", "//components/version_info",
"//content/public/app:both", "//content/public/app:both",
"//content/public/browser", "//content/public/browser",
......
include_rules = [ include_rules = [
"+components/cdm/renderer",
"+content/public/renderer", "+content/public/renderer",
"+media",
"+mojo/public/cpp/bindings", "+mojo/public/cpp/bindings",
"+services/service_manager/public/cpp", "+services/service_manager/public/cpp",
"+third_party/blink/public/common/associated_interfaces", "+third_party/blink/public/common/associated_interfaces",
"+third_party/widevine/cdm/widevine_cdm_common.h",
] ]
...@@ -5,10 +5,13 @@ ...@@ -5,10 +5,13 @@
#include "fuchsia/engine/renderer/web_engine_content_renderer_client.h" #include "fuchsia/engine/renderer/web_engine_content_renderer_client.h"
#include "base/macros.h" #include "base/macros.h"
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "content/public/renderer/render_frame.h" #include "content/public/renderer/render_frame.h"
#include "fuchsia/engine/renderer/on_load_script_injector.h" #include "fuchsia/engine/renderer/on_load_script_injector.h"
#include "media/base/eme_constants.h"
#include "services/service_manager/public/cpp/binder_registry.h" #include "services/service_manager/public/cpp/binder_registry.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h"
WebEngineContentRendererClient::WebEngineContentRendererClient() = default; WebEngineContentRendererClient::WebEngineContentRendererClient() = default;
...@@ -20,3 +23,31 @@ void WebEngineContentRendererClient::RenderFrameCreated( ...@@ -20,3 +23,31 @@ void WebEngineContentRendererClient::RenderFrameCreated(
// The objects' lifetimes are bound to the RenderFrame's lifetime. // The objects' lifetimes are bound to the RenderFrame's lifetime.
new OnLoadScriptInjector(render_frame); new OnLoadScriptInjector(render_frame);
} }
void WebEngineContentRendererClient::AddSupportedKeySystems(
std::vector<std::unique_ptr<media::KeySystemProperties>>* key_systems) {
// TODO(yucliu): Check if Widevine is enabled from command line/context
// feature flags.
// TODO(yucliu): Check supported hw video decoders.
media::SupportedCodecs supported_video_codecs = media::EME_CODEC_NONE;
base::flat_set<media::EncryptionMode> encryption_schemes{
media::EncryptionMode::kCenc, media::EncryptionMode::kCbcs};
// Fuchsia always decrypts audio into clear buffers and return them back to
// Chromium. Hardware secured decoders are only available for supported
// video codecs.
key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
media::EME_CODEC_AUDIO_ALL | supported_video_codecs, // codecs
encryption_schemes, // encryption schemes
supported_video_codecs, // hw secure codecs
encryption_schemes, // hw secure encryption schemes
cdm::WidevineKeySystemProperties::Robustness::
HW_SECURE_CRYPTO, // max audio robustness
cdm::WidevineKeySystemProperties::Robustness::
HW_SECURE_ALL, // max video robustness
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent license
media::EmeSessionTypeSupport::NOT_SUPPORTED, // persistent usage record
media::EmeFeatureSupport::ALWAYS_ENABLED, // persistent state
media::EmeFeatureSupport::ALWAYS_ENABLED)); // distinctive identifier
}
...@@ -15,6 +15,9 @@ class WebEngineContentRendererClient : public content::ContentRendererClient { ...@@ -15,6 +15,9 @@ class WebEngineContentRendererClient : public content::ContentRendererClient {
// content::ContentRendererClient overrides. // content::ContentRendererClient overrides.
void RenderFrameCreated(content::RenderFrame* render_frame) override; void RenderFrameCreated(content::RenderFrame* render_frame) override;
void AddSupportedKeySystems(
std::vector<std::unique_ptr<media::KeySystemProperties>>* key_systems)
override;
private: private:
DISALLOW_COPY_AND_ASSIGN(WebEngineContentRendererClient); DISALLOW_COPY_AND_ASSIGN(WebEngineContentRendererClient);
......
...@@ -6,11 +6,11 @@ import("//build/config/chrome_build.gni") ...@@ -6,11 +6,11 @@ import("//build/config/chrome_build.gni")
import("//media/media_options.gni") import("//media/media_options.gni")
declare_args() { declare_args() {
# Enables Widevine key system support. Enabled by default in Google Chrome and # Enables Widevine key system support. Enabled by default in Google Chrome,
# on Android. # on Android and Fuchsia platforms.
# Can be optionally enabled in Chromium on non-Android platforms. Please see # Can be optionally enabled in Chromium on non-Android platforms. Please see
# //src/third_party/widevine/LICENSE file for details. # //src/third_party/widevine/LICENSE file for details.
enable_widevine = is_chrome_branded || is_android enable_widevine = is_chrome_branded || is_android || is_fuchsia
} }
# Widevine CDM is available as a library CDM on the following platforms and # Widevine CDM is available as a library CDM on the following platforms and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment