Bug 1322739: P2. Add Low Latency option to CreateDecoderParams. r?gerald
MozReview-Commit-ID: KcTGGUK7aq5
--- 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;
}