media: Refactor KeySystemSupport

https://chromium-review.googlesource.com/c/chromium/src/+/1102836
This commit is contained in:
Jeremy Apthorp 2018-10-02 14:40:10 -07:00
parent 9c2cd5a84c
commit 7861f75a3e
2 changed files with 13 additions and 11 deletions

View file

@ -236,6 +236,7 @@ static_library("electron_lib") {
"//ui/gl",
"//ui/views",
"//v8",
"//media/mojo/interfaces",
]
# TODO: this requires a visibility patch to chromium src. it would be better

View file

@ -44,7 +44,7 @@ namespace {
bool IsWidevineAvailable(
base::FilePath* cdm_path,
std::vector<media::VideoCodec>* codecs_supported,
bool* supports_persistent_license,
base::flat_set<media::CdmSessionType>* session_types_supported,
base::flat_set<media::EncryptionMode>* modes_supported) {
static enum {
NOT_CHECKED,
@ -71,12 +71,11 @@ bool IsWidevineAvailable(
codecs_supported->push_back(media::VideoCodec::kCodecH264);
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
// TODO(crbug.com/767941): Push persistent-license support info here once
// we check in a new CDM that supports it on Linux.
// TODO(crbug.com/767941): Push persistent-license support info here once
// we check in a new CDM that supports it on Linux.
session_types_supported->insert(media::CdmSessionType::kTemporary);
#if defined(OS_CHROMEOS)
*supports_persistent_license = true;
#else
*supports_persistent_license = false;
session_types_supported->insert(media::CdmSessionType::kPersistentLicense);
#endif // defined(OS_CHROMEOS)
modes_supported->insert(media::EncryptionMode::kCenc);
@ -225,10 +224,10 @@ void AtomContentClient::AddContentDecryptionModules(
#if defined(WIDEVINE_CDM_AVAILABLE)
base::FilePath cdm_path;
std::vector<media::VideoCodec> video_codecs_supported;
bool supports_persistent_license = false;
base::flat_set<media::CdmSessionType> session_types_supported;
base::flat_set<media::EncryptionMode> encryption_modes_supported;
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
&supports_persistent_license,
&session_types_supported,
&encryption_modes_supported)) {
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
auto cdm_version_string =
@ -239,11 +238,13 @@ void AtomContentClient::AddContentDecryptionModules(
const base::Version version(cdm_version_string);
DCHECK(version.IsValid());
content::CdmCapability capability(
video_codecs_supported, encryption_modes_supported,
session_types_supported, base::flat_set<media::CdmProxy::Protocol>());
cdms->push_back(content::CdmInfo(
kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
kWidevineCdmFileSystemId, video_codecs_supported,
supports_persistent_license, encryption_modes_supported,
kWidevineKeySystem, false));
kWidevineCdmFileSystemId, capability, kWidevineKeySystem, false));
}
#endif // defined(WIDEVINE_CDM_AVAILABLE)
}