diff --git a/dom/media/gmp/GMPDecryptorParent.cpp b/dom/media/gmp/GMPDecryptorParent.cpp index d17339386085..6c127461821e 100644 --- a/dom/media/gmp/GMPDecryptorParent.cpp +++ b/dom/media/gmp/GMPDecryptorParent.cpp @@ -16,25 +16,19 @@ GMPDecryptorParent::GMPDecryptorParent(GMPContentParent* aPlugin) , mShuttingDown(false) , mActorDestroyed(false) , mPlugin(aPlugin) + , mPluginId(aPlugin->GetPluginId()) , mCallback(nullptr) #ifdef DEBUG , mGMPThread(aPlugin->GMPThread()) #endif { MOZ_ASSERT(mPlugin && mGMPThread); - mPluginId = aPlugin->GetPluginId(); } GMPDecryptorParent::~GMPDecryptorParent() { } -const uint32_t -GMPDecryptorParent::GetPluginId() const -{ - return mPluginId; -} - nsresult GMPDecryptorParent::Init(GMPDecryptorProxyCallback* aCallback) { diff --git a/dom/media/gmp/GMPDecryptorParent.h b/dom/media/gmp/GMPDecryptorParent.h index df456e8033d6..dfee56d5e862 100644 --- a/dom/media/gmp/GMPDecryptorParent.h +++ b/dom/media/gmp/GMPDecryptorParent.h @@ -29,7 +29,7 @@ public: // GMPDecryptorProxy - virtual const uint32_t GetPluginId() const override; + virtual const uint32_t GetPluginId() const override { return mPluginId; } virtual nsresult Init(GMPDecryptorProxyCallback* aCallback) override; diff --git a/dom/media/gmp/GMPVideoDecoderParent.cpp b/dom/media/gmp/GMPVideoDecoderParent.cpp index ef695ed00d26..4be47114842c 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.cpp +++ b/dom/media/gmp/GMPVideoDecoderParent.cpp @@ -46,6 +46,7 @@ GMPVideoDecoderParent::GMPVideoDecoderParent(GMPContentParent* aPlugin) , mPlugin(aPlugin) , mCallback(nullptr) , mVideoHost(this) + , mPluginId(aPlugin->GetPluginId()) { MOZ_ASSERT(mPlugin); } diff --git a/dom/media/gmp/GMPVideoDecoderParent.h b/dom/media/gmp/GMPVideoDecoderParent.h index f07b57fdfaff..9b54403146f4 100644 --- a/dom/media/gmp/GMPVideoDecoderParent.h +++ b/dom/media/gmp/GMPVideoDecoderParent.h @@ -44,7 +44,7 @@ public: int64_t aRenderTimeMs = -1) override; virtual nsresult Reset() override; virtual nsresult Drain() override; - virtual const uint64_t ParentID() override { return reinterpret_cast(mPlugin.get()); } + virtual const uint32_t GetPluginId() const override { return mPluginId; } virtual const nsCString& GetDisplayName() const override; // GMPSharedMemManager @@ -85,6 +85,7 @@ private: nsRefPtr mPlugin; GMPVideoDecoderCallbackProxy* mCallback; GMPVideoHostImpl mVideoHost; + const uint32_t mPluginId; }; } // namespace gmp diff --git a/dom/media/gmp/GMPVideoDecoderProxy.h b/dom/media/gmp/GMPVideoDecoderProxy.h index 1a5c771c988d..5ea089eeb7c1 100644 --- a/dom/media/gmp/GMPVideoDecoderProxy.h +++ b/dom/media/gmp/GMPVideoDecoderProxy.h @@ -44,7 +44,7 @@ public: int64_t aRenderTimeMs = -1) = 0; virtual nsresult Reset() = 0; virtual nsresult Drain() = 0; - virtual const uint64_t ParentID() = 0; + virtual const uint32_t GetPluginId() const = 0; // Call to tell GMP/plugin the consumer will no longer use this // interface/codec. diff --git a/dom/media/gmp/GMPVideoEncoderParent.cpp b/dom/media/gmp/GMPVideoEncoderParent.cpp index 0a0a75bdfc96..92fb88dd5ac0 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.cpp +++ b/dom/media/gmp/GMPVideoEncoderParent.cpp @@ -52,7 +52,8 @@ GMPVideoEncoderParent::GMPVideoEncoderParent(GMPContentParent *aPlugin) mActorDestroyed(false), mPlugin(aPlugin), mCallback(nullptr), - mVideoHost(this) + mVideoHost(this), + mPluginId(aPlugin->GetPluginId()) { MOZ_ASSERT(mPlugin); @@ -211,12 +212,6 @@ GMPVideoEncoderParent::SetPeriodicKeyFrames(bool aEnable) return GMPNoErr; } -const uint32_t -GMPVideoEncoderParent::ParentID() -{ - return mPlugin ? mPlugin->GetPluginId() : 0; -} - // Note: Consider keeping ActorDestroy sync'd up when making changes here. void GMPVideoEncoderParent::Shutdown() diff --git a/dom/media/gmp/GMPVideoEncoderParent.h b/dom/media/gmp/GMPVideoEncoderParent.h index dcd05cd83284..602daa234243 100644 --- a/dom/media/gmp/GMPVideoEncoderParent.h +++ b/dom/media/gmp/GMPVideoEncoderParent.h @@ -45,7 +45,7 @@ public: virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) override; virtual GMPErr SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) override; virtual GMPErr SetPeriodicKeyFrames(bool aEnable) override; - virtual const uint32_t ParentID() override; + virtual const uint32_t GetPluginId() const override { return mPluginId; } // GMPSharedMemManager virtual bool Alloc(size_t aSize, Shmem::SharedMemory::SharedMemoryType aType, Shmem* aMem) override @@ -82,6 +82,7 @@ private: GMPVideoEncoderCallbackProxy* mCallback; GMPVideoHostImpl mVideoHost; nsCOMPtr mEncodedThread; + const uint32_t mPluginId; }; } // namespace gmp diff --git a/dom/media/gmp/GMPVideoEncoderProxy.h b/dom/media/gmp/GMPVideoEncoderProxy.h index 747aa5d748c1..6990b1b7f965 100644 --- a/dom/media/gmp/GMPVideoEncoderProxy.h +++ b/dom/media/gmp/GMPVideoEncoderProxy.h @@ -46,7 +46,7 @@ public: virtual GMPErr SetChannelParameters(uint32_t aPacketLoss, uint32_t aRTT) = 0; virtual GMPErr SetRates(uint32_t aNewBitRate, uint32_t aFrameRate) = 0; virtual GMPErr SetPeriodicKeyFrames(bool aEnable) = 0; - virtual const uint32_t ParentID() = 0; + virtual const uint32_t GetPluginId() const = 0; // Call to tell GMP/plugin the consumer will no longer use this // interface/codec. diff --git a/dom/media/gtest/TestGMPCrossOrigin.cpp b/dom/media/gtest/TestGMPCrossOrigin.cpp index 3a982dec6b1b..27d66f6ff19e 100644 --- a/dom/media/gtest/TestGMPCrossOrigin.cpp +++ b/dom/media/gtest/TestGMPCrossOrigin.cpp @@ -174,7 +174,7 @@ private: EXPECT_TRUE(aGMP); if (aGMP) { EXPECT_TRUE(mGMP && - (mGMP->ParentID() == aGMP->ParentID()) == mShouldBeEqual); + (mGMP->GetPluginId() == aGMP->GetPluginId()) == mShouldBeEqual); } if (mGMP) { mGMP->Close(); diff --git a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h index 7b01a2cc9895..a4f6f8fc1332 100644 --- a/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h +++ b/media/webrtc/signaling/src/media-conduit/WebrtcGmpVideoCodec.h @@ -62,7 +62,7 @@ public: // Implement VideoEncoder interface. virtual const uint64_t PluginID() override { - return mGMP ? mGMP->ParentID() : mCachedPluginId; + return mGMP ? mGMP->GetPluginId() : mCachedPluginId; } virtual void Terminated() override; @@ -244,7 +244,7 @@ public: // Implement VideoDecoder interface. virtual const uint64_t PluginID() override { - return mGMP ? mGMP->ParentID() : mCachedPluginId; + return mGMP ? mGMP->GetPluginId() : mCachedPluginId; } virtual void Terminated() override;