Bug 1048097 - Delete the GMPBuffer we send into GMP/CDM for decryption once it's been returned decrypted. r=jesup

This commit is contained in:
Chris Pearce 2014-08-05 10:18:12 +12:00
parent db33fea625
commit f32c7614e8
2 changed files with 10 additions and 0 deletions

View File

@ -149,8 +149,13 @@ GMPDecryptorChild::Decrypted(GMPBuffer* aBuffer, GMPErr aResult)
{
MOZ_ASSERT(mPlugin->GMPMessageLoop() == MessageLoop::current());
if (!aBuffer) {
NS_WARNING("GMPDecryptorCallback passed bull GMPBuffer");
return;
}
auto buffer = static_cast<GMPBufferImpl*>(aBuffer);
SendDecrypted(buffer->mId, aResult, buffer->mData);
delete buffer;
}
void
@ -307,6 +312,8 @@ GMPDecryptorChild::RecvDecrypt(const uint32_t& aId,
GMPEncryptedBufferDataImpl metadata(aMetadata);
// Note: the GMPBufferImpl created here is deleted when the GMP passes
// it back in the Decrypted() callback above.
mSession->Decrypt(new GMPBufferImpl(aId, aBuffer), &metadata);
return true;
}

View File

@ -257,6 +257,9 @@ public:
// same GMPBuffer object and return it to Gecko by calling Decrypted(),
// with the GMPNoErr successcode. If decryption fails, call Decrypted()
// with a failure code, and an error event will fire on the media element.
// Note: When Decrypted() is called and aBuffer is passed back, aBuffer
// is deleted. Don't forget to call Decrypted(), as otherwise aBuffer's
// memory will leak!
virtual void Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) = 0;