Bug 1337778 - Use counter for decryptor ID instead of IPDL actor Id. r=gerald
authorChris Pearce <cpearce@mozilla.com>
Wed, 01 Mar 2017 17:19:08 +1300
changeset 392144 6fb5321bf52cd852ea49a6efb3c30c21205c03ef
parent 392143 36bb16774744cba10efdfa1d33f4a5dd027f32ce
child 392145 f24d5588057b82d6d2fc533fd2bcfdf78dc1623c
push id7198
push userjlorenzo@mozilla.com
push dateTue, 18 Apr 2017 12:07:49 +0000
treeherdermozilla-beta@d57aa49c3948 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgerald
bugs1337778, 1306314
milestone54.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1337778 - Use counter for decryptor ID instead of IPDL actor Id. r=gerald The work I did in bug 1306314 seems to have either regressed or never worked properly for multiple CDM same origin processes. I'd guess the decryptor IPDL protocol actor ID must not be as unique as I thought. So if we just use a counter managed by the GMPDecrytorChild, we'll get a per CDM unique ID, which is sufficient. MozReview-Commit-ID: KSh72ptX5fn
dom/media/gmp/GMPContentChild.cpp
dom/media/gmp/GMPDecryptorChild.cpp
dom/media/gmp/GMPDecryptorChild.h
--- a/dom/media/gmp/GMPContentChild.cpp
+++ b/dom/media/gmp/GMPContentChild.cpp
@@ -94,17 +94,17 @@ GMPContentChild::DeallocPGMPVideoEncoder
 }
 
 mozilla::ipc::IPCResult
 GMPContentChild::RecvPGMPDecryptorConstructor(PGMPDecryptorChild* aActor)
 {
   GMPDecryptorChild* child = static_cast<GMPDecryptorChild*>(aActor);
 
   void* ptr = nullptr;
-  GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, nullptr, &ptr, aActor->Id());
+  GMPErr err = mGMPChild->GetAPI(GMP_API_DECRYPTOR, nullptr, &ptr, child->DecryptorId());
   if (err != GMPNoErr || !ptr) {
     NS_WARNING("GMPGetAPI call failed trying to construct decryptor.");
     return IPC_FAIL_NO_REASON(this);
   }
   child->Init(static_cast<GMPDecryptor*>(ptr));
 
   return IPC_OK();
 }
--- a/dom/media/gmp/GMPDecryptorChild.cpp
+++ b/dom/media/gmp/GMPDecryptorChild.cpp
@@ -15,19 +15,22 @@
 #define ON_GMP_THREAD() (mPlugin->GMPMessageLoop() == MessageLoop::current())
 
 #define CALL_ON_GMP_THREAD(_func, ...) \
   CallOnGMPThread(&GMPDecryptorChild::_func, __VA_ARGS__)
 
 namespace mozilla {
 namespace gmp {
 
+static uint32_t sDecryptorCount = 1;
+
 GMPDecryptorChild::GMPDecryptorChild(GMPContentChild* aPlugin)
   : mSession(nullptr)
   , mPlugin(aPlugin)
+  , mDecryptorId(sDecryptorCount++)
 {
   MOZ_ASSERT(mPlugin);
 }
 
 GMPDecryptorChild::~GMPDecryptorChild()
 {
 }
 
@@ -68,17 +71,17 @@ void
 GMPDecryptorChild::Init(GMPDecryptor* aSession)
 {
   MOZ_ASSERT(aSession);
   mSession = aSession;
   // The ID of this decryptor is the IPDL actor ID. Note it's unique inside
   // the child process, but not necessarily across all gecko processes. However,
   // since GMPDecryptors are segregated by node ID/origin, we shouldn't end up
   // with clashes in the content process.
-  SendSetDecryptorId(Id());
+  SendSetDecryptorId(DecryptorId());
 }
 
 void
 GMPDecryptorChild::SetSessionId(uint32_t aCreateSessionToken,
                                 const char* aSessionId,
                                 uint32_t aSessionIdLength)
 {
   CALL_ON_GMP_THREAD(SendSetSessionId,
--- a/dom/media/gmp/GMPDecryptorChild.h
+++ b/dom/media/gmp/GMPDecryptorChild.h
@@ -70,16 +70,17 @@ public:
 
   void Decrypted(GMPBuffer* aBuffer, GMPErr aResult) override;
 
   void BatchedKeyStatusChanged(const char* aSessionId,
                                uint32_t aSessionIdLength,
                                const GMPMediaKeyInfo* aKeyInfos,
                                uint32_t aKeyInfosLength) override;
 
+  uint32_t DecryptorId() const { return mDecryptorId; }
 private:
   ~GMPDecryptorChild();
 
   // GMPDecryptorChild
   mozilla::ipc::IPCResult RecvInit(const bool& aDistinctiveIdentifierRequired,
                                    const bool& aPersistentStateRequired) override;
 
   mozilla::ipc::IPCResult RecvCreateSession(const uint32_t& aCreateSessionToken,
@@ -116,14 +117,16 @@ private:
 
   template<typename MethodType, typename... ParamType>
   void CallOnGMPThread(MethodType, ParamType&&...);
 
   // GMP's GMPDecryptor implementation.
   // Only call into this on the (GMP process) main thread.
   GMPDecryptor* mSession;
   GMPContentChild* mPlugin;
+
+  const uint32_t mDecryptorId;
 };
 
 } // namespace gmp
 } // namespace mozilla
 
 #endif // GMPDecryptorChild_h_