Bug 1334061: P5. Export EMEMediaDataDecoderProxy. r=cpearce
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 16 Feb 2017 11:20:57 +0100
changeset 343498 26aa275d7c644a4991c418c845dd009d17470dfc
parent 343497 a4b22fd48c583795b067bdade072e866d2183c15
child 343499 6407c2fcf72c67bed9c7859de00ddddafbd6b5ef
push id31381
push userkwierso@gmail.com
push dateFri, 17 Feb 2017 20:45:51 +0000
treeherdermozilla-central@f302def88fe5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1334061
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 1334061: P5. Export EMEMediaDataDecoderProxy. r=cpearce MozReview-Commit-ID: IScLmzC5toP
dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
dom/media/platforms/agnostic/eme/EMEDecoderModule.h
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.cpp
@@ -4,19 +4,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "EMEDecoderModule.h"
 #include "EMEVideoDecoder.h"
 #include "GMPDecoderModule.h"
 #include "GMPService.h"
 #include "MP4Decoder.h"
-#include "MediaDataDecoderProxy.h"
 #include "MediaInfo.h"
 #include "MediaPrefs.h"
+#include "PDMFactory.h"
+#include "gmp-decryption.h"
 #include "mozIGeckoMediaPluginService.h"
 #include "mozilla/CDMProxy.h"
 #include "mozilla/EMEUtils.h"
 #include "mozilla/Unused.h"
 #include "nsAutoPtr.h"
 #include "nsClassHashtable.h"
 #include "nsServiceManagerUtils.h"
 
@@ -199,43 +200,29 @@ private:
   MozPromiseHolder<DecodePromise> mDecodePromise;
   MozPromiseHolder<DecodePromise> mDrainPromise;
   MozPromiseHolder<FlushPromise> mFlushPromise;
   MozPromiseRequestHolder<DecodePromise> mDecodeRequest;
 
   bool mIsShutdown;
 };
 
-class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy
+EMEMediaDataDecoderProxy::EMEMediaDataDecoderProxy(
+  already_AddRefed<AbstractThread> aProxyThread,
+  CDMProxy* aProxy,
+  const CreateDecoderParams& aParams)
+  : MediaDataDecoderProxy(Move(aProxyThread))
+  , mTaskQueue(AbstractThread::GetCurrent()->AsTaskQueue())
+  , mSamplesWaitingForKey(
+      new SamplesWaitingForKey(aProxy,
+                               aParams.mType,
+                               aParams.mOnWaitingForKeyEvent))
+  , mProxy(aProxy)
 {
-public:
-  EMEMediaDataDecoderProxy(
-    already_AddRefed<AbstractThread> aProxyThread, CDMProxy* aProxy,
-    TrackInfo::TrackType aType,
-    MediaEventProducer<TrackInfo::TrackType>* aOnWaitingForKey)
-    : MediaDataDecoderProxy(Move(aProxyThread))
-    , mTaskQueue(AbstractThread::GetCurrent()->AsTaskQueue())
-    , mSamplesWaitingForKey(
-        new SamplesWaitingForKey(aProxy, aType, aOnWaitingForKey))
-    , mProxy(aProxy)
-  {
-  }
-
-  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
-  RefPtr<FlushPromise> Flush() override;
-  RefPtr<ShutdownPromise> Shutdown() override;
-
-private:
-  RefPtr<TaskQueue> mTaskQueue;
-  RefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
-  MozPromiseRequestHolder<SamplesWaitingForKey::WaitForKeyPromise> mKeyRequest;
-  MozPromiseHolder<DecodePromise> mDecodePromise;
-  MozPromiseRequestHolder<DecodePromise> mDecodeRequest;
-  RefPtr<CDMProxy> mProxy;
-};
+}
 
 RefPtr<MediaDataDecoder::DecodePromise>
 EMEMediaDataDecoderProxy::Decode(MediaRawData* aSample)
 {
   RefPtr<DecodePromise> p = mDecodePromise.Ensure(__func__);
 
   RefPtr<EMEMediaDataDecoderProxy> self = this;
   mSamplesWaitingForKey->WaitIfKeyNotUsable(aSample)
@@ -302,17 +289,17 @@ CreateDecoderWrapper(CDMProxy* aProxy, c
   if (!s) {
     return nullptr;
   }
   RefPtr<AbstractThread> thread(s->GetAbstractGMPThread());
   if (!thread) {
     return nullptr;
   }
   RefPtr<MediaDataDecoderProxy> decoder(new EMEMediaDataDecoderProxy(
-    thread.forget(), aProxy, aParams.mType, aParams.mOnWaitingForKeyEvent));
+    thread.forget(), aProxy, aParams));
   return decoder.forget();
 }
 
 already_AddRefed<MediaDataDecoder>
 EMEDecoderModule::CreateVideoDecoder(const CreateDecoderParams& aParams)
 {
   MOZ_ASSERT(aParams.mConfig.mCrypto.mValid);
 
--- a/dom/media/platforms/agnostic/eme/EMEDecoderModule.h
+++ b/dom/media/platforms/agnostic/eme/EMEDecoderModule.h
@@ -2,23 +2,25 @@
 /* vim:set ts=2 sw=2 sts=2 et cindent: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #if !defined(EMEDecoderModule_h_)
 #define EMEDecoderModule_h_
 
-#include "PDMFactory.h"
+#include "MediaDataDecoderProxy.h"
 #include "PlatformDecoderModule.h"
-#include "gmp-decryption.h"
+#include "PlatformDecoderModule.h"
+#include "SamplesWaitingForKey.h"
 
 namespace mozilla {
 
 class CDMProxy;
+class PDMFactory;
 
 class EMEDecoderModule : public PlatformDecoderModule
 {
 public:
   EMEDecoderModule(CDMProxy* aProxy, PDMFactory* aPDM);
 
 protected:
   // Decode thread.
@@ -38,11 +40,31 @@ protected:
 
 private:
   virtual ~EMEDecoderModule();
   RefPtr<CDMProxy> mProxy;
   // Will be null if CDM has decoding capability.
   RefPtr<PDMFactory> mPDM;
 };
 
+class EMEMediaDataDecoderProxy : public MediaDataDecoderProxy
+{
+public:
+  EMEMediaDataDecoderProxy(
+    already_AddRefed<AbstractThread> aProxyThread, CDMProxy* aProxy,
+    const CreateDecoderParams& aParams);
+
+  RefPtr<DecodePromise> Decode(MediaRawData* aSample) override;
+  RefPtr<FlushPromise> Flush() override;
+  RefPtr<ShutdownPromise> Shutdown() override;
+
+private:
+  RefPtr<TaskQueue> mTaskQueue;
+  RefPtr<SamplesWaitingForKey> mSamplesWaitingForKey;
+  MozPromiseRequestHolder<SamplesWaitingForKey::WaitForKeyPromise> mKeyRequest;
+  MozPromiseHolder<DecodePromise> mDecodePromise;
+  MozPromiseRequestHolder<DecodePromise> mDecodeRequest;
+  RefPtr<CDMProxy> mProxy;
+};
+
 } // namespace mozilla
 
 #endif // EMEDecoderModule_h_