Bug 1322739: P2. Add Low Latency option to CreateDecoderParams. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Mon, 20 Feb 2017 19:22:45 +0100
changeset 487902 92ad98063dbf817277409b1433b966d48234dc8c
parent 487901 f8f210b6d0d0fcaf65afc725eb1ff29668499ccf
child 487903 aaee8032365dc9086f5439d032863cf20b6478df
push id46398
push userbmo:jyavenard@mozilla.com
push dateWed, 22 Feb 2017 11:26:39 +0000
reviewersgerald
bugs1322739
milestone54.0a1
Bug 1322739: P2. Add Low Latency option to CreateDecoderParams. r?gerald MozReview-Commit-ID: KcTGGUK7aq5
dom/media/platforms/PlatformDecoderModule.h
--- a/dom/media/platforms/PlatformDecoderModule.h
+++ b/dom/media/platforms/PlatformDecoderModule.h
@@ -6,16 +6,17 @@
 
 #if !defined(PlatformDecoderModule_h_)
 #define PlatformDecoderModule_h_
 
 #include "GMPCrashHelper.h"
 #include "MediaDecoderReader.h"
 #include "MediaInfo.h"
 #include "MediaResult.h"
+#include "mozilla/EnumSet.h"
 #include "mozilla/MozPromise.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/layers/KnowsCompositor.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "nsTArray.h"
 #include <queue>
 
 namespace mozilla {
@@ -38,16 +39,23 @@ class TaskQueue;
 class CDMProxy;
 
 static LazyLogModule sPDMLog("PlatformDecoderModule");
 
 struct MOZ_STACK_CLASS CreateDecoderParams final
 {
   explicit CreateDecoderParams(const TrackInfo& aConfig) : mConfig(aConfig) { }
 
+  enum class Option
+  {
+    Default,
+    LowLatency,
+  };
+  using OptionSet = EnumSet<Option>;
+
   template <typename T1, typename... Ts>
   CreateDecoderParams(const TrackInfo& aConfig, T1&& a1, Ts&&... args)
     : mConfig(aConfig)
   {
     Set(mozilla::Forward<T1>(a1), mozilla::Forward<Ts>(args)...);
   }
 
   const VideoInfo& VideoConfig() const
@@ -75,30 +83,32 @@ struct MOZ_STACK_CLASS CreateDecoderPara
   DecoderDoctorDiagnostics* mDiagnostics = nullptr;
   layers::ImageContainer* mImageContainer = nullptr;
   MediaResult* mError = nullptr;
   RefPtr<layers::KnowsCompositor> mKnowsCompositor;
   RefPtr<GMPCrashHelper> mCrashHelper;
   bool mUseBlankDecoder = false;
   TrackInfo::TrackType mType = TrackInfo::kUndefinedTrack;
   MediaEventProducer<TrackInfo::TrackType>* mOnWaitingForKeyEvent = nullptr;
+  OptionSet mOptions = OptionSet(Option::Default);
 
 private:
   void Set(TaskQueue* aTaskQueue) { mTaskQueue = aTaskQueue; }
   void Set(DecoderDoctorDiagnostics* aDiagnostics)
   {
     mDiagnostics = aDiagnostics;
   }
   void Set(layers::ImageContainer* aImageContainer)
   {
     mImageContainer = aImageContainer;
   }
   void Set(MediaResult* aError) { mError = aError; }
   void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; }
   void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; }
+  void Set(OptionSet aOptions) { mOptions = aOptions; }
   void Set(layers::KnowsCompositor* aKnowsCompositor)
   {
     mKnowsCompositor = aKnowsCompositor;
   }
   void Set(TrackInfo::TrackType aType)
   {
     mType = aType;
   }