зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 6 changesets (bug 1487416) for causing Android build bustages on RemoteDataDecoder.cpp. CLOSED TREE
Backed out changeset 05bcc598e9fb (bug 1487416) Backed out changeset b99936efbbc9 (bug 1487416) Backed out changeset ee55b284223e (bug 1487416) Backed out changeset d25449127f8f (bug 1487416) Backed out changeset f7c201b7f9bc (bug 1487416) Backed out changeset 233aedc8b42e (bug 1487416)
This commit is contained in:
Родитель
58ee8c6caf
Коммит
15939f75f2
|
@ -490,27 +490,13 @@ class VideoData : public MediaData {
|
|||
media::TimeUnit mNextKeyFrameTime;
|
||||
};
|
||||
|
||||
enum class CryptoScheme : uint8_t {
|
||||
None,
|
||||
Cenc,
|
||||
Cbcs,
|
||||
};
|
||||
|
||||
class CryptoTrack {
|
||||
public:
|
||||
CryptoTrack()
|
||||
: mCryptoScheme(CryptoScheme::None),
|
||||
mIVSize(0),
|
||||
mCryptByteBlock(0),
|
||||
mSkipByteBlock(0) {}
|
||||
CryptoScheme mCryptoScheme;
|
||||
CryptoTrack() : mValid(false), mMode(0), mIVSize(0) {}
|
||||
bool mValid;
|
||||
int32_t mMode;
|
||||
int32_t mIVSize;
|
||||
nsTArray<uint8_t> mKeyId;
|
||||
uint8_t mCryptByteBlock;
|
||||
uint8_t mSkipByteBlock;
|
||||
nsTArray<uint8_t> mConstantIV;
|
||||
|
||||
bool IsEncrypted() const { return mCryptoScheme != CryptoScheme::None; }
|
||||
};
|
||||
|
||||
class CryptoSample : public CryptoTrack {
|
||||
|
|
|
@ -1397,8 +1397,8 @@ void MediaFormatReader::MaybeResolveMetadataPromise() {
|
|||
}
|
||||
|
||||
bool MediaFormatReader::IsEncrypted() const {
|
||||
return (HasAudio() && mAudio.GetCurrentInfo()->mCrypto.IsEncrypted()) ||
|
||||
(HasVideo() && mVideo.GetCurrentInfo()->mCrypto.IsEncrypted());
|
||||
return (HasAudio() && mAudio.GetCurrentInfo()->mCrypto.mValid) ||
|
||||
(HasVideo() && mVideo.GetCurrentInfo()->mCrypto.mValid);
|
||||
}
|
||||
|
||||
void MediaFormatReader::OnDemuxerInitFailed(const MediaResult& aError) {
|
||||
|
@ -2006,8 +2006,7 @@ void MediaFormatReader::HandleDemuxedSamples(
|
|||
bool recyclable =
|
||||
StaticPrefs::MediaDecoderRecycleEnabled() &&
|
||||
decoder.mDecoder->SupportDecoderRecycling() &&
|
||||
(*info)->mCrypto.mCryptoScheme ==
|
||||
decoder.GetCurrentInfo()->mCrypto.mCryptoScheme &&
|
||||
(*info)->mCrypto.mValid == decoder.GetCurrentInfo()->mCrypto.mValid &&
|
||||
(*info)->mMimeType == decoder.GetCurrentInfo()->mMimeType;
|
||||
if (!recyclable && decoder.mTimeThreshold.isNothing() &&
|
||||
(decoder.mNextStreamSourceID.isNothing() ||
|
||||
|
|
|
@ -543,7 +543,7 @@ class MediaFormatReader final
|
|||
// Typically for audio, the number of channels and/or sampling rate can vary
|
||||
// between what was found in the metadata and what the decoder returned.
|
||||
const TrackInfo* GetWorkingInfo() const { return mWorkingInfo.get(); }
|
||||
bool IsEncrypted() const { return GetCurrentInfo()->mCrypto.IsEncrypted(); }
|
||||
bool IsEncrypted() const { return GetCurrentInfo()->mCrypto.mValid; }
|
||||
|
||||
// Used by the MDSM for logging purposes.
|
||||
Atomic<size_t> mSizeOfQueue;
|
||||
|
|
|
@ -394,8 +394,8 @@ class MediaInfo {
|
|||
}
|
||||
|
||||
bool IsEncrypted() const {
|
||||
return (HasAudio() && mAudio.mCrypto.IsEncrypted()) ||
|
||||
(HasVideo() && mVideo.mCrypto.IsEncrypted());
|
||||
return (HasAudio() && mAudio.mCrypto.mValid) ||
|
||||
(HasVideo() && mVideo.mCrypto.mValid);
|
||||
}
|
||||
|
||||
bool HasValidMedia() const { return HasVideo() || HasAudio(); }
|
||||
|
|
|
@ -245,35 +245,20 @@ bool ChromiumCDMParent::InitCDMInputBuffer(gmp::CDMInputBuffer& aBuffer,
|
|||
return false;
|
||||
}
|
||||
memcpy(shmem.get<uint8_t>(), aSample->Data(), aSample->Size());
|
||||
GMPEncryptionScheme encryptionScheme =
|
||||
GMPEncryptionScheme::kGMPEncryptionNone;
|
||||
switch (crypto.mCryptoScheme) {
|
||||
case CryptoScheme::None:
|
||||
break; // Default to none
|
||||
case CryptoScheme::Cenc:
|
||||
encryptionScheme = GMPEncryptionScheme::kGMPEncryptionCenc;
|
||||
break;
|
||||
case CryptoScheme::Cbcs:
|
||||
encryptionScheme = GMPEncryptionScheme::kGMPEncryptionCbcs;
|
||||
break;
|
||||
default:
|
||||
GMP_LOG(
|
||||
"InitCDMInputBuffer got unexpected encryption scheme with "
|
||||
"value of %" PRIu8 ". Treating as no encryption.",
|
||||
static_cast<uint8_t>(crypto.mCryptoScheme));
|
||||
MOZ_ASSERT_UNREACHABLE("Should not have unrecognized encryption type");
|
||||
break;
|
||||
}
|
||||
|
||||
aBuffer = gmp::CDMInputBuffer(
|
||||
shmem, crypto.mKeyId, crypto.mIV, aSample->mTime.ToMicroseconds(),
|
||||
aSample->mDuration.ToMicroseconds(), crypto.mPlainSizes,
|
||||
crypto.mEncryptedSizes, encryptionScheme);
|
||||
crypto.mEncryptedSizes,
|
||||
crypto.mValid ? GMPEncryptionScheme::kGMPEncryptionCenc
|
||||
: GMPEncryptionScheme::kGMPEncryptionNone);
|
||||
MOZ_ASSERT(
|
||||
aBuffer.mEncryptionScheme() == GMPEncryptionScheme::kGMPEncryptionNone ||
|
||||
aBuffer.mEncryptionScheme() ==
|
||||
GMPEncryptionScheme::kGMPEncryptionCenc,
|
||||
"aBuffer should use either no encryption or cenc, other kinds are not "
|
||||
"yet supported");
|
||||
"yet "
|
||||
"supported");
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ TEST(MP4Demuxer, Seek) {
|
|||
|
||||
static nsCString ToCryptoString(const CryptoSample& aCrypto) {
|
||||
nsCString res;
|
||||
if (aCrypto.IsEncrypted()) {
|
||||
res.AppendPrintf("%d ", aCrypto.mIVSize);
|
||||
if (aCrypto.mValid) {
|
||||
res.AppendPrintf("%d %d ", aCrypto.mMode, aCrypto.mIVSize);
|
||||
for (size_t i = 0; i < aCrypto.mKeyId.Length(); i++) {
|
||||
res.AppendPrintf("%02x", aCrypto.mKeyId[i]);
|
||||
}
|
||||
|
@ -189,125 +189,125 @@ static nsCString ToCryptoString(const CryptoSample& aCrypto) {
|
|||
|
||||
TEST(MP4Demuxer, CENCFragVideo) {
|
||||
const char* video[] = {
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000000 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000000 "
|
||||
"5,684 5,16980",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000450 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000450 "
|
||||
"5,1826",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000004c3 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000004c3 "
|
||||
"5,1215",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000050f "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000050f "
|
||||
"5,1302",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000561 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000561 "
|
||||
"5,939",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000059c "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000059c "
|
||||
"5,763",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000005cc "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000005cc "
|
||||
"5,672",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000005f6 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000005f6 "
|
||||
"5,748",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000625 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000625 "
|
||||
"5,1025",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000666 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000666 "
|
||||
"5,730",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000694 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000694 "
|
||||
"5,897",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000006cd "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000006cd "
|
||||
"5,643",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000006f6 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000006f6 "
|
||||
"5,556",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000719 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000719 "
|
||||
"5,527",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000073a "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000073a "
|
||||
"5,606",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000760 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000760 "
|
||||
"5,701",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000078c "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000078c "
|
||||
"5,531",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007ae "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007ae "
|
||||
"5,562",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007d2 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007d2 "
|
||||
"5,576",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007f6 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000007f6 "
|
||||
"5,514",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000817 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000817 "
|
||||
"5,404",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000831 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000831 "
|
||||
"5,635",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000859 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000859 "
|
||||
"5,433",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000875 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000875 "
|
||||
"5,478",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000893 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000893 "
|
||||
"5,474",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008b1 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008b1 "
|
||||
"5,462",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008ce "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008ce "
|
||||
"5,473",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008ec "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000008ec "
|
||||
"5,437",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000908 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000908 "
|
||||
"5,418",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000923 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000923 "
|
||||
"5,475",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000941 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000941 "
|
||||
"5,23133",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000ee7 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000ee7 "
|
||||
"5,475",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f05 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f05 "
|
||||
"5,402",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f1f "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f1f "
|
||||
"5,415",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f39 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f39 "
|
||||
"5,408",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f53 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f53 "
|
||||
"5,442",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f6f "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f6f "
|
||||
"5,385",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f88 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f88 "
|
||||
"5,368",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f9f "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000f9f "
|
||||
"5,354",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fb6 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fb6 "
|
||||
"5,400",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fcf "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fcf "
|
||||
"5,399",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fe8 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000000fe8 "
|
||||
"5,1098",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000102d "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000102d "
|
||||
"5,1508",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000108c "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000108c "
|
||||
"5,1345",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000010e1 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000010e1 "
|
||||
"5,1945",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000115b "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000115b "
|
||||
"5,1824",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000011cd "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000011cd "
|
||||
"5,2133",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001253 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001253 "
|
||||
"5,2486",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000012ef "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000012ef "
|
||||
"5,1739",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000135c "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000135c "
|
||||
"5,1836",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000013cf "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000013cf "
|
||||
"5,2367",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001463 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001463 "
|
||||
"5,2571",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001504 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001504 "
|
||||
"5,3008",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000015c0 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000015c0 "
|
||||
"5,3255",
|
||||
"16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000168c "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 0000000000000000000000000000168c "
|
||||
"5,3225",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001756 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001756 "
|
||||
"5,3118",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001819 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001819 "
|
||||
"5,2407",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000018b0 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000018b0 "
|
||||
"5,2400",
|
||||
"16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001946 "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 00000000000000000000000000001946 "
|
||||
"5,2158",
|
||||
"16 7e571d037e571d037e571d037e571d03 000000000000000000000000000019cd "
|
||||
"1 16 7e571d037e571d037e571d037e571d03 000000000000000000000000000019cd "
|
||||
"5,2392",
|
||||
};
|
||||
|
||||
|
@ -334,193 +334,193 @@ TEST(MP4Demuxer, CENCFragVideo) {
|
|||
|
||||
TEST(MP4Demuxer, CENCFragAudio) {
|
||||
const char* audio[] = {
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000000 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000000 "
|
||||
"0,281",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000012 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000012 "
|
||||
"0,257",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000023 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000023 "
|
||||
"0,246",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000033 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000033 "
|
||||
"0,257",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000044 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000044 "
|
||||
"0,260",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000055 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000055 "
|
||||
"0,260",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000066 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000066 "
|
||||
"0,272",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000077 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000077 "
|
||||
"0,280",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000089 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000089 "
|
||||
"0,284",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000009b "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000009b "
|
||||
"0,290",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000ae "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000ae "
|
||||
"0,278",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000c0 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000c0 "
|
||||
"0,268",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000d1 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000d1 "
|
||||
"0,307",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000e5 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000e5 "
|
||||
"0,290",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000f8 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000000f8 "
|
||||
"0,304",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000010b "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000010b "
|
||||
"0,316",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000011f "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000011f "
|
||||
"0,308",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000133 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000133 "
|
||||
"0,301",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000146 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000146 "
|
||||
"0,318",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000015a "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000015a "
|
||||
"0,311",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000016e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000016e "
|
||||
"0,303",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000181 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000181 "
|
||||
"0,325",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000196 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000196 "
|
||||
"0,334",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001ab "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001ab "
|
||||
"0,344",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001c1 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001c1 "
|
||||
"0,344",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001d7 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001d7 "
|
||||
"0,387",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001f0 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000001f0 "
|
||||
"0,396",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000209 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000209 "
|
||||
"0,368",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000220 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000220 "
|
||||
"0,373",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000238 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000238 "
|
||||
"0,425",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000253 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000253 "
|
||||
"0,428",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000026e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000026e "
|
||||
"0,426",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000289 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000289 "
|
||||
"0,427",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002a4 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002a4 "
|
||||
"0,424",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002bf "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002bf "
|
||||
"0,447",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002db "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002db "
|
||||
"0,446",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002f7 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000002f7 "
|
||||
"0,442",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000313 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000313 "
|
||||
"0,444",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000032f "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000032f "
|
||||
"0,374",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000347 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000347 "
|
||||
"0,405",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000361 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000361 "
|
||||
"0,372",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000379 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000379 "
|
||||
"0,395",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000392 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000392 "
|
||||
"0,435",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003ae "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003ae "
|
||||
"0,426",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003c9 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003c9 "
|
||||
"0,430",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003e4 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003e4 "
|
||||
"0,390",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003fd "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000003fd "
|
||||
"0,335",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000412 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000412 "
|
||||
"0,339",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000428 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000428 "
|
||||
"0,352",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000043e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000043e "
|
||||
"0,364",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000455 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000455 "
|
||||
"0,398",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000046e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000046e "
|
||||
"0,451",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000048b "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000048b "
|
||||
"0,448",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004a7 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004a7 "
|
||||
"0,436",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004c3 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004c3 "
|
||||
"0,424",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004de "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004de "
|
||||
"0,428",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004f9 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000004f9 "
|
||||
"0,413",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000513 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000513 "
|
||||
"0,430",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000052e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000052e "
|
||||
"0,450",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000054b "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000054b "
|
||||
"0,386",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000564 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000564 "
|
||||
"0,320",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000578 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000578 "
|
||||
"0,347",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000058e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000058e "
|
||||
"0,382",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005a6 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005a6 "
|
||||
"0,437",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005c2 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005c2 "
|
||||
"0,387",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005db "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005db "
|
||||
"0,340",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005f1 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000005f1 "
|
||||
"0,337",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000607 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000607 "
|
||||
"0,389",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000620 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000620 "
|
||||
"0,428",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000063b "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000063b "
|
||||
"0,426",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000656 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000656 "
|
||||
"0,446",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000672 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000672 "
|
||||
"0,456",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000068f "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000068f "
|
||||
"0,468",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006ad "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006ad "
|
||||
"0,468",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006cb "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006cb "
|
||||
"0,463",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006e8 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000006e8 "
|
||||
"0,467",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000706 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000706 "
|
||||
"0,460",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000723 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000723 "
|
||||
"0,446",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000073f "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000073f "
|
||||
"0,453",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000075c "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000075c "
|
||||
"0,448",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000778 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000778 "
|
||||
"0,446",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000794 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000794 "
|
||||
"0,439",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007b0 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007b0 "
|
||||
"0,436",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007cc "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007cc "
|
||||
"0,441",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007e8 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000007e8 "
|
||||
"0,465",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000806 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000806 "
|
||||
"0,448",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000822 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000822 "
|
||||
"0,448",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000083e "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000083e "
|
||||
"0,469",
|
||||
"16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000085c "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 0000000000000000000000000000085c "
|
||||
"0,431",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000877 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000877 "
|
||||
"0,437",
|
||||
"16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000893 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 00000000000000000000000000000893 "
|
||||
"0,474",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008b1 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008b1 "
|
||||
"0,436",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008cd "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008cd "
|
||||
"0,433",
|
||||
"16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008e9 "
|
||||
"1 16 7e571d047e571d047e571d047e571d04 000000000000000000000000000008e9 "
|
||||
"0,481",
|
||||
};
|
||||
|
||||
|
|
|
@ -47,29 +47,14 @@ bool MP4AudioInfo::IsValid() const {
|
|||
mExtendedProfile > 0);
|
||||
}
|
||||
|
||||
static MediaResult UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig,
|
||||
const Mp4parseSinfInfo& aSinf) {
|
||||
static void UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig,
|
||||
const Mp4parseSinfInfo& aSinf) {
|
||||
if (aSinf.is_encrypted != 0) {
|
||||
if (aSinf.scheme_type == MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CENC) {
|
||||
aConfig.mCrypto.mCryptoScheme = CryptoScheme::Cenc;
|
||||
} else if (aSinf.scheme_type == MP4_PARSE_ENCRYPTION_SCHEME_TYPE_CBCS) {
|
||||
aConfig.mCrypto.mCryptoScheme = CryptoScheme::Cbcs;
|
||||
} else {
|
||||
// Unsupported encryption type;
|
||||
return MediaResult(
|
||||
NS_ERROR_DOM_MEDIA_METADATA_ERR,
|
||||
RESULT_DETAIL(
|
||||
"Unsupported encryption scheme encountered aSinf.scheme_type=%d",
|
||||
static_cast<int>(aSinf.scheme_type)));
|
||||
}
|
||||
aConfig.mCrypto.mValid = true;
|
||||
aConfig.mCrypto.mMode = aSinf.is_encrypted;
|
||||
aConfig.mCrypto.mIVSize = aSinf.iv_size;
|
||||
aConfig.mCrypto.mKeyId.AppendElements(aSinf.kid.data, aSinf.kid.length);
|
||||
aConfig.mCrypto.mCryptByteBlock = aSinf.crypt_byte_block;
|
||||
aConfig.mCrypto.mSkipByteBlock = aSinf.skip_byte_block;
|
||||
aConfig.mCrypto.mConstantIV.AppendElements(aSinf.constant_iv.data,
|
||||
aSinf.constant_iv.length);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
MediaResult MP4AudioInfo::Update(const Mp4parseTrackInfo* track,
|
||||
|
@ -102,9 +87,7 @@ MediaResult MP4AudioInfo::Update(const Mp4parseTrackInfo* track,
|
|||
RESULT_DETAIL(
|
||||
"Multiple crypto info encountered while updating audio track"));
|
||||
}
|
||||
auto rv =
|
||||
UpdateTrackProtectedInfo(*this, audio->sample_info[i].protected_data);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
UpdateTrackProtectedInfo(*this, audio->sample_info[i].protected_data);
|
||||
hasCrypto = true;
|
||||
}
|
||||
}
|
||||
|
@ -188,9 +171,7 @@ MediaResult MP4VideoInfo::Update(const Mp4parseTrackInfo* track,
|
|||
RESULT_DETAIL(
|
||||
"Multiple crypto info encountered while updating video track"));
|
||||
}
|
||||
auto rv =
|
||||
UpdateTrackProtectedInfo(*this, video->sample_info[i].protected_data);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
UpdateTrackProtectedInfo(*this, video->sample_info[i].protected_data);
|
||||
hasCrypto = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,132 +111,75 @@ already_AddRefed<MediaRawData> SampleIterator::GetNext() {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
MoofParser* moofParser = mIndex->mMoofParser.get();
|
||||
if (!moofParser) {
|
||||
// File is not fragmented, we can't have crypto, just early return.
|
||||
Next();
|
||||
return sample.forget();
|
||||
}
|
||||
|
||||
SampleDescriptionEntry* sampleDescriptionEntry = GetSampleDescriptionEntry();
|
||||
if (!sampleDescriptionEntry) {
|
||||
// For the file to be valid the tfhd must reference a sample description
|
||||
// entry.
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Match scheme type box to enum representation.
|
||||
CryptoScheme cryptoScheme = CryptoScheme::None;
|
||||
// If a fragment references a sample description without crypto info them we
|
||||
// treat it as unencrypted, even if other fragments may be encrypted.
|
||||
if (sampleDescriptionEntry->mIsEncryptedEntry) {
|
||||
if (!moofParser->mSinf.IsValid()) {
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Sample description entry reports sample is encrypted, but no "
|
||||
"sinf was parsed!");
|
||||
return nullptr;
|
||||
}
|
||||
if (moofParser->mSinf.mDefaultEncryptionType == AtomType("cenc")) {
|
||||
cryptoScheme = CryptoScheme::Cenc;
|
||||
writer->mCrypto.mCryptoScheme = CryptoScheme::Cenc;
|
||||
writer->mCrypto.mInitDataType = NS_LITERAL_STRING("cenc");
|
||||
} else if (moofParser->mSinf.mDefaultEncryptionType == AtomType("cbcs")) {
|
||||
cryptoScheme = CryptoScheme::Cbcs;
|
||||
writer->mCrypto.mCryptoScheme = CryptoScheme::Cbcs;
|
||||
writer->mCrypto.mInitDataType = NS_LITERAL_STRING("cbcs");
|
||||
} else {
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Sample description entry reports sample is encrypted, but no "
|
||||
"scheme, or an unsupported shceme is in use!");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
if (mCurrentSample == 0) {
|
||||
const nsTArray<Moof>& moofs = moofParser->Moofs();
|
||||
if (mCurrentSample == 0 && mIndex->mMoofParser) {
|
||||
const nsTArray<Moof>& moofs = mIndex->mMoofParser->Moofs();
|
||||
MOZ_ASSERT(mCurrentMoof < moofs.Length());
|
||||
const Moof* currentMoof = &moofs[mCurrentMoof];
|
||||
if (!currentMoof->mPsshes.IsEmpty()) {
|
||||
MOZ_ASSERT(sampleDescriptionEntry->mIsEncryptedEntry,
|
||||
"Unencrypted fragments should not contain pssh boxes");
|
||||
MOZ_ASSERT(cryptoScheme != CryptoScheme::None);
|
||||
// This Moof contained crypto init data. Report that. We only report
|
||||
// the init data on the Moof's first sample, to avoid reporting it more
|
||||
// than once per Moof.
|
||||
writer->mCrypto.mValid = true;
|
||||
writer->mCrypto.mInitDatas.AppendElements(currentMoof->mPsshes);
|
||||
writer->mCrypto.mInitDataType = NS_LITERAL_STRING("cenc");
|
||||
}
|
||||
}
|
||||
|
||||
if (sampleDescriptionEntry->mIsEncryptedEntry) {
|
||||
writer->mCrypto.mCryptoScheme = cryptoScheme;
|
||||
if (!s->mCencRange.IsEmpty()) {
|
||||
MoofParser* parser = mIndex->mMoofParser.get();
|
||||
|
||||
if (!parser || !parser->mSinf.IsValid()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint8_t ivSize = parser->mSinf.mDefaultIVSize;
|
||||
|
||||
// The size comes from an 8 bit field
|
||||
AutoTArray<uint8_t, 256> cenc;
|
||||
cenc.SetLength(s->mCencRange.Length());
|
||||
if (!mIndex->mSource->ReadAt(s->mCencRange.mStart, cenc.Elements(),
|
||||
cenc.Length(), &bytesRead) ||
|
||||
bytesRead != cenc.Length()) {
|
||||
return nullptr;
|
||||
}
|
||||
BufferReader reader(cenc);
|
||||
writer->mCrypto.mValid = true;
|
||||
|
||||
MOZ_ASSERT(writer->mCrypto.mKeyId.IsEmpty(),
|
||||
"Sample should not already have a key ID");
|
||||
MOZ_ASSERT(writer->mCrypto.mConstantIV.IsEmpty(),
|
||||
"Sample should not already have a constant IV");
|
||||
CencSampleEncryptionInfoEntry* sampleInfo = GetSampleEncryptionEntry();
|
||||
if (sampleInfo) {
|
||||
// Use sample group information if present, this supersedes track level
|
||||
// information.
|
||||
writer->mCrypto.mKeyId.AppendElements(sampleInfo->mKeyId);
|
||||
writer->mCrypto.mIVSize = sampleInfo->mIVSize;
|
||||
writer->mCrypto.mCryptByteBlock = sampleInfo->mCryptByteBlock;
|
||||
writer->mCrypto.mSkipByteBlock = sampleInfo->mSkipByteBlock;
|
||||
writer->mCrypto.mConstantIV.AppendElements(sampleInfo->mConsantIV);
|
||||
} else {
|
||||
// Use the crypto info from track metadata
|
||||
writer->mCrypto.mKeyId.AppendElements(moofParser->mSinf.mDefaultKeyID,
|
||||
16);
|
||||
writer->mCrypto.mIVSize = moofParser->mSinf.mDefaultIVSize;
|
||||
writer->mCrypto.mCryptByteBlock =
|
||||
moofParser->mSinf.mDefaultCryptByteBlock;
|
||||
writer->mCrypto.mSkipByteBlock = moofParser->mSinf.mDefaultSkipByteBlock;
|
||||
writer->mCrypto.mConstantIV.AppendElements(
|
||||
moofParser->mSinf.mDefaultConstantIV);
|
||||
ivSize = sampleInfo->mIVSize;
|
||||
}
|
||||
|
||||
MOZ_ASSERT((writer->mCrypto.mIVSize == 0 &&
|
||||
!writer->mCrypto.mConstantIV.IsEmpty()) ||
|
||||
!s->mCencRange.IsEmpty(),
|
||||
"Crypto information should contain either a constant IV, or "
|
||||
"have auxiliary information that will contain an IV");
|
||||
// Parse auxiliary information if present
|
||||
if (!s->mCencRange.IsEmpty()) {
|
||||
// The size comes from an 8 bit field
|
||||
AutoTArray<uint8_t, 256> cencAuxInfo;
|
||||
cencAuxInfo.SetLength(s->mCencRange.Length());
|
||||
if (!mIndex->mSource->ReadAt(s->mCencRange.mStart, cencAuxInfo.Elements(),
|
||||
cencAuxInfo.Length(), &bytesRead) ||
|
||||
bytesRead != cencAuxInfo.Length()) {
|
||||
return nullptr;
|
||||
}
|
||||
BufferReader reader(cencAuxInfo);
|
||||
if (!reader.ReadArray(writer->mCrypto.mIV, writer->mCrypto.mIVSize)) {
|
||||
writer->mCrypto.mIVSize = ivSize;
|
||||
|
||||
if (!reader.ReadArray(writer->mCrypto.mIV, ivSize)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto res = reader.ReadU16();
|
||||
if (res.isOk() && res.unwrap() > 0) {
|
||||
uint16_t count = res.unwrap();
|
||||
|
||||
if (reader.Remaining() < count * 6) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Parse the auxiliary information for subsample information
|
||||
auto res = reader.ReadU16();
|
||||
if (res.isOk() && res.unwrap() > 0) {
|
||||
uint16_t count = res.unwrap();
|
||||
|
||||
if (reader.Remaining() < count * 6) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
auto res_16 = reader.ReadU16();
|
||||
auto res_32 = reader.ReadU32();
|
||||
if (res_16.isErr() || res_32.isErr()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
auto res_16 = reader.ReadU16();
|
||||
auto res_32 = reader.ReadU32();
|
||||
if (res_16.isErr() || res_32.isErr()) {
|
||||
return nullptr;
|
||||
}
|
||||
writer->mCrypto.mPlainSizes.AppendElement(res_16.unwrap());
|
||||
writer->mCrypto.mEncryptedSizes.AppendElement(res_32.unwrap());
|
||||
}
|
||||
} else {
|
||||
// No subsample information means the entire sample is encrypted.
|
||||
writer->mCrypto.mPlainSizes.AppendElement(0);
|
||||
writer->mCrypto.mEncryptedSizes.AppendElement(sample->Size());
|
||||
writer->mCrypto.mPlainSizes.AppendElement(res_16.unwrap());
|
||||
writer->mCrypto.mEncryptedSizes.AppendElement(res_32.unwrap());
|
||||
}
|
||||
} else {
|
||||
// No subsample information means the entire sample is encrypted.
|
||||
writer->mCrypto.mPlainSizes.AppendElement(0);
|
||||
writer->mCrypto.mEncryptedSizes.AppendElement(sample->Size());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -245,24 +188,6 @@ already_AddRefed<MediaRawData> SampleIterator::GetNext() {
|
|||
return sample.forget();
|
||||
}
|
||||
|
||||
SampleDescriptionEntry* SampleIterator::GetSampleDescriptionEntry() {
|
||||
nsTArray<Moof>& moofs = mIndex->mMoofParser->Moofs();
|
||||
Moof& currentMoof = moofs[mCurrentMoof];
|
||||
uint32_t sampleDescriptionIndex =
|
||||
currentMoof.mTfhd.mDefaultSampleDescriptionIndex;
|
||||
// Mp4 indices start at 1, shift down 1 so we index our array correctly.
|
||||
sampleDescriptionIndex--;
|
||||
FallibleTArray<SampleDescriptionEntry>& sampleDescriptions =
|
||||
mIndex->mMoofParser->mSampleDescriptions;
|
||||
if (sampleDescriptionIndex >= sampleDescriptions.Length()) {
|
||||
MOZ_ASSERT_UNREACHABLE(
|
||||
"Should always be able to find the appropriate sample description! "
|
||||
"Malformed mp4?");
|
||||
return nullptr;
|
||||
}
|
||||
return &sampleDescriptions[sampleDescriptionIndex];
|
||||
}
|
||||
|
||||
CencSampleEncryptionInfoEntry* SampleIterator::GetSampleEncryptionEntry() {
|
||||
nsTArray<Moof>& moofs = mIndex->mMoofParser->Moofs();
|
||||
Moof* currentMoof = &moofs[mCurrentMoof];
|
||||
|
|
|
@ -36,9 +36,6 @@ class SampleIterator {
|
|||
private:
|
||||
Sample* Get();
|
||||
|
||||
// Gets the sample description entry for the current moof, or nullptr if
|
||||
// called without a valid current moof.
|
||||
SampleDescriptionEntry* GetSampleDescriptionEntry();
|
||||
CencSampleEncryptionInfoEntry* GetSampleEncryptionEntry();
|
||||
|
||||
void Next();
|
||||
|
|
|
@ -422,7 +422,7 @@ already_AddRefed<MediaRawData> MP4TrackDemuxer::GetNextSample() {
|
|||
}
|
||||
if (mInfo->GetAsVideoInfo()) {
|
||||
sample->mExtraData = mInfo->GetAsVideoInfo()->mExtraData;
|
||||
if (mIsH264 && !sample->mCrypto.IsEncrypted()) {
|
||||
if (mIsH264 && !sample->mCrypto.mValid) {
|
||||
H264::FrameType type = H264::GetFrameType(sample);
|
||||
switch (type) {
|
||||
case H264::FrameType::I_FRAME:
|
||||
|
@ -458,6 +458,17 @@ already_AddRefed<MediaRawData> MP4TrackDemuxer::GetNextSample() {
|
|||
}
|
||||
}
|
||||
|
||||
if (sample->mCrypto.mValid) {
|
||||
UniquePtr<MediaRawDataWriter> writer(sample->CreateWriter());
|
||||
writer->mCrypto.mMode = mInfo->mCrypto.mMode;
|
||||
|
||||
// Only use the default key parsed from the moov if we haven't already got
|
||||
// one from the sample group description.
|
||||
if (writer->mCrypto.mKeyId.Length() == 0) {
|
||||
writer->mCrypto.mIVSize = mInfo->mCrypto.mIVSize;
|
||||
writer->mCrypto.mKeyId.AppendElements(mInfo->mCrypto.mKeyId);
|
||||
}
|
||||
}
|
||||
return sample.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -351,7 +351,7 @@ MP4Metadata::ResultAndTrackInfo MP4Metadata::GetTrackInfo(
|
|||
}
|
||||
auto track = mozilla::MakeUnique<MP4AudioInfo>();
|
||||
MediaResult updateStatus = track->Update(&info, &audio);
|
||||
if (NS_FAILED(updateStatus)) {
|
||||
if (updateStatus != NS_OK) {
|
||||
MOZ_LOG(gMP4MetadataLog, LogLevel::Warning,
|
||||
("Updating audio track failed with %s",
|
||||
updateStatus.Message().get()));
|
||||
|
@ -378,7 +378,7 @@ MP4Metadata::ResultAndTrackInfo MP4Metadata::GetTrackInfo(
|
|||
}
|
||||
auto track = mozilla::MakeUnique<MP4VideoInfo>();
|
||||
MediaResult updateStatus = track->Update(&info, &video);
|
||||
if (NS_FAILED(updateStatus)) {
|
||||
if (updateStatus != NS_OK) {
|
||||
MOZ_LOG(gMP4MetadataLog, LogLevel::Warning,
|
||||
("Updating video track failed with %s",
|
||||
updateStatus.Message().get()));
|
||||
|
|
|
@ -423,7 +423,7 @@ Moof::Moof(Box& aBox, Trex& aTrex, Mvhd& aMvhd, Mdhd& aMdhd, Edts& aEdts,
|
|||
ctsOrder[0]->mCompositionRange.start,
|
||||
ctsOrder.LastElement()->mCompositionRange.end);
|
||||
}
|
||||
ProcessCencAuxInfo(aSinf.mDefaultEncryptionType);
|
||||
ProcessCenc();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -492,9 +492,9 @@ bool Moof::GetAuxInfo(AtomType aType,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool Moof::ProcessCencAuxInfo(AtomType aScheme) {
|
||||
bool Moof::ProcessCenc() {
|
||||
FallibleTArray<MediaByteRange> cencRanges;
|
||||
if (!GetAuxInfo(aScheme, &cencRanges) ||
|
||||
if (!GetAuxInfo(AtomType("cenc"), &cencRanges) ||
|
||||
cencRanges.Length() != mIndex.Length()) {
|
||||
return false;
|
||||
}
|
||||
|
@ -1068,47 +1068,28 @@ Result<Ok, nsresult> CencSampleEncryptionInfoEntry::Init(BoxReader& aReader) {
|
|||
// Skip a reserved byte.
|
||||
MOZ_TRY(aReader->ReadU8());
|
||||
|
||||
uint8_t pattern;
|
||||
MOZ_TRY_VAR(pattern, aReader->ReadU8());
|
||||
mCryptByteBlock = pattern >> 4;
|
||||
mSkipByteBlock = pattern & 0x0f;
|
||||
|
||||
uint8_t isEncrypted;
|
||||
MOZ_TRY_VAR(isEncrypted, aReader->ReadU8());
|
||||
mIsEncrypted = isEncrypted != 0;
|
||||
uint8_t possiblePatternInfo;
|
||||
MOZ_TRY_VAR(possiblePatternInfo, aReader->ReadU8());
|
||||
uint8_t flag;
|
||||
MOZ_TRY_VAR(flag, aReader->ReadU8());
|
||||
|
||||
MOZ_TRY_VAR(mIVSize, aReader->ReadU8());
|
||||
|
||||
// Read the key id.
|
||||
if (!mKeyId.SetLength(kKeyIdSize, fallible)) {
|
||||
LOG(CencSampleEncryptionInfoEntry, "OOM");
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
uint8_t key;
|
||||
for (uint32_t i = 0; i < kKeyIdSize; ++i) {
|
||||
MOZ_TRY_VAR(mKeyId.ElementAt(i), aReader->ReadU8());
|
||||
MOZ_TRY_VAR(key, aReader->ReadU8());
|
||||
mKeyId.AppendElement(key);
|
||||
}
|
||||
|
||||
mIsEncrypted = flag != 0;
|
||||
|
||||
if (mIsEncrypted) {
|
||||
if (mIVSize != 8 && mIVSize != 16) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
} else if (mIVSize != 0) {
|
||||
// Protected content with 0 sized IV indicates a constant IV is present.
|
||||
// This is used for the cbcs scheme.
|
||||
uint8_t constantIVSize;
|
||||
MOZ_TRY_VAR(constantIVSize, aReader->ReadU8());
|
||||
if (constantIVSize != 8 && constantIVSize != 16) {
|
||||
LOG(CencSampleEncryptionInfoEntry, "Unexpected constantIVSize: %" PRIu8,
|
||||
constantIVSize);
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
if (!mConsantIV.SetLength(constantIVSize, mozilla::fallible)) {
|
||||
LOG(CencSampleEncryptionInfoEntry, "OOM");
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
for (uint32_t i = 0; i < constantIVSize; ++i) {
|
||||
MOZ_TRY_VAR(mConsantIV.ElementAt(i), aReader->ReadU8());
|
||||
}
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
return Ok();
|
||||
|
|
|
@ -185,10 +185,6 @@ class Sbgp final : public Atom // SampleToGroup box.
|
|||
Result<Ok, nsresult> Parse(Box& aBox);
|
||||
};
|
||||
|
||||
// Stores information form CencSampleEncryptionInformationGroupEntry (seig).
|
||||
// Cenc here refers to the common encryption standard, rather than the specific
|
||||
// cenc scheme from that standard. This structure is used for all encryption
|
||||
// schemes. I.e. it is used for both cenc and cbcs, not just cenc.
|
||||
struct CencSampleEncryptionInfoEntry final {
|
||||
public:
|
||||
CencSampleEncryptionInfoEntry() {}
|
||||
|
@ -198,9 +194,6 @@ struct CencSampleEncryptionInfoEntry final {
|
|||
bool mIsEncrypted = false;
|
||||
uint8_t mIVSize = 0;
|
||||
nsTArray<uint8_t> mKeyId;
|
||||
uint8_t mCryptByteBlock = 0;
|
||||
uint8_t mSkipByteBlock = 0;
|
||||
nsTArray<uint8_t> mConsantIV;
|
||||
};
|
||||
|
||||
class Sgpd final : public Atom // SampleGroupDescription box.
|
||||
|
@ -253,13 +246,7 @@ class Moof final : public Atom {
|
|||
Result<Ok, nsresult> ParseTrun(Box& aBox, Mvhd& aMvhd, Mdhd& aMdhd,
|
||||
Edts& aEdts, uint64_t* aDecodeTime,
|
||||
bool aIsAudio);
|
||||
// Process the sample auxiliary information used by common encryption.
|
||||
// aScheme is used to select the appropriate auxiliary information and should
|
||||
// be set based on the encryption scheme used by the track being processed.
|
||||
// Note, the term cenc here refers to the standard, not the specific scheme
|
||||
// from that standard. I.e. this function is used to handle up auxiliary
|
||||
// information from the cenc and cbcs schemes.
|
||||
bool ProcessCencAuxInfo(AtomType aScheme);
|
||||
bool ProcessCenc();
|
||||
uint64_t mMaxRoundingError;
|
||||
};
|
||||
|
||||
|
|
|
@ -55,40 +55,12 @@ Result<Ok, nsresult> SinfParser::ParseTenc(Box& aBox) {
|
|||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
|
||||
uint32_t flags;
|
||||
MOZ_TRY_VAR(flags, reader->ReadU32());
|
||||
uint8_t version = flags >> 24;
|
||||
MOZ_TRY(reader->ReadU32()); // flags -- ignore
|
||||
|
||||
// Skip reserved byte
|
||||
MOZ_TRY(reader->ReadU8());
|
||||
if (version >= 1) {
|
||||
uint8_t pattern;
|
||||
MOZ_TRY_VAR(pattern, reader->ReadU8());
|
||||
mSinf.mDefaultCryptByteBlock = pattern >> 4;
|
||||
mSinf.mDefaultSkipByteBlock = pattern & 0x0f;
|
||||
} else {
|
||||
// Reserved if version is less than 1
|
||||
MOZ_TRY(reader->ReadU8());
|
||||
mSinf.mDefaultCryptByteBlock = 0;
|
||||
mSinf.mDefaultSkipByteBlock = 0;
|
||||
}
|
||||
|
||||
uint8_t isEncrypted;
|
||||
MOZ_TRY_VAR(isEncrypted, reader->ReadU8());
|
||||
uint32_t isEncrypted;
|
||||
MOZ_TRY_VAR(isEncrypted, reader->ReadU24());
|
||||
MOZ_TRY_VAR(mSinf.mDefaultIVSize, reader->ReadU8());
|
||||
memcpy(mSinf.mDefaultKeyID, reader->Read(16), 16);
|
||||
|
||||
if (isEncrypted && mSinf.mDefaultIVSize == 0) {
|
||||
uint8_t defaultConstantIVSize;
|
||||
MOZ_TRY_VAR(defaultConstantIVSize, reader->ReadU8());
|
||||
if (!mSinf.mDefaultConstantIV.SetLength(defaultConstantIVSize,
|
||||
mozilla::fallible)) {
|
||||
return Err(NS_ERROR_FAILURE);
|
||||
}
|
||||
for (uint8_t i = 0; i < defaultConstantIVSize; i++) {
|
||||
MOZ_TRY_VAR(mSinf.mDefaultConstantIV.ElementAt(i), reader->ReadU8());
|
||||
}
|
||||
}
|
||||
return Ok();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,25 +15,16 @@ class Box;
|
|||
|
||||
class Sinf : public Atom {
|
||||
public:
|
||||
Sinf()
|
||||
: mDefaultIVSize(0),
|
||||
mDefaultEncryptionType(),
|
||||
mDefaultCryptByteBlock(0),
|
||||
mDefaultSkipByteBlock(0) {}
|
||||
Sinf() : mDefaultIVSize(0), mDefaultEncryptionType() {}
|
||||
explicit Sinf(Box& aBox);
|
||||
|
||||
bool IsValid() override {
|
||||
return !!mDefaultEncryptionType && // Should have an encryption scheme
|
||||
(mDefaultIVSize > 0 || // and either a default IV size
|
||||
mDefaultConstantIV.Length() > 0); // or a constant IV.
|
||||
virtual bool IsValid() override {
|
||||
return !!mDefaultIVSize && !!mDefaultEncryptionType;
|
||||
}
|
||||
|
||||
uint8_t mDefaultIVSize;
|
||||
AtomType mDefaultEncryptionType;
|
||||
uint8_t mDefaultKeyID[16];
|
||||
uint8_t mDefaultCryptByteBlock;
|
||||
uint8_t mDefaultSkipByteBlock;
|
||||
nsTArray<uint8_t> mDefaultConstantIV;
|
||||
};
|
||||
|
||||
class SinfParser {
|
||||
|
|
|
@ -197,7 +197,7 @@ already_AddRefed<MediaDataDecoder> PDMFactory::CreateDecoder(
|
|||
}
|
||||
|
||||
const TrackInfo& config = aParams.mConfig;
|
||||
bool isEncrypted = mEMEPDM && config.mCrypto.IsEncrypted();
|
||||
bool isEncrypted = mEMEPDM && config.mCrypto.mValid;
|
||||
|
||||
if (isEncrypted) {
|
||||
return CreateDecoderWithPDM(mEMEPDM, aParams);
|
||||
|
|
|
@ -53,7 +53,7 @@ bool Adts::ConvertSample(uint16_t aChannelCount, int8_t aFrequencyIndex,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (aSample->mCrypto.IsEncrypted()) {
|
||||
if (aSample->mCrypto.mValid) {
|
||||
if (aSample->mCrypto.mPlainSizes.Length() == 0) {
|
||||
writer->mCrypto.mPlainSizes.AppendElement(kADTSHeaderSize);
|
||||
writer->mCrypto.mEncryptedSizes.AppendElement(aSample->Size() -
|
||||
|
@ -82,7 +82,7 @@ bool Adts::RevertSample(MediaRawData* aSample) {
|
|||
UniquePtr<MediaRawDataWriter> writer(aSample->CreateWriter());
|
||||
writer->PopFront(kADTSHeaderSize);
|
||||
|
||||
if (aSample->mCrypto.IsEncrypted()) {
|
||||
if (aSample->mCrypto.mValid) {
|
||||
if (aSample->mCrypto.mPlainSizes.Length() > 0 &&
|
||||
writer->mCrypto.mPlainSizes[0] >= kADTSHeaderSize) {
|
||||
writer->mCrypto.mPlainSizes[0] -= kADTSHeaderSize;
|
||||
|
|
|
@ -70,7 +70,7 @@ Result<Ok, nsresult> AnnexB::ConvertSampleToAnnexB(
|
|||
// offsets. So we need to account for the extra bytes by increasing
|
||||
// the length of the first clear data subsample. Otherwise decryption
|
||||
// will fail.
|
||||
if (aSample->mCrypto.IsEncrypted()) {
|
||||
if (aSample->mCrypto.mValid) {
|
||||
if (aSample->mCrypto.mPlainSizes.Length() == 0) {
|
||||
samplewriter->mCrypto.mPlainSizes.AppendElement(annexB->Length());
|
||||
samplewriter->mCrypto.mEncryptedSizes.AppendElement(
|
||||
|
|
|
@ -804,7 +804,7 @@ static int32_t ConditionDimension(float aValue) {
|
|||
int nalLenSize = ((*aSample->mExtraData)[4] & 3) + 1;
|
||||
|
||||
size_t sampleSize = aSample->Size();
|
||||
if (aSample->mCrypto.IsEncrypted()) {
|
||||
if (aSample->mCrypto.mValid) {
|
||||
// The content is encrypted, we can only parse the non-encrypted data.
|
||||
MOZ_ASSERT(aSample->mCrypto.mPlainSizes.Length() > 0);
|
||||
if (aSample->mCrypto.mPlainSizes.Length() == 0 ||
|
||||
|
|
|
@ -376,7 +376,7 @@ static already_AddRefed<MediaDataDecoderProxy> CreateDecoderWrapper(
|
|||
|
||||
already_AddRefed<MediaDataDecoder> EMEDecoderModule::CreateVideoDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
MOZ_ASSERT(aParams.mConfig.mCrypto.IsEncrypted());
|
||||
MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
|
||||
|
||||
if (StaticPrefs::MediaEmeVideoBlank()) {
|
||||
EME_LOG("EMEDecoderModule::CreateVideoDecoder() creating a blank decoder.");
|
||||
|
@ -407,7 +407,7 @@ already_AddRefed<MediaDataDecoder> EMEDecoderModule::CreateVideoDecoder(
|
|||
|
||||
already_AddRefed<MediaDataDecoder> EMEDecoderModule::CreateAudioDecoder(
|
||||
const CreateDecoderParams& aParams) {
|
||||
MOZ_ASSERT(aParams.mConfig.mCrypto.IsEncrypted());
|
||||
MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
|
||||
|
||||
// We don't support using the GMP to decode audio.
|
||||
MOZ_ASSERT(!SupportsMimeType(aParams.mConfig.mMimeType, nullptr));
|
||||
|
|
|
@ -25,7 +25,7 @@ SamplesWaitingForKey::~SamplesWaitingForKey() { Flush(); }
|
|||
|
||||
RefPtr<SamplesWaitingForKey::WaitForKeyPromise>
|
||||
SamplesWaitingForKey::WaitIfKeyNotUsable(MediaRawData* aSample) {
|
||||
if (!aSample || !aSample->mCrypto.IsEncrypted() || !mProxy) {
|
||||
if (!aSample || !aSample->mCrypto.mValid || !mProxy) {
|
||||
return WaitForKeyPromise::CreateAndResolve(aSample, __func__);
|
||||
}
|
||||
auto caps = mProxy->Capabilites().Lock();
|
||||
|
|
|
@ -146,7 +146,7 @@ class VPXChangeMonitor : public MediaChangeMonitor::CodecChangeMonitor {
|
|||
|
||||
MediaResult CheckForChange(MediaRawData* aSample) override {
|
||||
// Don't look at encrypted content.
|
||||
if (aSample->mCrypto.IsEncrypted()) {
|
||||
if (aSample->mCrypto.mValid) {
|
||||
return NS_OK;
|
||||
}
|
||||
// For both VP8 and VP9, we only look for resolution changes
|
||||
|
|
|
@ -361,9 +361,7 @@ nsresult WebMDemuxer::ReadMetadata() {
|
|||
mInfo.mVideo.mDuration = TimeUnit::FromNanoseconds(duration);
|
||||
}
|
||||
mInfo.mVideo.mCrypto = GetTrackCrypto(TrackInfo::kVideoTrack, track);
|
||||
if (mInfo.mVideo.mCrypto.IsEncrypted()) {
|
||||
MOZ_ASSERT(mInfo.mVideo.mCrypto.mCryptoScheme == CryptoScheme::Cenc,
|
||||
"WebM should only use cenc scheme");
|
||||
if (mInfo.mVideo.mCrypto.mValid) {
|
||||
mCrypto.AddInitData(NS_LITERAL_STRING("webm"),
|
||||
mInfo.mVideo.mCrypto.mKeyId);
|
||||
}
|
||||
|
@ -428,9 +426,7 @@ nsresult WebMDemuxer::ReadMetadata() {
|
|||
mInfo.mAudio.mDuration = TimeUnit::FromNanoseconds(duration);
|
||||
}
|
||||
mInfo.mAudio.mCrypto = GetTrackCrypto(TrackInfo::kAudioTrack, track);
|
||||
if (mInfo.mAudio.mCrypto.IsEncrypted()) {
|
||||
MOZ_ASSERT(mInfo.mAudio.mCrypto.mCryptoScheme == CryptoScheme::Cenc,
|
||||
"WebM should only use cenc scheme");
|
||||
if (mInfo.mAudio.mCrypto.mValid) {
|
||||
mCrypto.AddInitData(NS_LITERAL_STRING("webm"),
|
||||
mInfo.mAudio.mCrypto.mKeyId);
|
||||
}
|
||||
|
@ -512,8 +508,8 @@ CryptoTrack WebMDemuxer::GetTrackCrypto(TrackInfo::TrackType aType,
|
|||
}
|
||||
|
||||
if (!initData.IsEmpty()) {
|
||||
// Webm only uses a cenc style scheme.
|
||||
crypto.mCryptoScheme = CryptoScheme::Cenc;
|
||||
crypto.mValid = true;
|
||||
// crypto.mMode is not used for WebMs
|
||||
crypto.mIVSize = WEBM_IV_SIZE;
|
||||
crypto.mKeyId = std::move(initData);
|
||||
}
|
||||
|
@ -709,7 +705,7 @@ nsresult WebMDemuxer::GetNextPacket(TrackInfo::TrackType aType,
|
|||
unsigned char const* iv;
|
||||
size_t ivLength;
|
||||
nestegg_packet_iv(holder->Packet(), &iv, &ivLength);
|
||||
writer->mCrypto.mCryptoScheme = CryptoScheme::Cenc;
|
||||
writer->mCrypto.mValid = true;
|
||||
writer->mCrypto.mIVSize = ivLength;
|
||||
if (ivLength == 0) {
|
||||
// Frame is not encrypted. This shouldn't happen as it means the
|
||||
|
@ -1169,8 +1165,9 @@ void WebMTrackDemuxer::Reset() {
|
|||
|
||||
void WebMTrackDemuxer::UpdateSamples(nsTArray<RefPtr<MediaRawData>>& aSamples) {
|
||||
for (const auto& sample : aSamples) {
|
||||
if (sample->mCrypto.IsEncrypted()) {
|
||||
if (sample->mCrypto.mValid) {
|
||||
UniquePtr<MediaRawDataWriter> writer(sample->CreateWriter());
|
||||
writer->mCrypto.mMode = mInfo->mCrypto.mMode;
|
||||
writer->mCrypto.mIVSize = mInfo->mCrypto.mIVSize;
|
||||
writer->mCrypto.mKeyId.AppendElements(mInfo->mCrypto.mKeyId);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче