Bug 1329543 - Remove obsolete GMPDecryptor7 interface that was only used by Primetime. r=gerald

This basically rolls back aec9905b06fe from bug 1278198.

MozReview-Commit-ID: Drho21X6npW

--HG--
extra : rebase_source : 372bc7f4771ec0268535e3df2a745bc9fae8bd3b
This commit is contained in:
Chris Pearce 2017-01-16 15:12:15 +13:00
Родитель c7fa60e1fa
Коммит 22f4a343b5
6 изменённых файлов: 12 добавлений и 226 удалений

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

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

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

@ -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_BACKWARDS_COMPAT)) {
} else if (!strcmp (aApiName, GMP_API_DECRYPTOR)) {
*aPluginApi = new FakeDecryptor(static_cast<GMPDecryptorHost*> (aHostAPI));
return GMPNoErr;
} else if (!strcmp (aApiName, GMP_API_ASYNC_SHUTDOWN)) {

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

@ -11,12 +11,15 @@
#include <string>
#include "mozilla/Attributes.h"
class FakeDecryptor : public GMPDecryptor7 {
class FakeDecryptor : public GMPDecryptor {
public:
explicit FakeDecryptor(GMPDecryptorHost* aHost);
void Init(GMPDecryptorCallback* aCallback) override {
void Init(GMPDecryptorCallback* aCallback,
bool aDistinctiveIdentifierRequired,
bool aPersistentStateRequired) override
{
mCallback = aCallback;
}

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

@ -95,96 +95,6 @@ GMPContentChild::DeallocPGMPVideoEncoderChild(PGMPVideoEncoderChild* aActor)
return true;
}
// Adapts GMPDecryptor7 to the current GMPDecryptor version.
class GMPDecryptor7BackwardsCompat : public GMPDecryptor {
public:
explicit GMPDecryptor7BackwardsCompat(GMPDecryptor7* aDecryptorV7)
: mDecryptorV7(aDecryptorV7)
{
}
void Init(GMPDecryptorCallback* aCallback,
bool aDistinctiveIdentifierRequired,
bool aPersistentStateRequired) override
{
// Distinctive identifier and persistent state arguments not present
// in v7 interface.
mDecryptorV7->Init(aCallback);
}
void CreateSession(uint32_t aCreateSessionToken,
uint32_t aPromiseId,
const char* aInitDataType,
uint32_t aInitDataTypeSize,
const uint8_t* aInitData,
uint32_t aInitDataSize,
GMPSessionType aSessionType) override
{
mDecryptorV7->CreateSession(aCreateSessionToken,
aPromiseId,
aInitDataType,
aInitDataTypeSize,
aInitData,
aInitDataSize,
aSessionType);
}
void LoadSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) override
{
mDecryptorV7->LoadSession(aPromiseId, aSessionId, aSessionIdLength);
}
void UpdateSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength,
const uint8_t* aResponse,
uint32_t aResponseSize) override
{
mDecryptorV7->UpdateSession(aPromiseId,
aSessionId,
aSessionIdLength,
aResponse,
aResponseSize);
}
void CloseSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) override
{
mDecryptorV7->CloseSession(aPromiseId, aSessionId, aSessionIdLength);
}
void RemoveSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) override
{
mDecryptorV7->RemoveSession(aPromiseId, aSessionId, aSessionIdLength);
}
void SetServerCertificate(uint32_t aPromiseId,
const uint8_t* aServerCert,
uint32_t aServerCertSize) override
{
mDecryptorV7->SetServerCertificate(aPromiseId, aServerCert, aServerCertSize);
}
void Decrypt(GMPBuffer* aBuffer,
GMPEncryptedBufferMetadata* aMetadata) override
{
mDecryptorV7->Decrypt(aBuffer, aMetadata);
}
void DecryptingComplete() override
{
mDecryptorV7->DecryptingComplete();
delete this;
}
private:
GMPDecryptor7* mDecryptorV7;
};
mozilla::ipc::IPCResult
GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
{
@ -193,22 +103,11 @@ GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
void* ptr = nullptr;
GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, host, &ptr, aActor->Id());
GMPDecryptor* decryptor = nullptr;
if (GMP_SUCCEEDED(err) && ptr) {
decryptor = static_cast<GMPDecryptor*>(ptr);
} else if (err != GMPNoErr) {
// We Adapt the previous GMPDecryptor version to the current, so that
// Gecko thinks it's only talking to the current version. v7 differs
// from v9 in its Init() function arguments, and v9 has extra enumeration
// members at the end of the key status enumerations.
err = mGMPChild->GetAPI(GMP_API_DECRYPTOR_BACKWARDS_COMPAT, host, &ptr);
if (err != GMPNoErr || !ptr) {
return IPC_FAIL_NO_REASON(this);
}
decryptor = new GMPDecryptor7BackwardsCompat(static_cast<GMPDecryptor7*>(ptr));
if (err != GMPNoErr || !ptr) {
NS_WARNING("GMPGetAPI call failed trying to construct decryptor.");
return IPC_FAIL_NO_REASON(this);
}
child->Init(decryptor);
child->Init(static_cast<GMPDecryptor*>(ptr));
return IPC_OK();
}

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

@ -884,12 +884,6 @@ GMPParent::ReadGMPInfoFile(nsIFile* aFile)
}
}
// 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;

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

@ -234,10 +234,7 @@ enum GMPSessionType {
kGMPSessionInvalid = 2 // Must always be last.
};
// Gecko supports the current GMPDecryptor version, and the obsolete
// version that the Adobe GMP still uses.
#define GMP_API_DECRYPTOR "eme-decrypt-v9"
#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().
@ -349,111 +346,4 @@ public:
virtual ~GMPDecryptor() {}
};
// v7 is the latest decryptor version supported by the Adobe GMP.
//
// API name macro: GMP_API_DECRYPTOR_BACKWARDS_COMPAT
// Host API: GMPDecryptorHost
class GMPDecryptor7 {
public:
// Sets the callback to use with the decryptor to return results
// to Gecko.
virtual void Init(GMPDecryptorCallback* aCallback) = 0;
// Initiates the creation of a session given |aType| and |aInitData|, and
// the generation of a license request message.
//
// This corresponds to a MediaKeySession.generateRequest() call in JS.
//
// The GMPDecryptor must do the following, in order, upon this method
// being called:
//
// 1. Generate a sessionId to expose to JS, and call
// GMPDecryptorCallback::SetSessionId(aCreateSessionToken, sessionId...)
// with the sessionId to be exposed to JS/EME on the MediaKeySession
// object on which generateRequest() was called, and then
// 2. send any messages to JS/EME required to generate a license request
// given the supplied initData, and then
// 3. generate a license request message, and send it to JS/EME, and then
// 4. call GMPDecryptorCallback::ResolvePromise().
//
// Note: GMPDecryptorCallback::SetSessionId(aCreateSessionToken, sessionId, ...)
// *must* be called before GMPDecryptorCallback::SendMessage(sessionId, ...)
// will work.
//
// If generating the request fails, reject aPromiseId by calling
// GMPDecryptorCallback::RejectPromise().
virtual void CreateSession(uint32_t aCreateSessionToken,
uint32_t aPromiseId,
const char* aInitDataType,
uint32_t aInitDataTypeSize,
const uint8_t* aInitData,
uint32_t aInitDataSize,
GMPSessionType aSessionType) = 0;
// Loads a previously loaded persistent session.
//
// This corresponds to a MediaKeySession.load() call in JS.
//
// The GMPDecryptor must do the following, in order, upon this method
// being called:
//
// 1. Send any messages to JS/EME, or read from storage, whatever is
// required to load the session, and then
// 2. if there is no session with the given sessionId loadable, call
// ResolveLoadSessionPromise(aPromiseId, false), otherwise
// 2. mark the session's keys as usable, and then
// 3. update the session's expiration, and then
// 4. call GMPDecryptorCallback::ResolveLoadSessionPromise(aPromiseId, true).
//
// If loading the session fails due to error, reject aPromiseId by calling
// GMPDecryptorCallback::RejectPromise().
virtual void LoadSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) = 0;
// Updates the session with |aResponse|.
// This corresponds to a MediaKeySession.update() call in JS.
virtual void UpdateSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength,
const uint8_t* aResponse,
uint32_t aResponseSize) = 0;
// Releases the resources (keys) for the specified session.
// This corresponds to a MediaKeySession.close() call in JS.
virtual void CloseSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) = 0;
// Removes the resources (keys) for the specified session.
// This corresponds to a MediaKeySession.remove() call in JS.
virtual void RemoveSession(uint32_t aPromiseId,
const char* aSessionId,
uint32_t aSessionIdLength) = 0;
// Resolve/reject promise on completion.
// This corresponds to a MediaKeySession.setServerCertificate() call in JS.
virtual void SetServerCertificate(uint32_t aPromiseId,
const uint8_t* aServerCert,
uint32_t aServerCertSize) = 0;
// Asynchronously decrypts aBuffer in place. When the decryption is
// complete, GMPDecryptor should write the decrypted data back into the
// 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;
// Called when the decryption operations are complete.
// Do not call the GMPDecryptorCallback's functions after this is called.
virtual void DecryptingComplete() = 0;
virtual ~GMPDecryptor7() {}
};
#endif // GMP_DECRYPTION_h_