media: Refactor KeySystemSupport
https://chromium-review.googlesource.com/c/chromium/src/+/1102836
This commit is contained in:
parent
9c2cd5a84c
commit
7861f75a3e
2 changed files with 13 additions and 11 deletions
1
BUILD.gn
1
BUILD.gn
|
@ -236,6 +236,7 @@ static_library("electron_lib") {
|
||||||
"//ui/gl",
|
"//ui/gl",
|
||||||
"//ui/views",
|
"//ui/views",
|
||||||
"//v8",
|
"//v8",
|
||||||
|
"//media/mojo/interfaces",
|
||||||
]
|
]
|
||||||
|
|
||||||
# TODO: this requires a visibility patch to chromium src. it would be better
|
# TODO: this requires a visibility patch to chromium src. it would be better
|
||||||
|
|
|
@ -44,7 +44,7 @@ namespace {
|
||||||
bool IsWidevineAvailable(
|
bool IsWidevineAvailable(
|
||||||
base::FilePath* cdm_path,
|
base::FilePath* cdm_path,
|
||||||
std::vector<media::VideoCodec>* codecs_supported,
|
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) {
|
base::flat_set<media::EncryptionMode>* modes_supported) {
|
||||||
static enum {
|
static enum {
|
||||||
NOT_CHECKED,
|
NOT_CHECKED,
|
||||||
|
@ -71,12 +71,11 @@ bool IsWidevineAvailable(
|
||||||
codecs_supported->push_back(media::VideoCodec::kCodecH264);
|
codecs_supported->push_back(media::VideoCodec::kCodecH264);
|
||||||
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
|
||||||
|
|
||||||
// TODO(crbug.com/767941): Push persistent-license support info here once
|
// TODO(crbug.com/767941): Push persistent-license support info here once
|
||||||
// we check in a new CDM that supports it on Linux.
|
// we check in a new CDM that supports it on Linux.
|
||||||
|
session_types_supported->insert(media::CdmSessionType::kTemporary);
|
||||||
#if defined(OS_CHROMEOS)
|
#if defined(OS_CHROMEOS)
|
||||||
*supports_persistent_license = true;
|
session_types_supported->insert(media::CdmSessionType::kPersistentLicense);
|
||||||
#else
|
|
||||||
*supports_persistent_license = false;
|
|
||||||
#endif // defined(OS_CHROMEOS)
|
#endif // defined(OS_CHROMEOS)
|
||||||
|
|
||||||
modes_supported->insert(media::EncryptionMode::kCenc);
|
modes_supported->insert(media::EncryptionMode::kCenc);
|
||||||
|
@ -225,10 +224,10 @@ void AtomContentClient::AddContentDecryptionModules(
|
||||||
#if defined(WIDEVINE_CDM_AVAILABLE)
|
#if defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
base::FilePath cdm_path;
|
base::FilePath cdm_path;
|
||||||
std::vector<media::VideoCodec> video_codecs_supported;
|
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;
|
base::flat_set<media::EncryptionMode> encryption_modes_supported;
|
||||||
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
|
if (IsWidevineAvailable(&cdm_path, &video_codecs_supported,
|
||||||
&supports_persistent_license,
|
&session_types_supported,
|
||||||
&encryption_modes_supported)) {
|
&encryption_modes_supported)) {
|
||||||
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
|
||||||
auto cdm_version_string =
|
auto cdm_version_string =
|
||||||
|
@ -239,11 +238,13 @@ void AtomContentClient::AddContentDecryptionModules(
|
||||||
const base::Version version(cdm_version_string);
|
const base::Version version(cdm_version_string);
|
||||||
DCHECK(version.IsValid());
|
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(
|
cdms->push_back(content::CdmInfo(
|
||||||
kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
|
kWidevineCdmDisplayName, kWidevineCdmGuid, version, cdm_path,
|
||||||
kWidevineCdmFileSystemId, video_codecs_supported,
|
kWidevineCdmFileSystemId, capability, kWidevineKeySystem, false));
|
||||||
supports_persistent_license, encryption_modes_supported,
|
|
||||||
kWidevineKeySystem, false));
|
|
||||||
}
|
}
|
||||||
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
#endif // defined(WIDEVINE_CDM_AVAILABLE)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue