Bug 1229508 - Support current and previous GMP_API_DECRYPTORs. r=gerald

To allow GMPs time to update to new GMPDecryptor versions, we support the
latest GMPDecryptor version, and the previous.

In order to support a consistent interface to Gecko, we adapt the previous
GMPDecryptor version to the latest in the GMP child process.  So Gecko always
thinks it's talking to the latest version.

We also make gmp-fake deliberately support the previous GMPDecryptor version,
to ensure this code path remains tested.
This commit is contained in:
Chris Pearce 2015-12-02 15:37:09 +13:00
parent 9e5ed7ac3f
commit bfc437077a
6 changed files with 23 additions and 6 deletions

View File

@ -1,5 +1,5 @@
Name: fake
Description: Fake GMP Plugin
Description: Fake GMP Plugin, which deliberately uses GMP_API_DECRYPTOR_BACKWARDS_COMPAT for its decryptor.
Version: 1.0
APIs: decode-video[h264:broken], eme-decrypt-v7[fake]
Libraries: dxva2.dll

View File

@ -72,7 +72,7 @@ extern "C" {
// happens when decoder init fails.
return GMPGenericErr;
#if defined(GMP_FAKE_SUPPORT_DECRYPT)
} else if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
} else if (!strcmp (aApiName, GMP_API_DECRYPTOR_BACKWARDS_COMPAT)) {
*aPluginApi = new FakeDecryptor(static_cast<GMPDecryptorHost*> (aHostAPI));
return GMPNoErr;
} else if (!strcmp (aApiName, GMP_API_ASYNC_SHUTDOWN)) {

View File

@ -119,7 +119,16 @@ GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
void* session = nullptr;
GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, host, &session);
if (err != GMPNoErr || !session) {
return false;
// We Adapt the previous GMPDecryptor version to the current, so that
// Gecko thinks it's only talking to the current version. Helpfully,
// v7 is ABI compatible with v8, it only has different enumerations.
// If the GMP uses a v8-only enum value in an IPDL message, the IPC
// layer will terminate, so we rev'd the API version to signal to the
// GMP that it's safe to use the new enum values.
err = mGMPChild->GetAPI(GMP_API_DECRYPTOR_BACKWARDS_COMPAT, host, &session);
if (err != GMPNoErr || !session) {
return false;
}
}
child->Init(static_cast<GMPDecryptor*>(session));

View File

@ -868,6 +868,12 @@ GMPParent::ReadGMPMetaData()
}
}
// We support the current GMPDecryptor version, and the previous.
// We Adapt the previous to the current in the GMPContentChild.
if (cap->mAPIName.EqualsLiteral(GMP_API_DECRYPTOR_BACKWARDS_COMPAT)) {
cap->mAPIName.AssignLiteral(GMP_API_DECRYPTOR);
}
if (cap->mAPIName.EqualsLiteral(GMP_API_DECRYPTOR)) {
mCanDecrypt = true;

View File

@ -244,7 +244,9 @@ enum GMPSessionType {
kGMPSessionInvalid = 2 // Must always be last.
};
#define GMP_API_DECRYPTOR "eme-decrypt-v7"
// Gecko supports the current GMPDecryptor version, and the previous.
#define GMP_API_DECRYPTOR "eme-decrypt-v8"
#define GMP_API_DECRYPTOR_BACKWARDS_COMPAT "eme-decrypt-v7"
// API exposed by plugin library to manage decryption sessions.
// When the Host requests this by calling GMPGetAPIFunc().

View File

@ -2,9 +2,9 @@ Name: clearkey
Description: ClearKey Gecko Media Plugin
Version: 1
#ifdef ENABLE_WMF
APIs: eme-decrypt-v7[org.w3.clearkey], decode-audio[aac:org.w3.clearkey], decode-video[h264:org.w3.clearkey]
APIs: eme-decrypt-v8[org.w3.clearkey], decode-audio[aac:org.w3.clearkey], decode-video[h264:org.w3.clearkey]
Libraries: dxva2.dll, d3d9.dll, msmpeg2vdec.dll, msmpeg2adec.dll, MSAudDecMFT.dll, evr.dll, mfheaacdec.dll, mfh264dec.dll, mfplat.dll
#else
APIs: eme-decrypt-v7[org.w3.clearkey]
APIs: eme-decrypt-v8[org.w3.clearkey]
Libraries:
#endif