Commit ebbe2bf6 authored by Stephen Lanham's avatar Stephen Lanham Committed by Commit Bot

[Chromecast] Remove PLAYREADY_CDM_AVAILABLE in favor of BUILDFLAG().

This #define has been error-prone in the past and now no longer matches
the Widevine convention after which it was modeled. Convert to use the
much-safer BUILDFLAG() macro. Update use_playready to enable_playready
to match the Chromium GN conventions.

BUG=

Test: Cast CQ
Change-Id: I5ac8a238051a6208d2960ee7ce957099b396e45a
Reviewed-on: https://chromium-review.googlesource.com/c/1284065Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Commit-Queue: Stephen Lanham <slan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600154}
parent 83cf7afa
...@@ -22,12 +22,6 @@ declare_args() { ...@@ -22,12 +22,6 @@ declare_args() {
cast_test_extra_flags = "" cast_test_extra_flags = ""
} }
config("playready_config") {
if (use_playready) {
defines = [ "PLAYREADY_CDM_AVAILABLE" ]
}
}
# Depends on all non-test targets that should be built by the Chromecast # Depends on all non-test targets that should be built by the Chromecast
# internal build infrastructure. # internal build infrastructure.
group("all") { group("all") {
...@@ -577,22 +571,23 @@ group("chromecast_locales_pak") { ...@@ -577,22 +571,23 @@ group("chromecast_locales_pak") {
buildflag_header("chromecast_buildflags") { buildflag_header("chromecast_buildflags") {
header = "chromecast_buildflags.h" header = "chromecast_buildflags.h"
flags = [ flags = [
"DEFAULT_COMMAND_LINE_FLAGS=\"$default_command_line_flags\"",
"DISABLE_SECURE_FLAC_OPUS_DECODING=$disable_secure_flac_and_opus_decoding",
"ENABLE_ASSISTANT=$enable_assistant", "ENABLE_ASSISTANT=$enable_assistant",
"ENABLE_CAST_FRAGMENT=$enable_cast_fragment",
"ENABLE_CHROMECAST_EXTENSIONS=$enable_chromecast_extensions",
"ENABLE_HEADLESS_MUSIC_MODE=$enable_headless_music_mode",
"ENABLE_PLAYREADY=$enable_playready",
"ENABLE_VOLUME_TABLES_ACCESS=$enable_volume_tables_access", "ENABLE_VOLUME_TABLES_ACCESS=$enable_volume_tables_access",
"IS_ANDROID_THINGS=$is_android_things", "IS_ANDROID_THINGS=$is_android_things",
"IS_ANDROID_THINGS_NON_PUBLIC=$is_android_things_non_public",
"IS_CAST_AUDIO_ONLY=$is_cast_audio_only", "IS_CAST_AUDIO_ONLY=$is_cast_audio_only",
"IS_CAST_DESKTOP_BUILD=$is_cast_desktop_build", "IS_CAST_DESKTOP_BUILD=$is_cast_desktop_build",
"IS_CAST_USING_CMA_BACKEND=$is_cast_using_cma_backend", "IS_CAST_USING_CMA_BACKEND=$is_cast_using_cma_backend",
"SUPPORTS_MULTIZONE=$supports_multizone",
"ENABLE_HEADLESS_MUSIC_MODE=$enable_headless_music_mode",
"ENABLE_CHROMECAST_EXTENSIONS=$enable_chromecast_extensions",
"ENABLE_CAST_FRAGMENT=$enable_cast_fragment",
"IS_ANDROID_THINGS_NON_PUBLIC=$is_android_things_non_public",
"IS_SINGLE_VOLUME=$is_single_volume", "IS_SINGLE_VOLUME=$is_single_volume",
"SUPPORTS_MULTIZONE=$supports_multizone",
"USE_ANDROID_USER_AGENT=$use_android_user_agent", "USE_ANDROID_USER_AGENT=$use_android_user_agent",
"USE_CHROMECAST_CDMS=$use_chromecast_cdms", "USE_CHROMECAST_CDMS=$use_chromecast_cdms",
"DEFAULT_COMMAND_LINE_FLAGS=\"$default_command_line_flags\"",
"DISABLE_SECURE_FLAC_OPUS_DECODING=$disable_secure_flac_and_opus_decoding",
] ]
} }
......
...@@ -109,7 +109,7 @@ declare_args() { ...@@ -109,7 +109,7 @@ declare_args() {
declare_args() { declare_args() {
# Use Playready CDMs for internal non-desktop builds. # Use Playready CDMs for internal non-desktop builds.
use_playready = !is_cast_desktop_build && chromecast_branding != "public" enable_playready = !is_cast_desktop_build && chromecast_branding != "public"
} }
# This is the release version, which takes the form <major>.<minor>. Internal # This is the release version, which takes the form <major>.<minor>. Internal
......
...@@ -13,14 +13,11 @@ cast_source_set("media") { ...@@ -13,14 +13,11 @@ cast_source_set("media") {
] ]
deps = [ deps = [
"//base", "//base",
"//chromecast:chromecast_buildflags",
"//chromecast/media", "//chromecast/media",
"//chromecast/media/cdm", "//chromecast/media/cdm",
"//components/cdm/common", "//components/cdm/common",
"//media", "//media",
] ]
} }
if (use_playready) {
public_configs = [ "//chromecast:playready_config" ]
}
} }
...@@ -15,18 +15,18 @@ CastMediaDrmBridgeClient::~CastMediaDrmBridgeClient() {} ...@@ -15,18 +15,18 @@ CastMediaDrmBridgeClient::~CastMediaDrmBridgeClient() {}
void CastMediaDrmBridgeClient::AddKeySystemUUIDMappings(KeySystemUuidMap* map) { void CastMediaDrmBridgeClient::AddKeySystemUUIDMappings(KeySystemUuidMap* map) {
// Note: MediaDrmBridge adds the Widevine UUID mapping automatically. // Note: MediaDrmBridge adds the Widevine UUID mapping automatically.
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
(*map)[kChromecastPlayreadyKeySystem] = playready_delegate_.GetUUID(); (*map)[kChromecastPlayreadyKeySystem] = playready_delegate_.GetUUID();
#endif #endif // BUILDFLAG(ENABLE_PLAYREADY)
} }
::media::MediaDrmBridgeDelegate* ::media::MediaDrmBridgeDelegate*
CastMediaDrmBridgeClient::GetMediaDrmBridgeDelegate( CastMediaDrmBridgeClient::GetMediaDrmBridgeDelegate(
const ::media::UUID& scheme_uuid) { const ::media::UUID& scheme_uuid) {
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
if (scheme_uuid == playready_delegate_.GetUUID()) if (scheme_uuid == playready_delegate_.GetUUID())
return &playready_delegate_; return &playready_delegate_;
#endif #endif // BUILDFLAG(ENABLE_PLAYREADY)
if (scheme_uuid == widevine_delegate_.GetUUID()) if (scheme_uuid == widevine_delegate_.GetUUID())
return &widevine_delegate_; return &widevine_delegate_;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#include <map> #include <map>
#include "base/macros.h" #include "base/macros.h"
#include "chromecast/chromecast_buildflags.h"
#include "chromecast/media/cdm/playready_drm_delegate_android.h" #include "chromecast/media/cdm/playready_drm_delegate_android.h"
#include "components/cdm/common/widevine_drm_delegate_android.h" #include "components/cdm/common/widevine_drm_delegate_android.h"
#include "media/base/android/media_drm_bridge_client.h" #include "media/base/android/media_drm_bridge_client.h"
...@@ -26,9 +27,9 @@ class CastMediaDrmBridgeClient : public ::media::MediaDrmBridgeClient { ...@@ -26,9 +27,9 @@ class CastMediaDrmBridgeClient : public ::media::MediaDrmBridgeClient {
::media::MediaDrmBridgeDelegate* GetMediaDrmBridgeDelegate( ::media::MediaDrmBridgeDelegate* GetMediaDrmBridgeDelegate(
const ::media::UUID& scheme_uuid) override; const ::media::UUID& scheme_uuid) override;
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
PlayreadyDrmDelegateAndroid playready_delegate_; PlayreadyDrmDelegateAndroid playready_delegate_;
#endif #endif // BUILDFLAG(ENABLE_PLAYREADY)
cdm::WidevineDrmDelegateAndroid widevine_delegate_; cdm::WidevineDrmDelegateAndroid widevine_delegate_;
......
...@@ -11,12 +11,9 @@ cast_source_set("key_systems") { ...@@ -11,12 +11,9 @@ cast_source_set("key_systems") {
"key_systems_common.h", "key_systems_common.h",
] ]
if (use_playready) {
public_configs = [ "//chromecast:playready_config" ]
}
deps = [ deps = [
"//base", "//base",
"//chromecast:chromecast_buildflags",
"//chromecast/public/media", "//chromecast/public/media",
"//media", "//media",
"//third_party/widevine/cdm:buildflags", "//third_party/widevine/cdm:buildflags",
......
...@@ -16,9 +16,9 @@ ...@@ -16,9 +16,9 @@
namespace chromecast { namespace chromecast {
namespace media { namespace media {
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
const char kChromecastPlayreadyKeySystem[] = "com.chromecast.playready"; const char kChromecastPlayreadyKeySystem[] = "com.chromecast.playready";
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
CastKeySystem GetKeySystemByName(const std::string& key_system_name) { CastKeySystem GetKeySystemByName(const std::string& key_system_name) {
#if BUILDFLAG(ENABLE_WIDEVINE) #if BUILDFLAG(ENABLE_WIDEVINE)
...@@ -27,11 +27,11 @@ CastKeySystem GetKeySystemByName(const std::string& key_system_name) { ...@@ -27,11 +27,11 @@ CastKeySystem GetKeySystemByName(const std::string& key_system_name) {
} }
#endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_WIDEVINE)
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
if (key_system_name.compare(kChromecastPlayreadyKeySystem) == 0) { if (key_system_name.compare(kChromecastPlayreadyKeySystem) == 0) {
return KEY_SYSTEM_PLAYREADY; return KEY_SYSTEM_PLAYREADY;
} }
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
if (::media::IsClearKey(key_system_name)) { if (::media::IsClearKey(key_system_name)) {
return KEY_SYSTEM_CLEAR_KEY; return KEY_SYSTEM_CLEAR_KEY;
......
...@@ -7,14 +7,15 @@ ...@@ -7,14 +7,15 @@
#include <string> #include <string>
#include "chromecast/chromecast_buildflags.h"
#include "chromecast/public/media/cast_key_system.h" #include "chromecast/public/media/cast_key_system.h"
namespace chromecast { namespace chromecast {
namespace media { namespace media {
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
extern const char kChromecastPlayreadyKeySystem[]; extern const char kChromecastPlayreadyKeySystem[];
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
// Translates a key system string into a CastKeySystem, calling into the // Translates a key system string into a CastKeySystem, calling into the
// platform for known key systems if needed. // platform for known key systems if needed.
......
...@@ -34,7 +34,7 @@ cast_source_set("cdm") { ...@@ -34,7 +34,7 @@ cast_source_set("cdm") {
] ]
} }
if (is_android && use_playready) { if (is_android && enable_playready) {
sources += [ sources += [
"playready_drm_delegate_android.cc", "playready_drm_delegate_android.cc",
"playready_drm_delegate_android.h", "playready_drm_delegate_android.h",
......
...@@ -40,10 +40,6 @@ cast_source_set("renderer") { ...@@ -40,10 +40,6 @@ cast_source_set("renderer") {
sources += [ "cast_content_renderer_client_simple.cc" ] sources += [ "cast_content_renderer_client_simple.cc" ]
} }
if (use_playready) {
configs += [ "//chromecast:playready_config" ]
}
deps = [ deps = [
"//base", "//base",
"//chromecast:chromecast_buildflags", "//chromecast:chromecast_buildflags",
......
...@@ -32,7 +32,7 @@ namespace chromecast { ...@@ -32,7 +32,7 @@ namespace chromecast {
namespace media { namespace media {
namespace { namespace {
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { class PlayReadyKeySystemProperties : public ::media::KeySystemProperties {
public: public:
PlayReadyKeySystemProperties(SupportedCodecs supported_non_secure_codecs, PlayReadyKeySystemProperties(SupportedCodecs supported_non_secure_codecs,
...@@ -108,7 +108,7 @@ class PlayReadyKeySystemProperties : public ::media::KeySystemProperties { ...@@ -108,7 +108,7 @@ class PlayReadyKeySystemProperties : public ::media::KeySystemProperties {
#endif // defined(OS_ANDROID) #endif // defined(OS_ANDROID)
const bool persistent_license_support_; const bool persistent_license_support_;
}; };
#endif // PLAYREADY_CDM_AVAILABLE #endif // BUILDFLAG(ENABLE_PLAYREADY)
#if BUILDFLAG(IS_CAST_USING_CMA_BACKEND) #if BUILDFLAG(IS_CAST_USING_CMA_BACKEND)
SupportedCodecs GetCastEmeSupportedCodecs() { SupportedCodecs GetCastEmeSupportedCodecs() {
...@@ -152,10 +152,10 @@ void AddCmaKeySystems( ...@@ -152,10 +152,10 @@ void AddCmaKeySystems(
// |codecs| may not be used if Widevine and Playready aren't supported. // |codecs| may not be used if Widevine and Playready aren't supported.
ANALYZER_ALLOW_UNUSED(codecs); ANALYZER_ALLOW_UNUSED(codecs);
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
key_systems_properties->emplace_back(new PlayReadyKeySystemProperties( key_systems_properties->emplace_back(new PlayReadyKeySystemProperties(
codecs, codecs, enable_persistent_license_support)); codecs, codecs, enable_persistent_license_support));
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
#if BUILDFLAG(ENABLE_WIDEVINE) #if BUILDFLAG(ENABLE_WIDEVINE)
using Robustness = cdm::WidevineKeySystemProperties::Robustness; using Robustness = cdm::WidevineKeySystemProperties::Robustness;
...@@ -178,7 +178,7 @@ void AddCmaKeySystems( ...@@ -178,7 +178,7 @@ void AddCmaKeySystems(
#endif // BUILDFLAG(ENABLE_WIDEVINE) #endif // BUILDFLAG(ENABLE_WIDEVINE)
} }
#elif defined(OS_ANDROID) #elif defined(OS_ANDROID)
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
void AddCastPlayreadyKeySystemAndroid( void AddCastPlayreadyKeySystemAndroid(
std::vector<std::unique_ptr<::media::KeySystemProperties>>* std::vector<std::unique_ptr<::media::KeySystemProperties>>*
key_systems_properties) { key_systems_properties) {
...@@ -193,14 +193,14 @@ void AddCastPlayreadyKeySystemAndroid( ...@@ -193,14 +193,14 @@ void AddCastPlayreadyKeySystemAndroid(
response.non_secure_codecs, response.secure_codecs, response.non_secure_codecs, response.secure_codecs,
false /* persistent_license_support */)); false /* persistent_license_support */));
} }
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
void AddCastAndroidKeySystems( void AddCastAndroidKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>* std::vector<std::unique_ptr<::media::KeySystemProperties>>*
key_systems_properties) { key_systems_properties) {
#if defined(PLAYREADY_CDM_AVAILABLE) #if BUILDFLAG(ENABLE_PLAYREADY)
AddCastPlayreadyKeySystemAndroid(key_systems_properties); AddCastPlayreadyKeySystemAndroid(key_systems_properties);
#endif // defined(PLAYREADY_CDM_AVAILABLE) #endif // BUILDFLAG(ENABLE_PLAYREADY)
#if BUILDFLAG(ENABLE_WIDEVINE) #if BUILDFLAG(ENABLE_WIDEVINE)
cdm::AddAndroidWidevine(key_systems_properties); cdm::AddAndroidWidevine(key_systems_properties);
......
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