Skip to content

Commit

Permalink
Fix KeySystemInfo naming
Browse files Browse the repository at this point in the history
This CL fixes the naming of KeySystemProperties to KeySystemInfo, as was
done in a previous CL.

Bug: b/241047837
Change-Id: I7b9c4bfd663dd5a4874931fca2a601f079a158c2
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4242016
Reviewed-by: Peter Beverloo <peter@chromium.org>
Reviewed-by: Sean Topping <seantopping@chromium.org>
Reviewed-by: John Rummell <jrummell@chromium.org>
Commit-Queue: Vikram Pasupathy <vpasupathy@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1104858}
  • Loading branch information
gvking authored and Chromium LUCI CQ committed Feb 14, 2023
1 parent 9d80813 commit b5e2d4f
Show file tree
Hide file tree
Showing 12 changed files with 102 additions and 112 deletions.
2 changes: 1 addition & 1 deletion android_webview/renderer/aw_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

namespace android_webview {

void AwAddKeySystems(media::KeySystemInfos* key_systems_properties);
void AwAddKeySystems(media::KeySystemInfos* key_system_infos);

} // namespace android_webview

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -959,7 +959,7 @@ IN_PROC_BROWSER_TEST_F(EncryptedMediaSupportedTypesExternalClearKeyTest,

// Child key systems for External Clear Key are generally supported except
// for the special one explicitly marked as "invalid". See
// ExternalClearKeySystemInfo.
// ExternalClearKeyKeySystemInfo.
EXPECT_UNSUPPORTED(
IsSupportedByKeySystem("org.chromium.externalclearkey.invalid",
kVideoWebMMimeType, video_webm_codecs()));
Expand Down
4 changes: 2 additions & 2 deletions chrome/common/media/cdm_registration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ void AddExternalClearKey(std::vector<content::CdmInfo>* cdms) {
return;
}

// Supported codecs are hard-coded in ExternalClearKeySystemInfo.
// Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo.
media::CdmCapability capability(
{}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary,
Expand Down Expand Up @@ -327,7 +327,7 @@ void AddMediaFoundationClearKey(std::vector<content::CdmInfo>* cdms) {
return;
}

// Supported codecs are hard-coded in ExternalClearKeySystemInfo.
// Supported codecs are hard-coded in ExternalClearKeyKeySystemInfo.
media::CdmCapability capability(
{}, {}, {media::EncryptionScheme::kCenc, media::EncryptionScheme::kCbcs},
{media::CdmSessionType::kTemporary});
Expand Down
5 changes: 3 additions & 2 deletions chrome/renderer/media/chrome_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -446,7 +446,8 @@ void AddExternalClearKey(
}

// TODO(xhwang): Actually use `capability` to determine capabilities.
key_systems->push_back(std::make_unique<cdm::ExternalClearKeySystemInfo>());
key_systems->push_back(
std::make_unique<cdm::ExternalClearKeyKeySystemInfo>());
}

#if BUILDFLAG(IS_WIN)
Expand All @@ -461,7 +462,7 @@ void AddMediaFoundationClearKey(
}

#if BUILDFLAG(USE_PROPRIETARY_CODECS)
key_systems->push_back(std::make_unique<cdm::ExternalClearKeySystemInfo>(
key_systems->push_back(std::make_unique<cdm::ExternalClearKeyKeySystemInfo>(
media::kMediaFoundationClearKeyKeySystem, std::vector<std::string>(),
// MediaFoundation Clear Key Key System uses Windows Media Foundation's
// decoders and H264 is always supported. VideoCodec::kH264 is an
Expand Down
28 changes: 12 additions & 16 deletions chromecast/renderer/media/key_systems_cast.cc
Original file line number Diff line number Diff line change
Expand Up @@ -162,16 +162,15 @@ SupportedCodecs GetCastEmeSupportedCodecs() {
return codecs;
}

void AddCmaKeySystems(std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
void AddCmaKeySystems(::media::KeySystemInfos* key_system_infos,
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 PlayReadyKeySystemInfo(
key_system_infos->emplace_back(new PlayReadyKeySystemInfo(
codecs, codecs, enable_persistent_license_support));
}
#endif // BUILDFLAG(ENABLE_PLAYREADY)
Expand All @@ -185,7 +184,7 @@ void AddCmaKeySystems(std::vector<std::unique_ptr<::media::KeySystemInfo>>*
const base::flat_set<CdmSessionType> kSessionTypes = {
CdmSessionType::kTemporary, CdmSessionType::kPersistentLicense};

key_systems_properties->emplace_back(new cdm::WidevineKeySystemInfo(
key_system_infos->emplace_back(new cdm::WidevineKeySystemInfo(
codecs, // Regular codecs.
kEncryptionSchemes, // Encryption schemes.
kSessionTypes, // Session types.
Expand All @@ -202,33 +201,31 @@ void AddCmaKeySystems(std::vector<std::unique_ptr<::media::KeySystemInfo>>*
#elif BUILDFLAG(IS_ANDROID)
#if BUILDFLAG(ENABLE_PLAYREADY)
void AddCastPlayreadyKeySystemAndroid(
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties) {
DCHECK(key_systems_properties);
::media::KeySystemInfos* key_system_infos) {
DCHECK(key_system_infos);
SupportedKeySystemResponse response =
cdm::QueryKeySystemSupport(kChromecastPlayreadyKeySystem);

if (response.non_secure_codecs == ::media::EME_CODEC_NONE)
return;

key_systems_properties->emplace_back(new PlayReadyKeySystemInfo(
key_system_infos->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::KeySystemInfo>>*
key_systems_properties,
::media::KeySystemInfos* key_system_infos,
bool enable_playready) {
#if BUILDFLAG(ENABLE_PLAYREADY)
if (enable_playready) {
AddCastPlayreadyKeySystemAndroid(key_systems_properties);
AddCastPlayreadyKeySystemAndroid(key_system_infos);
}
#endif // BUILDFLAG(ENABLE_PLAYREADY)

#if BUILDFLAG(ENABLE_WIDEVINE)
cdm::AddAndroidWidevine(key_systems_properties);
cdm::AddAndroidWidevine(key_system_infos);
#endif // BUILDFLAG(ENABLE_WIDEVINE)
}
#endif // BUILDFLAG(IS_ANDROID)
Expand All @@ -237,15 +234,14 @@ void AddCastAndroidKeySystems(

// TODO(yucliu): Split CMA/Android logics into their own files.
void AddChromecastKeySystems(
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
::media::KeySystemInfos* key_system_infos,
bool enable_persistent_license_support,
bool enable_playready) {
#if BUILDFLAG(USE_CHROMECAST_CDMS) || BUILDFLAG(ENABLE_WIDEVINE)
AddCmaKeySystems(key_systems_properties, enable_persistent_license_support,
AddCmaKeySystems(key_system_infos, enable_persistent_license_support,
enable_playready);
#elif BUILDFLAG(IS_ANDROID)
AddCastAndroidKeySystems(key_systems_properties, enable_playready);
AddCastAndroidKeySystems(key_system_infos, enable_playready);
#endif // BUILDFLAG(IS_ANDROID)
}

Expand Down
15 changes: 4 additions & 11 deletions chromecast/renderer/media/key_systems_cast.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,14 @@
#ifndef CHROMECAST_RENDERER_MEDIA_KEY_SYSTEMS_CAST_H_
#define CHROMECAST_RENDERER_MEDIA_KEY_SYSTEMS_CAST_H_

#include <memory>
#include <vector>

namespace media {
class KeySystemInfo;
}
#include "media/base/key_system_info.h"

namespace chromecast {
namespace media {

void AddChromecastKeySystems(
std::vector<std::unique_ptr<::media::KeySystemInfo>>*
key_systems_properties,
bool enable_persistent_license_support,
bool enable_playready);
void AddChromecastKeySystems(::media::KeySystemInfos* key_system_infos,
bool enable_persistent_license_support,
bool enable_playready);

} // namespace media
} // namespace chromecast
Expand Down
7 changes: 3 additions & 4 deletions components/cdm/renderer/android_key_systems.cc
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ using media::CdmSessionType;
using media::EmeFeatureSupport;
using media::EncryptionScheme;
using media::KeySystemInfo;
using media::KeySystemInfos;
#if BUILDFLAG(ENABLE_WIDEVINE)
using Robustness = cdm::WidevineKeySystemInfo::Robustness;
#endif // BUILDFLAG(ENABLE_WIDEVINE)
Expand All @@ -49,8 +50,7 @@ SupportedKeySystemResponse QueryKeySystemSupport(
}

#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<KeySystemInfo>>* key_systems) {
void AddAndroidWidevine(KeySystemInfos* key_systems) {
// TODO(crbug.com/853336): Use media.mojom.KeySystemSupport instead of
// separate IPC.
auto response = QueryKeySystemSupport(kWidevineKeySystem);
Expand Down Expand Up @@ -97,8 +97,7 @@ void AddAndroidWidevine(
}
#endif // BUILDFLAG(ENABLE_WIDEVINE)

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

Expand Down
6 changes: 2 additions & 4 deletions components/cdm/renderer/android_key_systems.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
namespace cdm {

#if BUILDFLAG(ENABLE_WIDEVINE)
void AddAndroidWidevine(
std::vector<std::unique_ptr<media::KeySystemInfo>>* key_systems);
void AddAndroidWidevine(media::KeySystemInfos* 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::KeySystemInfo>>* key_systems);
void AddAndroidPlatformKeySystems(media::KeySystemInfos* key_systems);

// Query key system property in browser process.
SupportedKeySystemResponse QueryKeySystemSupport(const std::string& key_system);
Expand Down
33 changes: 17 additions & 16 deletions components/cdm/renderer/external_clear_key_key_system_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@

namespace cdm {

ExternalClearKeySystemInfo::ExternalClearKeySystemInfo()
: ExternalClearKeySystemInfo(
ExternalClearKeyKeySystemInfo::ExternalClearKeyKeySystemInfo()
: ExternalClearKeyKeySystemInfo(
// Supports kExternalClearKeyKeySystem and all its sub key systems,
// except for the explicitly "invalid" one. See the test
// EncryptedMediaSupportedTypesExternalClearKeyTest.InvalidKeySystems.
Expand All @@ -28,7 +28,7 @@ ExternalClearKeySystemInfo::ExternalClearKeySystemInfo()
media::EmeFeatureSupport::REQUESTABLE,
media::EmeFeatureSupport::NOT_SUPPORTED) {}

ExternalClearKeySystemInfo::ExternalClearKeySystemInfo(
ExternalClearKeyKeySystemInfo::ExternalClearKeyKeySystemInfo(
const std::string& key_system,
std::vector<std::string> excluded_key_systems,
media::SupportedCodecs codecs,
Expand All @@ -42,21 +42,21 @@ ExternalClearKeySystemInfo::ExternalClearKeySystemInfo(
persistent_state_support_(persistent_state_support),
distinctive_identifier_support_(distinctive_identifier_support) {}

ExternalClearKeySystemInfo::~ExternalClearKeySystemInfo() = default;
ExternalClearKeyKeySystemInfo::~ExternalClearKeyKeySystemInfo() = default;

std::string ExternalClearKeySystemInfo::GetBaseKeySystemName() const {
std::string ExternalClearKeyKeySystemInfo::GetBaseKeySystemName() const {
return key_system_;
}

bool ExternalClearKeySystemInfo::IsSupportedKeySystem(
bool ExternalClearKeyKeySystemInfo::IsSupportedKeySystem(
const std::string& key_system) const {
return (key_system == key_system_ ||
media::IsSubKeySystemOf(key_system, key_system_)) &&
std::find(excluded_key_systems_.begin(), excluded_key_systems_.end(),
key_system) == excluded_key_systems_.end();
}

bool ExternalClearKeySystemInfo::IsSupportedInitDataType(
bool ExternalClearKeyKeySystemInfo::IsSupportedInitDataType(
media::EmeInitDataType init_data_type) const {
switch (init_data_type) {
case media::EmeInitDataType::CENC:
Expand All @@ -72,7 +72,7 @@ bool ExternalClearKeySystemInfo::IsSupportedInitDataType(
}

absl::optional<media::EmeConfig>
ExternalClearKeySystemInfo::GetEncryptionSchemeConfigRule(
ExternalClearKeyKeySystemInfo::GetEncryptionSchemeConfigRule(
media::EncryptionScheme encryption_scheme) const {
switch (encryption_scheme) {
case media::EncryptionScheme::kCenc:
Expand All @@ -85,19 +85,20 @@ ExternalClearKeySystemInfo::GetEncryptionSchemeConfigRule(
return media::EmeConfig::UnsupportedRule();
}

media::SupportedCodecs ExternalClearKeySystemInfo::GetSupportedCodecs() const {
media::SupportedCodecs ExternalClearKeyKeySystemInfo::GetSupportedCodecs()
const {
return codecs_;
}

// On Windows, MediaFoundation Clear Key CDM requires HW secure codecs. We
// need this method to pretent to require this for testing purposes.
media::SupportedCodecs ExternalClearKeySystemInfo::GetSupportedHwSecureCodecs()
const {
media::SupportedCodecs
ExternalClearKeyKeySystemInfo::GetSupportedHwSecureCodecs() const {
return codecs_;
}

absl::optional<media::EmeConfig>
ExternalClearKeySystemInfo::GetRobustnessConfigRule(
ExternalClearKeyKeySystemInfo::GetRobustnessConfigRule(
const std::string& key_system,
media::EmeMediaType media_type,
const std::string& requested_robustness,
Expand All @@ -115,17 +116,17 @@ ExternalClearKeySystemInfo::GetRobustnessConfigRule(

// Persistent license sessions are faked.
absl::optional<media::EmeConfig>
ExternalClearKeySystemInfo::GetPersistentLicenseSessionSupport() const {
ExternalClearKeyKeySystemInfo::GetPersistentLicenseSessionSupport() const {
return media::EmeConfig::SupportedRule();
}

media::EmeFeatureSupport ExternalClearKeySystemInfo::GetPersistentStateSupport()
const {
media::EmeFeatureSupport
ExternalClearKeyKeySystemInfo::GetPersistentStateSupport() const {
return persistent_state_support_;
}

media::EmeFeatureSupport
ExternalClearKeySystemInfo::GetDistinctiveIdentifierSupport() const {
ExternalClearKeyKeySystemInfo::GetDistinctiveIdentifierSupport() const {
return distinctive_identifier_support_;
}

Expand Down
8 changes: 4 additions & 4 deletions components/cdm/renderer/external_clear_key_key_system_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@
namespace cdm {

// KeySystemInfo implementation for external Clear Key key systems.
class ExternalClearKeySystemInfo : public media::KeySystemInfo {
class ExternalClearKeyKeySystemInfo : public media::KeySystemInfo {
public:
ExternalClearKeySystemInfo();
ExternalClearKeySystemInfo(
ExternalClearKeyKeySystemInfo();
ExternalClearKeyKeySystemInfo(
const std::string& key_system,
std::vector<std::string> excluded_key_systems,
media::SupportedCodecs codecs,
media::EmeConfig::Rule eme_config_rule,
media::EmeFeatureSupport persistent_state_support,
media::EmeFeatureSupport distinctive_identifier_support);
~ExternalClearKeySystemInfo() override;
~ExternalClearKeyKeySystemInfo() override;

std::string GetBaseKeySystemName() const override;
bool IsSupportedKeySystem(const std::string& key_system) const override;
Expand Down
3 changes: 2 additions & 1 deletion content/shell/renderer/shell_content_renderer_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,8 @@ void ShellContentRendererClient::GetSupportedKeySystems(
media::GetSupportedKeySystemsCB cb) {
media::KeySystemInfos key_systems;
if (base::FeatureList::IsEnabled(media::kExternalClearKeyForTesting))
key_systems.push_back(std::make_unique<cdm::ExternalClearKeySystemInfo>());
key_systems.push_back(
std::make_unique<cdm::ExternalClearKeyKeySystemInfo>());
std::move(cb).Run(std::move(key_systems));
}
#endif
Expand Down

0 comments on commit b5e2d4f

Please sign in to comment.