Bug 1274626 - Part 4 - provide APIs to create blank decoders; r=jya

MozReview-Commit-ID: LiXOAzvVb1K

--HG--
extra : transplant_source : %F8%29%C0%9C/%A7%17-%E1%04r%A2%FD%00%93e%21Z%29%A4
This commit is contained in:
Kaku Kuo 2016-07-28 23:11:57 +08:00
parent d22560cfe6
commit 59a499df96
3 changed files with 17 additions and 0 deletions

View File

@ -79,6 +79,7 @@ PDMFactory::PDMFactory()
{
EnsureInit();
CreatePDMs();
CreateBlankPDM();
}
PDMFactory::~PDMFactory()
@ -118,6 +119,11 @@ PDMFactory::EnsureInit() const
already_AddRefed<MediaDataDecoder>
PDMFactory::CreateDecoder(const CreateDecoderParams& aParams)
{
if (aParams.mUseBlankDecoder) {
MOZ_ASSERT(mBlankPDM);
return CreateDecoderWithPDM(mBlankPDM, aParams);
}
const TrackInfo& config = aParams.mConfig;
bool isEncrypted = mEMEPDM && config.mCrypto.mValid;
@ -285,6 +291,13 @@ PDMFactory::CreatePDMs()
}
}
void
PDMFactory::CreateBlankPDM()
{
mBlankPDM = CreateBlankDecoderModule();
MOZ_ASSERT(mBlankPDM && NS_SUCCEEDED(mBlankPDM->Startup()));
}
bool
PDMFactory::StartupPDM(PlatformDecoderModule* aPDM)
{

View File

@ -47,6 +47,7 @@ public:
private:
virtual ~PDMFactory();
void CreatePDMs();
void CreateBlankPDM();
// Startup the provided PDM and add it to our list if successful.
bool StartupPDM(PlatformDecoderModule* aPDM);
// Returns the first PDM in our list supporting the mimetype.
@ -60,6 +61,7 @@ private:
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
RefPtr<PlatformDecoderModule> mEMEPDM;
RefPtr<PlatformDecoderModule> mBlankPDM;
bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;

View File

@ -64,6 +64,7 @@ struct CreateDecoderParams {
layers::ImageContainer* mImageContainer = nullptr;
layers::LayersBackend mLayersBackend = layers::LayersBackend::LAYERS_NONE;
RefPtr<GMPCrashHelper> mCrashHelper;
bool mUseBlankDecoder = false;
private:
void Set(TaskQueue* aTaskQueue) { mTaskQueue = aTaskQueue; }
@ -72,6 +73,7 @@ private:
void Set(layers::ImageContainer* aImageContainer) { mImageContainer = aImageContainer; }
void Set(layers::LayersBackend aLayersBackend) { mLayersBackend = aLayersBackend; }
void Set(GMPCrashHelper* aCrashHelper) { mCrashHelper = aCrashHelper; }
void Set(bool aUseBlankDecoder) { mUseBlankDecoder = aUseBlankDecoder; }
template <typename T1, typename T2, typename... Ts>
void Set(T1&& a1, T2&& a2, Ts&&... args)
{