forked from mirrors/gecko-dev
Bug 1898588 - part3 : add encryption scheme 'cbcs-1-9'. r=media-playback-reviewers,padenot
We've implemented support for cbcs-1-9 in bug 1683737 before, and we should add into CryptoScheme as well. Differential Revision: https://phabricator.services.mozilla.com/D211644
This commit is contained in:
parent
01ff3ac17a
commit
6dfee59a8f
7 changed files with 18 additions and 6 deletions
|
|
@ -602,6 +602,8 @@ const char* CryptoSchemeToString(const CryptoScheme& aScheme) {
|
||||||
return "cenc";
|
return "cenc";
|
||||||
case CryptoScheme::Cbcs:
|
case CryptoScheme::Cbcs:
|
||||||
return "cbcs";
|
return "cbcs";
|
||||||
|
case CryptoScheme::Cbcs_1_9:
|
||||||
|
return "cbcs-1-9";
|
||||||
default:
|
default:
|
||||||
MOZ_ASSERT_UNREACHABLE("not supported scheme!");
|
MOZ_ASSERT_UNREACHABLE("not supported scheme!");
|
||||||
return "not supported scheme!";
|
return "not supported scheme!";
|
||||||
|
|
@ -615,7 +617,9 @@ CryptoScheme StringToCryptoScheme(const nsAString& aString) {
|
||||||
if (aString.EqualsLiteral("cbcs")) {
|
if (aString.EqualsLiteral("cbcs")) {
|
||||||
return CryptoScheme::Cbcs;
|
return CryptoScheme::Cbcs;
|
||||||
}
|
}
|
||||||
// TODO : support cbcs-1-9?
|
if (aString.EqualsLiteral("cbcs-1-9")) {
|
||||||
|
return CryptoScheme::Cbcs_1_9;
|
||||||
|
}
|
||||||
return CryptoScheme::None;
|
return CryptoScheme::None;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -582,10 +582,12 @@ class VideoData : public MediaData {
|
||||||
media::TimeUnit mNextKeyFrameTime;
|
media::TimeUnit mNextKeyFrameTime;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// See https://w3c.github.io/encrypted-media/#scheme-cenc
|
||||||
enum class CryptoScheme : uint8_t {
|
enum class CryptoScheme : uint8_t {
|
||||||
None,
|
None,
|
||||||
Cenc,
|
Cenc,
|
||||||
Cbcs,
|
Cbcs,
|
||||||
|
Cbcs_1_9,
|
||||||
};
|
};
|
||||||
using CryptoSchemeSet = EnumSet<CryptoScheme, uint8_t>;
|
using CryptoSchemeSet = EnumSet<CryptoScheme, uint8_t>;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -341,6 +341,7 @@ bool ChromiumCDMParent::InitCDMInputBuffer(gmp::CDMInputBuffer& aBuffer,
|
||||||
encryptionScheme = cdm::EncryptionScheme::kCenc;
|
encryptionScheme = cdm::EncryptionScheme::kCenc;
|
||||||
break;
|
break;
|
||||||
case CryptoScheme::Cbcs:
|
case CryptoScheme::Cbcs:
|
||||||
|
case CryptoScheme::Cbcs_1_9:
|
||||||
encryptionScheme = cdm::EncryptionScheme::kCbcs;
|
encryptionScheme = cdm::EncryptionScheme::kCbcs;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,9 @@ struct ParamTraits<mozilla::KeySystemConfig::SessionType>
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<mozilla::CryptoScheme>
|
struct ParamTraits<mozilla::CryptoScheme>
|
||||||
: public ContiguousEnumSerializerInclusive<mozilla::CryptoScheme,
|
: public ContiguousEnumSerializerInclusive<
|
||||||
mozilla::CryptoScheme::None,
|
mozilla::CryptoScheme, mozilla::CryptoScheme::None,
|
||||||
mozilla::CryptoScheme::Cbcs> {};
|
mozilla::CryptoScheme::Cbcs_1_9> {};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct ParamTraits<mozilla::dom::MediaKeyMessageType>
|
struct ParamTraits<mozilla::dom::MediaKeyMessageType>
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ RefPtr<MediaDataDecoder::InitPromise> ChromiumCDMVideoDecoder::Init() {
|
||||||
config.mEncryptionScheme() = cdm::EncryptionScheme::kCenc;
|
config.mEncryptionScheme() = cdm::EncryptionScheme::kCenc;
|
||||||
break;
|
break;
|
||||||
case CryptoScheme::Cbcs:
|
case CryptoScheme::Cbcs:
|
||||||
|
case CryptoScheme::Cbcs_1_9:
|
||||||
config.mEncryptionScheme() = cdm::EncryptionScheme::kCbcs;
|
config.mEncryptionScheme() = cdm::EncryptionScheme::kCbcs;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -967,7 +967,9 @@ static CryptoInfoResult GetCryptoInfoFromSample(const MediaRawData* aSample) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool supportsCBCS = java::CodecProxy::SupportsCBCS();
|
static bool supportsCBCS = java::CodecProxy::SupportsCBCS();
|
||||||
if (cryptoObj.mCryptoScheme == CryptoScheme::Cbcs && !supportsCBCS) {
|
if ((cryptoObj.mCryptoScheme == CryptoScheme::Cbcs ||
|
||||||
|
cryptoObj.mCryptoScheme == CryptoScheme::Cbcs_1_9) &&
|
||||||
|
!supportsCBCS) {
|
||||||
return CryptoInfoResult(NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR);
|
return CryptoInfoResult(NS_ERROR_DOM_MEDIA_NOT_SUPPORTED_ERR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1014,6 +1016,7 @@ static CryptoInfoResult GetCryptoInfoFromSample(const MediaRawData* aSample) {
|
||||||
tempIV.AppendElements(cryptoObj.mIV);
|
tempIV.AppendElements(cryptoObj.mIV);
|
||||||
break;
|
break;
|
||||||
case CryptoScheme::Cbcs:
|
case CryptoScheme::Cbcs:
|
||||||
|
case CryptoScheme::Cbcs_1_9:
|
||||||
mode = java::sdk::MediaCodec::CRYPTO_MODE_AES_CBC;
|
mode = java::sdk::MediaCodec::CRYPTO_MODE_AES_CBC;
|
||||||
MOZ_ASSERT(cryptoObj.mConstantIV.Length() <= kExpectedIVLength);
|
MOZ_ASSERT(cryptoObj.mConstantIV.Length() <= kExpectedIVLength);
|
||||||
tempIV.AppendElements(cryptoObj.mConstantIV);
|
tempIV.AppendElements(cryptoObj.mConstantIV);
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,8 @@ HRESULT MFMediaEngineStream::AddEncryptAttributes(
|
||||||
if (aCryptoConfig.mCryptoScheme == CryptoScheme::Cenc) {
|
if (aCryptoConfig.mCryptoScheme == CryptoScheme::Cenc) {
|
||||||
protectionScheme = MFSampleEncryptionProtectionScheme::
|
protectionScheme = MFSampleEncryptionProtectionScheme::
|
||||||
MF_SAMPLE_ENCRYPTION_PROTECTION_SCHEME_AES_CTR;
|
MF_SAMPLE_ENCRYPTION_PROTECTION_SCHEME_AES_CTR;
|
||||||
} else if (aCryptoConfig.mCryptoScheme == CryptoScheme::Cbcs) {
|
} else if (aCryptoConfig.mCryptoScheme == CryptoScheme::Cbcs ||
|
||||||
|
aCryptoConfig.mCryptoScheme == CryptoScheme::Cbcs_1_9) {
|
||||||
protectionScheme = MFSampleEncryptionProtectionScheme::
|
protectionScheme = MFSampleEncryptionProtectionScheme::
|
||||||
MF_SAMPLE_ENCRYPTION_PROTECTION_SCHEME_AES_CBC;
|
MF_SAMPLE_ENCRYPTION_PROTECTION_SCHEME_AES_CBC;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue