Bug 1721867 - Remove the concept of decryptor id from the GMP. r=alwu,jolin

Decryptor id is no longer used anywhere functional, but we still have code
referencing and plumbing values around. This patch removes all the remaining
usage I can find in Gecko.

Differential Revision: https://phabricator.services.mozilla.com/D120647
This commit is contained in:
Bryce Seager van Dyk 2021-07-22 22:19:53 +00:00
parent ae31ffcdb6
commit 5af3985b1c
20 changed files with 40 additions and 59 deletions

View File

@ -99,8 +99,6 @@ class CDMProxy {
const nsAString& aTopLevelOrigin,
const nsAString& aName) = 0;
virtual void OnSetDecryptorId(uint32_t aId) {}
// Main thread only.
// Uses the CDM to create a key session.
// Calls MediaKeys::OnSessionActivated() when session is created.
@ -258,8 +256,6 @@ class CDMProxy {
virtual bool IsOnOwnerThread() = 0;
#endif
virtual uint32_t GetDecryptorId() { return 0; }
virtual ChromiumCDMProxy* AsChromiumCDMProxy() { return nullptr; }
protected:

View File

@ -18,8 +18,6 @@ class DecryptorProxyCallback {
public:
virtual ~DecryptorProxyCallback() {}
virtual void SetDecryptorId(uint32_t aId) = 0;
virtual void SetSessionId(uint32_t aCreateSessionId,
const nsCString& aSessionId) = 0;

View File

@ -19,8 +19,6 @@ class ErrorResult;
// to ensure running on main thread.
class MediaDrmCDMCallbackProxy : public DecryptorProxyCallback {
public:
void SetDecryptorId(uint32_t aId) override {}
void SetSessionId(uint32_t aCreateSessionToken,
const nsCString& aSessionId) override;

View File

@ -101,26 +101,26 @@ GMPErr ChromiumCDMAdapter::GMPInit(const GMPPlatformAPI* aPlatformAPI) {
}
GMPErr ChromiumCDMAdapter::GMPGetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI, uint32_t aDecryptorId) {
GMP_LOG_DEBUG("ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p, %u) this=0x%p",
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this);
void** aPluginAPI) {
GMP_LOG_DEBUG("ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p",
aAPIName, aHostAPI, aPluginAPI, this);
bool isCdm10 = !strcmp(aAPIName, CHROMIUM_CDM_API);
if (!isCdm10) {
MOZ_ASSERT_UNREACHABLE("We only support and expect cdm10!");
GMP_LOG_DEBUG(
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p, %u) this=0x%p got "
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p got "
"unsupported CDM version!",
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this);
aAPIName, aHostAPI, aPluginAPI, this);
return GMPGenericErr;
}
auto create = reinterpret_cast<decltype(::CreateCdmInstance)*>(
PR_FindFunctionSymbol(mLib, "CreateCdmInstance"));
if (!create) {
GMP_LOG_DEBUG(
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p, %u) this=0x%p "
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p "
"FAILED to find CreateCdmInstance",
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this);
aAPIName, aHostAPI, aPluginAPI, this);
return GMPGenericErr;
}
@ -130,9 +130,9 @@ GMPErr ChromiumCDMAdapter::GMPGetAPI(const char* aAPIName, void* aHostAPI,
&ChromiumCdmHost, aHostAPI);
if (!cdm) {
GMP_LOG_DEBUG(
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p, %u) this=0x%p "
"ChromiumCDMAdapter::GMPGetAPI(%s, 0x%p, 0x%p) this=0x%p "
"FAILED to create cdm version %d",
aAPIName, aHostAPI, aPluginAPI, aDecryptorId, this, version);
aAPIName, aHostAPI, aPluginAPI, this, version);
return GMPGenericErr;
}
GMP_LOG_DEBUG("cdm: 0x%p, version: %d", cdm, version);

View File

@ -61,8 +61,8 @@ class ChromiumCDMAdapter : public gmp::GMPAdapter {
// These are called in place of the corresponding GMP API functions.
GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) override;
GMPErr GMPGetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI,
uint32_t aDecryptorId) override;
GMPErr GMPGetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI) override;
void GMPShutdown() override;
static bool Supports(int32_t aModuleVersion, int32_t aInterfaceVersion,

View File

@ -188,12 +188,12 @@ mozilla::ipc::IPCResult GMPChild::RecvProvideStorageId(
return IPC_OK();
}
GMPErr GMPChild::GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI,
uint32_t aDecryptorId) {
GMPErr GMPChild::GetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI) {
if (!mGMPLoader) {
return GMPGenericErr;
}
return mGMPLoader->GetAPI(aAPIName, aHostAPI, aPluginAPI, aDecryptorId);
return mGMPLoader->GetAPI(aAPIName, aHostAPI, aPluginAPI);
}
mozilla::ipc::IPCResult GMPChild::RecvPreloadLibs(const nsCString& aLibs) {

View File

@ -64,8 +64,7 @@ class GMPChild : public PGMPChild {
void ActorDestroy(ActorDestroyReason aWhy) override;
void ProcessingError(Result aCode, const char* aReason) override;
GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI,
uint32_t aDecryptorId = 0);
GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI);
nsTArray<std::pair<nsCString, nsCString>> MakeCDMHostVerificationPaths();

View File

@ -41,7 +41,7 @@ void GMPContentChild::ProcessingError(Result aCode, const char* aReason) {
}
already_AddRefed<PGMPVideoDecoderChild>
GMPContentChild::AllocPGMPVideoDecoderChild(const uint32_t& aDecryptorId) {
GMPContentChild::AllocPGMPVideoDecoderChild() {
return MakeAndAddRef<GMPVideoDecoderChild>(this);
}
@ -55,12 +55,11 @@ already_AddRefed<PChromiumCDMChild> GMPContentChild::AllocPChromiumCDMChild() {
}
mozilla::ipc::IPCResult GMPContentChild::RecvPGMPVideoDecoderConstructor(
PGMPVideoDecoderChild* aActor, const uint32_t& aDecryptorId) {
PGMPVideoDecoderChild* aActor) {
auto vdc = static_cast<GMPVideoDecoderChild*>(aActor);
void* vd = nullptr;
GMPErr err =
mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd, aDecryptorId);
GMPErr err = mGMPChild->GetAPI(GMP_API_VIDEO_DECODER, &vdc->Host(), &vd);
if (err != GMPNoErr || !vd) {
NS_WARNING("GMPGetAPI call failed trying to construct decoder.");
return IPC_FAIL_NO_REASON(this);

View File

@ -29,14 +29,13 @@ class GMPContentChild : public PGMPContentChild, public GMPSharedMem {
MessageLoop* GMPMessageLoop();
mozilla::ipc::IPCResult RecvPGMPVideoDecoderConstructor(
PGMPVideoDecoderChild* aActor, const uint32_t& aDecryptorId) override;
PGMPVideoDecoderChild* aActor) override;
mozilla::ipc::IPCResult RecvPGMPVideoEncoderConstructor(
PGMPVideoEncoderChild* aActor) override;
mozilla::ipc::IPCResult RecvPChromiumCDMConstructor(
PChromiumCDMChild* aActor) override;
already_AddRefed<PGMPVideoDecoderChild> AllocPGMPVideoDecoderChild(
const uint32_t& aDecryptorId);
already_AddRefed<PGMPVideoDecoderChild> AllocPGMPVideoDecoderChild();
already_AddRefed<PGMPVideoEncoderChild> AllocPGMPVideoEncoderChild();

View File

@ -162,12 +162,11 @@ already_AddRefed<ChromiumCDMParent> GMPContentParent::GetChromiumCDM() {
return parent.forget();
}
nsresult GMPContentParent::GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD,
uint32_t aDecryptorId) {
nsresult GMPContentParent::GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD) {
GMP_LOG_DEBUG("GMPContentParent::GetGMPVideoDecoder(this=%p)", this);
RefPtr<GMPVideoDecoderParent> vdp = new GMPVideoDecoderParent(this);
if (!SendPGMPVideoDecoderConstructor(vdp, aDecryptorId)) {
if (!SendPGMPVideoDecoderConstructor(vdp)) {
return NS_ERROR_FAILURE;
}

View File

@ -28,8 +28,7 @@ class GMPContentParent final : public PGMPContentParent, public GMPSharedMem {
explicit GMPContentParent(GMPParent* aParent = nullptr);
nsresult GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD,
uint32_t aDecryptorId);
nsresult GetGMPVideoDecoder(GMPVideoDecoderParent** aGMPVD);
void VideoDecoderDestroyed(GMPVideoDecoderParent* aDecoder);
nsresult GetGMPVideoEncoder(GMPVideoEncoderParent** aGMPVE);

View File

@ -49,8 +49,8 @@ class PassThroughGMPAdapter : public GMPAdapter {
return initFunc(aPlatformAPI);
}
GMPErr GMPGetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI,
uint32_t aDecryptorId) override {
GMPErr GMPGetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI) override {
if (!mLib) {
return GMPGenericErr;
}
@ -121,8 +121,8 @@ bool GMPLoader::Load(const char* aUTF8LibPath, uint32_t aUTF8LibPathLen,
}
GMPErr GMPLoader::GetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI, uint32_t aDecryptorId) {
return mAdapter->GMPGetAPI(aAPIName, aHostAPI, aPluginAPI, aDecryptorId);
void** aPluginAPI) {
return mAdapter->GMPGetAPI(aAPIName, aHostAPI, aPluginAPI);
}
void GMPLoader::Shutdown() {

View File

@ -37,7 +37,7 @@ class GMPAdapter {
// These are called in place of the corresponding GMP API functions.
virtual GMPErr GMPInit(const GMPPlatformAPI* aPlatformAPI) = 0;
virtual GMPErr GMPGetAPI(const char* aAPIName, void* aHostAPI,
void** aPluginAPI, uint32_t aDecryptorId) = 0;
void** aPluginAPI) = 0;
virtual void GMPShutdown() = 0;
};
@ -56,8 +56,7 @@ class GMPLoader {
const GMPPlatformAPI* aPlatformAPI, GMPAdapter* aAdapter = nullptr);
// Retrieves an interface pointer from the GMP.
GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI,
uint32_t aDecryptorId);
GMPErr GetAPI(const char* aAPIName, void* aHostAPI, void** aPluginAPI);
// Calls the GMPShutdown function exported by the GMP lib, and unloads the
// plugin library.

View File

@ -402,11 +402,13 @@ already_AddRefed<nsISerialEventTarget> GeckoMediaPluginService::GetGMPThread() {
return thread.forget();
}
// TODO(bug 1721842): merge this and GetGMPVideoDecoder as we've removed the
// concept of a decrypting decoder.
NS_IMETHODIMP
GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(
GMPCrashHelper* aHelper, nsTArray<nsCString>* aTags,
const nsACString& aNodeId,
UniquePtr<GetGMPVideoDecoderCallback>&& aCallback, uint32_t aDecryptorId) {
UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) {
MOZ_ASSERT(mGMPThread->IsOnCurrentThread());
NS_ENSURE_ARG(aTags && aTags->Length() > 0);
NS_ENSURE_ARG(aCallback);
@ -422,14 +424,13 @@ GeckoMediaPluginService::GetDecryptingGMPVideoDecoder(
nsLiteralCString(GMP_API_VIDEO_DECODER), *aTags)
->Then(
thread, __func__,
[rawCallback, helper,
aDecryptorId](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
[rawCallback,
helper](RefPtr<GMPContentParent::CloseBlocker> wrapper) {
RefPtr<GMPContentParent> parent = wrapper->mParent;
UniquePtr<GetGMPVideoDecoderCallback> callback(rawCallback);
GMPVideoDecoderParent* actor = nullptr;
GMPVideoHostImpl* host = nullptr;
if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder(
&actor, aDecryptorId))) {
if (parent && NS_SUCCEEDED(parent->GetGMPVideoDecoder(&actor))) {
host = &(actor->Host());
actor->SetCrashHelper(helper);
}

View File

@ -64,8 +64,7 @@ class GeckoMediaPluginService : public mozIGeckoMediaPluginService,
NS_IMETHOD GetDecryptingGMPVideoDecoder(
GMPCrashHelper* aHelper, nsTArray<nsCString>* aTags,
const nsACString& aNodeId,
UniquePtr<GetGMPVideoDecoderCallback>&& aCallback,
uint32_t aDecryptorId) override;
UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) override;
NS_IMETHOD GetGMPVideoEncoder(
GMPCrashHelper* aHelper, nsTArray<nsCString>* aTags,
const nsACString& aNodeId,
@ -78,7 +77,7 @@ class GeckoMediaPluginService : public mozIGeckoMediaPluginService,
const nsACString& aNodeId,
UniquePtr<GetGMPVideoDecoderCallback>&& aCallback) override {
return GetDecryptingGMPVideoDecoder(aHelper, aTags, aNodeId,
std::move(aCallback), 0);
std::move(aCallback));
}
NS_IMETHOD RunPluginCrashCallbacks(uint32_t aPluginId,

View File

@ -21,7 +21,7 @@ namespace gmp {
manages PChromiumCDM;
child:
async PGMPVideoDecoder(uint32_t aDecryptorId);
async PGMPVideoDecoder();
async PGMPVideoEncoder();
async PChromiumCDM();

View File

@ -103,8 +103,7 @@ interface mozIGeckoMediaPluginService : nsISupports
void getDecryptingGMPVideoDecoder(in GMPCrashHelperPtr helper,
in TagArray tags,
in ACString nodeId,
in GetGMPVideoDecoderCallback callback,
in uint32_t decryptorId);
in GetGMPVideoDecoderCallback callback);
/**
* Get a video encoder that supports the specified tags.

View File

@ -1149,8 +1149,6 @@ class CDMStorageTest {
nsTArray<ExpectedMessage> mExpected;
RefPtr<nsIRunnable> mSetDecryptorIdContinuation;
RefPtr<gmp::ChromiumCDMParent> mCDM;
Monitor mMonitor;
Atomic<bool> mFinished;

View File

@ -261,8 +261,7 @@ RefPtr<MediaDataDecoder::InitPromise> GMPVideoDecoder::Init() {
InitTags(tags);
UniquePtr<GetGMPVideoDecoderCallback> callback(new GMPInitDoneCallback(this));
if (NS_FAILED(mMPS->GetDecryptingGMPVideoDecoder(
mCrashHelper, &tags, GetNodeId(), std::move(callback),
DecryptorId()))) {
mCrashHelper, &tags, GetNodeId(), std::move(callback)))) {
mInitPromise.Reject(NS_ERROR_DOM_MEDIA_FATAL_ERR, __func__);
}

View File

@ -59,7 +59,6 @@ class GMPVideoDecoder : public MediaDataDecoder,
protected:
virtual void InitTags(nsTArray<nsCString>& aTags);
virtual nsCString GetNodeId();
virtual uint32_t DecryptorId() const { return 0; }
virtual GMPUniquePtr<GMPVideoEncodedFrame> CreateFrame(MediaRawData* aSample);
virtual const VideoInfo& GetConfig() const;