Bug 1898588 - part5 : remove encryption scheme per key system. r=jolin

As we've added encryption scheme per content type in previous patches,
there is no need to keep this old encryption scheme.

Differential Revision: https://phabricator.services.mozilla.com/D211793
This commit is contained in:
alwu 2024-05-29 18:27:04 +00:00
Родитель 2ad5b06f21
Коммит 6a5f6b7c2a
8 изменённых файлов: 2 добавлений и 60 удалений

Просмотреть файл

@ -192,10 +192,6 @@ void MFCDMCapabilitiesIPDLToKeySystemConfig(
}
aKeySystemConfig.mPersistentState = aCDMConfig.persistentState();
aKeySystemConfig.mDistinctiveIdentifier = aCDMConfig.distinctiveID();
for (const auto& scheme : aCDMConfig.encryptionSchemes()) {
aKeySystemConfig.mEncryptionSchemes.AppendElement(
NS_ConvertUTF8toUTF16(CryptoSchemeToString(scheme)));
}
aKeySystemConfig.mIsHDCP22Compatible = aCDMConfig.isHDCP22Compatible()
? *aCDMConfig.isHDCP22Compatible()
: false;

Просмотреть файл

@ -79,9 +79,6 @@ bool KeySystemConfig::Supports(const nsAString& aKeySystem) {
config->mPersistentState = Requirement::Optional;
config->mDistinctiveIdentifier = Requirement::NotAllowed;
config->mSessionTypes.AppendElement(SessionType::Temporary);
config->mEncryptionSchemes.AppendElement(u"cenc"_ns);
config->mEncryptionSchemes.AppendElement(u"cbcs"_ns);
config->mEncryptionSchemes.AppendElement(u"cbcs-1-9"_ns);
if (StaticPrefs::media_clearkey_persistent_license_enabled()) {
config->mSessionTypes.AppendElement(SessionType::PersistentLicense);
}
@ -137,9 +134,6 @@ bool KeySystemConfig::Supports(const nsAString& aKeySystem) {
config->mAudioRobustness.AppendElement(u"SW_SECURE_CRYPTO"_ns);
config->mVideoRobustness.AppendElement(u"SW_SECURE_CRYPTO"_ns);
config->mVideoRobustness.AppendElement(u"SW_SECURE_DECODE"_ns);
config->mEncryptionSchemes.AppendElement(u"cenc"_ns);
config->mEncryptionSchemes.AppendElement(u"cbcs"_ns);
config->mEncryptionSchemes.AppendElement(u"cbcs-1-9"_ns);
#if defined(MOZ_WIDGET_ANDROID)
// MediaDrm.isCryptoSchemeSupported only allows passing
@ -368,14 +362,6 @@ nsString KeySystemConfig::GetDebugInfo() const {
debugInfo.AppendLiteral(",");
}
}
debugInfo.AppendLiteral(" scheme=[");
for (size_t idx = 0; idx < mEncryptionSchemes.Length(); idx++) {
debugInfo.Append(mEncryptionSchemes[idx]);
if (idx + 1 < mEncryptionSchemes.Length()) {
debugInfo.AppendLiteral(",");
}
}
debugInfo.AppendLiteral("]");
debugInfo.AppendLiteral(" MP4={");
debugInfo.Append(NS_ConvertUTF8toUTF16(mMP4.GetDebugInfo()));
debugInfo.AppendLiteral("}");

Просмотреть файл

@ -207,7 +207,6 @@ struct KeySystemConfig {
mSessionTypes = aOther.mSessionTypes.Clone();
mVideoRobustness = aOther.mVideoRobustness.Clone();
mAudioRobustness = aOther.mAudioRobustness.Clone();
mEncryptionSchemes = aOther.mEncryptionSchemes.Clone();
mMP4 = aOther.mMP4;
mWebM = aOther.mWebM;
}
@ -222,7 +221,6 @@ struct KeySystemConfig {
mSessionTypes = aOther.mSessionTypes.Clone();
mVideoRobustness = aOther.mVideoRobustness.Clone();
mAudioRobustness = aOther.mAudioRobustness.Clone();
mEncryptionSchemes = aOther.mEncryptionSchemes.Clone();
mMP4 = aOther.mMP4;
mWebM = aOther.mWebM;
return *this;
@ -239,7 +237,6 @@ struct KeySystemConfig {
nsTArray<SessionType> mSessionTypes;
nsTArray<nsString> mVideoRobustness;
nsTArray<nsString> mAudioRobustness;
nsTArray<nsString> mEncryptionSchemes;
ContainerSupport mMP4;
ContainerSupport mWebM;
bool mIsHDCP22Compatible = false;

Просмотреть файл

@ -105,10 +105,6 @@ WMFCDMCapabilites::GetCapabilities(
CryptoSchemeToString(scheme));
}
}
for (const auto& v : capabilities.encryptionSchemes()) {
EME_LOG("capabilities: encryptionScheme=%s",
CryptoSchemeToString(v));
}
KeySystemConfig* config = outConfigs.AppendElement();
MFCDMCapabilitiesIPDLToKeySystemConfig(capabilities, *config);
}

Просмотреть файл

@ -854,10 +854,8 @@ void MFCDMParent::GetCapabilities(const nsString& aKeySystem,
CryptoScheme::Cbcs,
});
// Remember supported video codecs.
// It will be used when collecting audio codec and encryption scheme
// support.
// TODO : scheme part should be removed later
// Remember supported video codecs, which will be used when collecting audio
// codec support.
nsTArray<KeySystemConfig::EMECodecString> supportedVideoCodecs;
if (aFlags.contains(CapabilitesFlag::NeedClearLeadCheck)) {
@ -987,31 +985,6 @@ void MFCDMParent::GetCapabilities(const nsString& aKeySystem,
}
}
// 'If value is unspecified, default value of "cenc" is used.' See
// https://learn.microsoft.com/en-us/windows/win32/api/mfmediaengine/nf-mfmediaengine-imfextendeddrmtypesupport-istypesupportedex
if (!supportedVideoCodecs.IsEmpty()) {
aCapabilitiesOut.encryptionSchemes().AppendElement(CryptoScheme::Cenc);
MFCDM_PARENT_SLOG("%s: +scheme:cenc", __func__);
}
// Check another scheme "cbcs"
static std::pair<CryptoScheme, nsDependentString> kCbcs =
std::pair<CryptoScheme, nsDependentString>(
CryptoScheme::Cbcs, u"encryption-type=cbcs,encryption-iv-size=16,");
bool ok = true;
for (const auto& codec : supportedVideoCodecs) {
ok &= FactorySupports(factory, aKeySystem, convertCodecToFourCC(codec),
nsCString(""), kCbcs.second /* additional feature */,
isHardwareDecryption);
if (!ok) {
break;
}
}
if (ok) {
aCapabilitiesOut.encryptionSchemes().AppendElement(kCbcs.first);
MFCDM_PARENT_SLOG("%s: +scheme:cbcs", __func__);
}
// Only perform HDCP if necessary, "The hdcp query (item 4) has a
// computationally expensive first invocation cost". See
// https://learn.microsoft.com/en-us/windows/win32/api/mfmediaengine/nf-mfmediaengine-imfextendeddrmtypesupport-istypesupportedex

Просмотреть файл

@ -56,7 +56,6 @@ struct MFCDMCapabilitiesIPDL {
MFCDMMediaCapability[] audioCapabilities;
MFCDMMediaCapability[] videoCapabilities;
SessionType[] sessionTypes;
CryptoScheme[] encryptionSchemes;
Requirement distinctiveID;
Requirement persistentState;
bool? isHDCP22Compatible;

Просмотреть файл

@ -235,10 +235,6 @@ void UtilityAudioDecoderChild::GetKeySystemCapabilities(
CryptoSchemeToString(scheme));
}
}
for (const auto& e : capabilities.encryptionSchemes()) {
EME_LOG(" capabilities: encryptionScheme=%s",
CryptoSchemeToString(e));
}
auto* info = cdmInfo.AppendElement(fallible);
if (!info) {
promise->MaybeReject(NS_ERROR_OUT_OF_MEMORY);

Просмотреть файл

@ -1169,7 +1169,6 @@ var snapshotFormatters = {
capabilities.persistent = findElementInArray(array, "persistent");
capabilities.distinctive = findElementInArray(array, "distinctive");
capabilities.sessionType = findElementInArray(array, "sessionType");
capabilities.scheme = findElementInArray(array, "scheme");
capabilities.codec = getSupportedCodecs(array);
return JSON.stringify(capabilities);
}