Bug 1338924 - Pass duration of sample being decrypted to CDM. r=gerald

MozReview-Commit-ID: 3UujuYPpfJi
This commit is contained in:
Chris Pearce 2017-02-14 11:29:32 +13:00
Родитель 3640aa2a00
Коммит 4c05a6c492
11 изменённых файлов: 24 добавлений и 14 удалений

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

@ -63,7 +63,8 @@ public:
} }
void Decrypt(GMPBuffer* aBuffer, void Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) override GMPEncryptedBufferMetadata* aMetadata,
uint64_t aDurationUses) override
{ {
} }

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

@ -712,7 +712,7 @@ GMPCDMProxy::gmp_Decrypt(RefPtr<DecryptJob> aJob)
aJob->mId = ++mDecryptionJobCount; aJob->mId = ++mDecryptionJobCount;
nsTArray<uint8_t> data; nsTArray<uint8_t> data;
data.AppendElements(aJob->mSample->Data(), aJob->mSample->Size()); data.AppendElements(aJob->mSample->Data(), aJob->mSample->Size());
mCDM->Decrypt(aJob->mId, aJob->mSample->mCrypto, data); mCDM->Decrypt(aJob->mId, aJob->mSample->mCrypto, data, aJob->mSample->mDuration);
mDecryptionJobs.AppendElement(aJob.forget()); mDecryptionJobs.AppendElement(aJob.forget());
} }

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

@ -332,7 +332,8 @@ GMPDecryptorChild::RecvSetServerCertificate(const uint32_t& aPromiseId,
mozilla::ipc::IPCResult mozilla::ipc::IPCResult
GMPDecryptorChild::RecvDecrypt(const uint32_t& aId, GMPDecryptorChild::RecvDecrypt(const uint32_t& aId,
InfallibleTArray<uint8_t>&& aBuffer, InfallibleTArray<uint8_t>&& aBuffer,
const GMPDecryptionData& aMetadata) const GMPDecryptionData& aMetadata,
const uint64_t& aDurationUsecs)
{ {
if (!mSession) { if (!mSession) {
return IPC_FAIL_NO_REASON(this); return IPC_FAIL_NO_REASON(this);
@ -346,7 +347,7 @@ GMPDecryptorChild::RecvDecrypt(const uint32_t& aId,
GMPEncryptedBufferDataImpl* metadata = new GMPEncryptedBufferDataImpl(aMetadata); GMPEncryptedBufferDataImpl* metadata = new GMPEncryptedBufferDataImpl(aMetadata);
buffer->SetMetadata(metadata); buffer->SetMetadata(metadata);
mSession->Decrypt(buffer, metadata); mSession->Decrypt(buffer, metadata, aDurationUsecs);
return IPC_OK(); return IPC_OK();
} }

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

@ -103,7 +103,8 @@ private:
mozilla::ipc::IPCResult RecvDecrypt(const uint32_t& aId, mozilla::ipc::IPCResult RecvDecrypt(const uint32_t& aId,
InfallibleTArray<uint8_t>&& aBuffer, InfallibleTArray<uint8_t>&& aBuffer,
const GMPDecryptionData& aMetadata) override; const GMPDecryptionData& aMetadata,
const uint64_t& aDurationUsecs) override;
// Resolve/reject promise on completion. // Resolve/reject promise on completion.
mozilla::ipc::IPCResult RecvSetServerCertificate(const uint32_t& aPromiseId, mozilla::ipc::IPCResult RecvSetServerCertificate(const uint32_t& aPromiseId,

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

@ -172,7 +172,8 @@ GMPDecryptorParent::SetServerCertificate(uint32_t aPromiseId,
void void
GMPDecryptorParent::Decrypt(uint32_t aId, GMPDecryptorParent::Decrypt(uint32_t aId,
const CryptoSample& aCrypto, const CryptoSample& aCrypto,
const nsTArray<uint8_t>& aBuffer) const nsTArray<uint8_t>& aBuffer,
uint64_t aDurationUsecs)
{ {
LOGV(("GMPDecryptorParent[%p]::Decrypt(id=%d)", this, aId)); LOGV(("GMPDecryptorParent[%p]::Decrypt(id=%d)", this, aId));
@ -191,10 +192,10 @@ GMPDecryptorParent::Decrypt(uint32_t aId,
aCrypto.mEncryptedSizes, aCrypto.mEncryptedSizes,
aCrypto.mSessionIds); aCrypto.mSessionIds);
Unused << SendDecrypt(aId, aBuffer, data); Unused << SendDecrypt(aId, aBuffer, data, aDurationUsecs);
} else { } else {
GMPDecryptionData data; GMPDecryptionData data;
Unused << SendDecrypt(aId, aBuffer, data); Unused << SendDecrypt(aId, aBuffer, data, aDurationUsecs);
} }
} }

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

@ -61,7 +61,8 @@ public:
void Decrypt(uint32_t aId, void Decrypt(uint32_t aId,
const CryptoSample& aCrypto, const CryptoSample& aCrypto,
const nsTArray<uint8_t>& aBuffer) override; const nsTArray<uint8_t>& aBuffer,
uint64_t aDurationUsecs) override;
void Close() override; void Close() override;

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

@ -55,7 +55,8 @@ public:
virtual void Decrypt(uint32_t aId, virtual void Decrypt(uint32_t aId,
const mozilla::CryptoSample& aCrypto, const mozilla::CryptoSample& aCrypto,
const nsTArray<uint8_t>& aBuffer) = 0; const nsTArray<uint8_t>& aBuffer,
uint64_t aDurationUsecs) = 0;
virtual void Close() = 0; virtual void Close() = 0;
}; };

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

@ -46,7 +46,8 @@ child:
async Decrypt(uint32_t aId, async Decrypt(uint32_t aId,
uint8_t[] aBuffer, uint8_t[] aBuffer,
GMPDecryptionData aMetadata); GMPDecryptionData aMetadata,
uint64_t aDurationUsecs);
async DecryptingComplete(); async DecryptingComplete();

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

@ -324,7 +324,8 @@ public:
// is deleted. Don't forget to call Decrypted(), as otherwise aBuffer's // is deleted. Don't forget to call Decrypted(), as otherwise aBuffer's
// memory will leak! // memory will leak!
virtual void Decrypt(GMPBuffer* aBuffer, virtual void Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) = 0; GMPEncryptedBufferMetadata* aMetadata,
uint64_t aDurationUsecs) = 0;
// Called when the decryption operations are complete. // Called when the decryption operations are complete.
// Do not call the GMPDecryptorCallback's functions after this is called. // Do not call the GMPDecryptorCallback's functions after this is called.

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

@ -198,7 +198,8 @@ private:
void void
WidevineDecryptor::Decrypt(GMPBuffer* aBuffer, WidevineDecryptor::Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) GMPEncryptedBufferMetadata* aMetadata,
uint64_t aDurationUsecs)
{ {
if (!mCallback) { if (!mCallback) {
Log("WidevineDecryptor::Decrypt() this=%p FAIL; !mCallback", this); Log("WidevineDecryptor::Decrypt() this=%p FAIL; !mCallback", this);

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

@ -64,7 +64,8 @@ public:
uint32_t aServerCertSize) override; uint32_t aServerCertSize) override;
void Decrypt(GMPBuffer* aBuffer, void Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) override; GMPEncryptedBufferMetadata* aMetadata,
uint64_t aDurationUsecs) override;
void DecryptingComplete() override; void DecryptingComplete() override;