Skip to content

Commit

Permalink
media: Rename KeySystemProperties to KeySystemInfo - file renaming
Browse files Browse the repository at this point in the history
This CL renames just the files *key_system_properties* to
*key_system_info* as part of a greater effort to rename
KeySystemProperties to KeySystemInfo. This renaming effort is due to
KeySystemProperties being a plural noun, making it awkward and wordy to
create vectors and maps. Replacing it with a singular noun was our
(xhwang, jrummell, and vpasupathy) idea to simplify naming in Chromium.

Bug: b/241047837
Change-Id: I586241a639e0a2e414092bafb9251809aaaf01e4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3866335
Reviewed-by: Avi Drissman <avi@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Reviewed-by: Bo Liu <boliu@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: Robbie McElrath <rmcelrath@chromium.org>
Reviewed-by: Greg Thompson <grt@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1042645}
  • Loading branch information
gvking authored and Chromium LUCI CQ committed Sep 2, 2022
1 parent fcf24d6 commit d2e5386
Show file tree
Hide file tree
Showing 26 changed files with 152 additions and 158 deletions.
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ void AwContentRendererClient::RunScriptsAtDocumentStart(

void AwContentRendererClient::GetSupportedKeySystems(
media::GetSupportedKeySystemsCB cb) {
media::KeySystemPropertiesVector key_systems;
media::KeySystemInfoVector key_systems;
AwAddKeySystems(&key_systems);
std::move(cb).Run(std::move(key_systems));
}
Expand Down
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

namespace android_webview {

void AwAddKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>>*
void AwAddKeySystems(std::vector<std::unique_ptr<media::KeySystemInfo>>*
key_systems_properties) {
#if BUILDFLAG(ENABLE_WIDEVINE)
cdm::AddAndroidWidevine(key_systems_properties);
Expand Down
6 changes: 3 additions & 3 deletions android_webview/renderer/aw_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
#include <memory>
#include <vector>

#include "media/base/key_system_properties.h"
#include "media/base/key_system_info.h"

namespace android_webview {

void AwAddKeySystems(std::vector<std::unique_ptr<media::KeySystemProperties>>*
key_systems_properties);
void AwAddKeySystems(
std::vector<std::unique_ptr<media::KeySystemInfo>>* key_systems_properties);

} // namespace android_webview

Expand Down
24 changes: 12 additions & 12 deletions chrome/renderer/media/chrome_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@
#include "build/build_config.h"
#include "build/chromeos_buildflags.h"
#include "chrome/renderer/chrome_render_thread_observer.h"
#include "components/cdm/renderer/external_clear_key_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "components/cdm/renderer/external_clear_key_key_system_info.h"
#include "components/cdm/renderer/widevine_key_system_info.h"
#include "content/public/renderer/render_thread.h"
#include "media/base/decrypt_config.h"
#include "media/base/eme_constants.h"
#include "media/base/key_system_properties.h"
#include "media/base/key_system_info.h"
#include "media/cdm/cdm_capability.h"
#include "media/media_buildflags.h"
#include "third_party/widevine/cdm/buildflags.h"
Expand All @@ -48,8 +48,8 @@
using media::CdmSessionType;
using media::EmeConfig;
using media::EmeFeatureSupport;
using media::KeySystemProperties;
using media::KeySystemPropertiesVector;
using media::KeySystemInfo;
using media::KeySystemInfoVector;
using media::SupportedCodecs;

namespace {
Expand Down Expand Up @@ -281,7 +281,7 @@ base::flat_set<CdmSessionType> UpdatePersistentLicenseSupport(
}

bool AddWidevine(const media::mojom::KeySystemCapabilityPtr& capability,
KeySystemPropertiesVector* key_systems) {
KeySystemInfoVector* key_systems) {
// Codecs and encryption schemes.
SupportedCodecs codecs = media::EME_CODEC_NONE;
SupportedCodecs hw_secure_codecs = media::EME_CODEC_NONE;
Expand Down Expand Up @@ -317,13 +317,13 @@ bool AddWidevine(const media::mojom::KeySystemCapabilityPtr& capability,
}

// Robustness.
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
using Robustness = cdm::WidevineKeySystemInfo::Robustness;
auto max_audio_robustness = Robustness::SW_SECURE_CRYPTO;
auto max_video_robustness = Robustness::SW_SECURE_DECODE;

#if BUILDFLAG(IS_CHROMEOS)
// On ChromeOS, we support HW_SECURE_ALL even without hardware secure codecs.
// See WidevineKeySystemProperties::GetRobustnessConfigRule().
// See WidevineKeySystemInfo::GetRobustnessConfigRule().
max_audio_robustness = Robustness::HW_SECURE_ALL;
max_video_robustness = Robustness::HW_SECURE_ALL;
#else
Expand All @@ -340,7 +340,7 @@ bool AddWidevine(const media::mojom::KeySystemCapabilityPtr& capability,
distinctive_identifier_support = EmeFeatureSupport::REQUESTABLE;
#endif

key_systems->emplace_back(new cdm::WidevineKeySystemProperties(
key_systems->emplace_back(new cdm::WidevineKeySystemInfo(
codecs, std::move(encryption_schemes), std::move(session_types),
hw_secure_codecs, std::move(hw_secure_encryption_schemes),
std::move(hw_secure_session_types), max_audio_robustness,
Expand All @@ -354,7 +354,7 @@ const char kExternalClearKeyKeySystem[] = "org.chromium.externalclearkey";

void AddExternalClearKey(
const media::mojom::KeySystemCapabilityPtr& /*capability*/,
KeySystemPropertiesVector* key_systems) {
KeySystemInfoVector* key_systems) {
DVLOG(1) << __func__;

if (!base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting)) {
Expand All @@ -369,7 +369,7 @@ void AddExternalClearKey(
void OnKeySystemSupportUpdated(
media::GetSupportedKeySystemsCB cb,
content::KeySystemCapabilityPtrMap key_system_capabilities) {
KeySystemPropertiesVector key_systems;
KeySystemInfoVector key_systems;
for (const auto& entry : key_system_capabilities) {
const auto& key_system = entry.first;
const auto& capability = entry.second;
Expand Down Expand Up @@ -397,7 +397,7 @@ void OnKeySystemSupportUpdated(

void GetChromeKeySystems(media::GetSupportedKeySystemsCB cb) {
#if BUILDFLAG(IS_ANDROID) && BUILDFLAG(ENABLE_WIDEVINE)
KeySystemPropertiesVector key_systems;
KeySystemInfoVector key_systems;
cdm::AddAndroidWidevine(&key_systems);
std::move(cb).Run(std::move(key_systems));
return;
Expand Down
2 changes: 1 addition & 1 deletion chrome/renderer/media/chrome_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <memory>
#include <vector>

#include "media/base/key_system_properties.h"
#include "media/base/key_system_info.h"

// Register the key systems supported by the chrome/ layer.
void GetChromeKeySystems(media::GetSupportedKeySystemsCB cb);
Expand Down
2 changes: 1 addition & 1 deletion chromecast/renderer/cast_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void CastContentRendererClient::RunScriptsAtDocumentEnd(

void CastContentRendererClient::GetSupportedKeySystems(
::media::GetSupportedKeySystemsCB cb) {
::media::KeySystemPropertiesVector key_systems;
::media::KeySystemInfoVector key_systems;
media::AddChromecastKeySystems(&key_systems,
false /* enable_persistent_license_support */,
false /* enable_playready */);
Expand Down
35 changes: 17 additions & 18 deletions chromecast/renderer/media/key_systems_cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
#include "components/cdm/renderer/android_key_systems.h"
#include "media/base/content_decryption_module.h"
#include "media/base/eme_constants.h"
#include "media/base/key_system_properties.h"
#include "media/base/key_system_info.h"
#include "media/media_buildflags.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/widevine/cdm/buildflags.h"

#if BUILDFLAG(ENABLE_WIDEVINE)
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_info.h"
#endif

using ::media::CdmSessionType;
Expand All @@ -37,11 +37,11 @@ namespace media {
namespace {

#if BUILDFLAG(ENABLE_PLAYREADY)
class PlayReadyKeySystemProperties : public ::media::KeySystemProperties {
class PlayReadyKeySystemInfo : public ::media::KeySystemInfo {
public:
PlayReadyKeySystemProperties(SupportedCodecs supported_non_secure_codecs,
SupportedCodecs supported_secure_codecs,
bool persistent_license_support)
PlayReadyKeySystemInfo(SupportedCodecs supported_non_secure_codecs,
SupportedCodecs supported_secure_codecs,
bool persistent_license_support)
: supported_non_secure_codecs_(supported_non_secure_codecs),
#if BUILDFLAG(IS_ANDROID)
supported_secure_codecs_(supported_secure_codecs),
Expand Down Expand Up @@ -161,31 +161,30 @@ SupportedCodecs GetCastEmeSupportedCodecs() {
return codecs;
}

void AddCmaKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>*
key_systems_properties,
bool enable_persistent_license_support,
bool enable_playready) {
void AddCmaKeySystems(std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
bool enable_persistent_license_support,
bool enable_playready) {
// |codecs| may not be used if Widevine and Playready aren't supported.
[[maybe_unused]] SupportedCodecs codecs = GetCastEmeSupportedCodecs();

#if BUILDFLAG(ENABLE_PLAYREADY)
if (enable_playready) {
key_systems_properties->emplace_back(new PlayReadyKeySystemProperties(
key_systems_properties->emplace_back(new PlayReadyKeySystemInfo(
codecs, codecs, enable_persistent_license_support));
}
#endif // BUILDFLAG(ENABLE_PLAYREADY)

#if BUILDFLAG(ENABLE_WIDEVINE)
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
using Robustness = cdm::WidevineKeySystemInfo::Robustness;

const base::flat_set<EncryptionScheme> kEncryptionSchemes = {
EncryptionScheme::kCenc, EncryptionScheme::kCbcs};

const base::flat_set<CdmSessionType> kSessionTypes = {
CdmSessionType::kTemporary, CdmSessionType::kPersistentLicense};

key_systems_properties->emplace_back(new cdm::WidevineKeySystemProperties(
key_systems_properties->emplace_back(new cdm::WidevineKeySystemInfo(
codecs, // Regular codecs.
kEncryptionSchemes, // Encryption schemes.
kSessionTypes, // Session types.
Expand All @@ -202,7 +201,7 @@ void AddCmaKeySystems(
#elif BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_PLAYREADY)
void AddCastPlayreadyKeySystemAndroid(
std::vector<std::unique_ptr<::media::KeySystemProperties>>*
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties) {
DCHECK(key_systems_properties);
SupportedKeySystemResponse response =
Expand All @@ -211,14 +210,14 @@ void AddCastPlayreadyKeySystemAndroid(
if (response.non_secure_codecs == ::media::EME_CODEC_NONE)
return;

key_systems_properties->emplace_back(new PlayReadyKeySystemProperties(
key_systems_properties->emplace_back(new PlayReadyKeySystemInfo(
response.non_secure_codecs, response.secure_codecs,
false /* persistent_license_support */));
}
#endif // BUILDFLAG(ENABLE_PLAYREADY)

void AddCastAndroidKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>*
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
bool enable_playready) {
#if BUILDFLAG(ENABLE_PLAYREADY)
Expand All @@ -237,7 +236,7 @@ void AddCastAndroidKeySystems(

// TODO(yucliu): Split CMA/Android logics into their own files.
void AddChromecastKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>*
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
bool enable_persistent_license_support,
bool enable_playready) {
Expand Down
4 changes: 2 additions & 2 deletions chromecast/renderer/media/key_systems_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#include <vector>

namespace media {
class KeySystemProperties;
class KeySystemInfo;
}

namespace chromecast {
namespace media {

void AddChromecastKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>*
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
bool enable_persistent_license_support,
bool enable_playready);
Expand Down
8 changes: 4 additions & 4 deletions components/cdm/renderer/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import("//third_party/widevine/cdm/widevine.gni")

static_library("renderer") {
sources = [
"external_clear_key_key_system_properties.cc",
"external_clear_key_key_system_properties.h",
"external_clear_key_key_system_info.cc",
"external_clear_key_key_system_info.h",
]
deps = [
"//base",
Expand All @@ -27,8 +27,8 @@ static_library("renderer") {

if (enable_widevine) {
sources += [
"widevine_key_system_properties.cc",
"widevine_key_system_properties.h",
"widevine_key_system_info.cc",
"widevine_key_system_info.h",
]
deps += [
"//build:chromeos_buildflags",
Expand Down
24 changes: 12 additions & 12 deletions components/cdm/renderer/android_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "media/base/media_switches.h"
#include "media/media_buildflags.h"
#if BUILDFLAG(ENABLE_WIDEVINE)
#include "components/cdm/renderer/widevine_key_system_properties.h"
#include "components/cdm/renderer/widevine_key_system_info.h"
#include "third_party/abseil-cpp/absl/types/optional.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
#endif // BUILDFLAG(ENABLE_WIDEVINE)
Expand All @@ -26,23 +26,23 @@ using media::EmeConfigRuleState;
using media::EmeFeatureSupport;
using media::EmeInitDataType;
using media::EncryptionScheme;
using media::KeySystemProperties;
using media::KeySystemInfo;
using media::SupportedCodecs;
#if BUILDFLAG(ENABLE_WIDEVINE)
using Robustness = cdm::WidevineKeySystemProperties::Robustness;
using Robustness = cdm::WidevineKeySystemInfo::Robustness;
#endif // BUILDFLAG(ENABLE_WIDEVINE)

namespace cdm {

namespace {

// Implementation of KeySystemProperties for platform-supported key systems.
// Implementation of KeySystemInfo for platform-supported key systems.
// Assumes that platform key systems support no features but can and will
// make use of persistence and identifiers.
class AndroidPlatformKeySystemProperties : public KeySystemProperties {
class AndroidPlatformKeySystemInfo : public KeySystemInfo {
public:
AndroidPlatformKeySystemProperties(const std::string& name,
SupportedCodecs supported_codecs)
AndroidPlatformKeySystemInfo(const std::string& name,
SupportedCodecs supported_codecs)
: name_(name), supported_codecs_(supported_codecs) {}

std::string GetBaseKeySystemName() const override { return name_; }
Expand Down Expand Up @@ -130,7 +130,7 @@ SupportedKeySystemResponse QueryKeySystemSupport(

#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<KeySystemProperties>>* key_systems) {
std::vector<std::unique_ptr<KeySystemInfo>>* key_systems) {
// TODO(crbug.com/853336): Use media.mojom.KeySystemSupport instead of
// separate IPC.
auto response = QueryKeySystemSupport(kWidevineKeySystem);
Expand Down Expand Up @@ -163,7 +163,7 @@ void AddAndroidWidevine(
// Since we do not control the implementation of the MediaDrm API on Android,
// we assume that it can and will make use of persistence no matter whether
// persistence-based features are supported or not.
key_systems->emplace_back(new WidevineKeySystemProperties(
key_systems->emplace_back(new WidevineKeySystemInfo(
codecs, // Regular codecs.
encryption_schemes, // Encryption schemes.
session_types, // Session types.
Expand All @@ -178,7 +178,7 @@ void AddAndroidWidevine(
#endif // BUILDFLAG(ENABLE_WIDEVINE)

void AddAndroidPlatformKeySystems(
std::vector<std::unique_ptr<KeySystemProperties>>* key_systems) {
std::vector<std::unique_ptr<KeySystemInfo>>* key_systems) {
// TODO(crbug.com/853336): Update media.mojom.KeySystemSupport to handle this
// case and use it instead.

Expand All @@ -190,8 +190,8 @@ void AddAndroidPlatformKeySystems(
it != key_system_names.end(); ++it) {
SupportedKeySystemResponse response = QueryKeySystemSupport(*it);
if (response.non_secure_codecs != media::EME_CODEC_NONE) {
key_systems->emplace_back(new AndroidPlatformKeySystemProperties(
*it, response.non_secure_codecs));
key_systems->emplace_back(
new AndroidPlatformKeySystemInfo(*it, response.non_secure_codecs));
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions components/cdm/renderer/android_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,20 @@
#include <vector>

#include "components/cdm/common/cdm_messages_android.h"
#include "media/base/key_system_properties.h"
#include "media/base/key_system_info.h"
#include "third_party/widevine/cdm/buildflags.h"

namespace cdm {

#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<media::KeySystemProperties>>* key_systems);
std::vector<std::unique_ptr<media::KeySystemInfo>>* key_systems);
#endif // BUILDFLAG(ENABLE_WIDEVINE)

// Add platform-supported key systems which are not explicitly handled
// by Chrome.
void AddAndroidPlatformKeySystems(
std::vector<std::unique_ptr<media::KeySystemProperties>>* key_systems);
std::vector<std::unique_ptr<media::KeySystemInfo>>* key_systems);

// Query key system property in browser process.
SupportedKeySystemResponse QueryKeySystemSupport(const std::string& key_system);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/cdm/renderer/external_clear_key_key_system_properties.h"
#include "components/cdm/renderer/external_clear_key_key_system_info.h"

#include "base/notreached.h"
#include "media/base/eme_constants.h"
Expand Down
Loading

0 comments on commit d2e5386

Please sign in to comment.