Bug 848994 - p2. Detect when WMF is not found - r=cpearce
MozReview-Commit-ID: IHvgJNjuyQA
--- a/dom/media/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/DecoderDoctorDiagnostics.cpp
@@ -441,16 +441,19 @@ DecoderDoctorDiagnostics::StoreFormatDia
nsCString
DecoderDoctorDiagnostics::GetDescription() const
{
nsCString s;
if (!mFormat.IsEmpty()) {
s = "format='";
s += NS_ConvertUTF16toUTF8(mFormat).get();
s += mCanPlay ? "', can play" : "', cannot play";
+ if (mWMFFailedToLoad) {
+ s += ", Windows platform decoder failed to load";
+ }
if (mFFmpegFailedToLoad) {
s += ", Linux platform decoder failed to load";
}
} else {
s = "?";
}
return s;
}
--- a/dom/media/DecoderDoctorDiagnostics.h
+++ b/dom/media/DecoderDoctorDiagnostics.h
@@ -43,22 +43,26 @@ public:
// Description string, for logging purposes.
nsCString GetDescription() const;
// Methods to record diagnostic information:
const nsAString& Format() const { return mFormat; }
bool CanPlay() const { return mCanPlay; }
+ void SetWMFFailedToLoad() { mWMFFailedToLoad = true; }
+ bool DidWMFFailToLoad() const { return mWMFFailedToLoad; }
+
void SetFFmpegFailedToLoad() { mFFmpegFailedToLoad = true; }
bool DidFFmpegFailToLoad() const { return mFFmpegFailedToLoad; }
private:
nsString mFormat;
// True if there is at least one decoder that can play that format.
bool mCanPlay = false;
+ bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};
} // namespace mozilla
#endif
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -160,16 +160,19 @@ PDMFactory::CreateDecoder(const TrackInf
aDiagnostics,
aLayersBackend,
aImageContainer);
}
if (aDiagnostics) {
// If libraries failed to load, the following loop over mCurrentPDMs
// will not even try to use them. So we record failures now.
+ if (mWMFFailedToLoad) {
+ aDiagnostics->SetWMFFailedToLoad();
+ }
if (mFFmpegFailedToLoad) {
aDiagnostics->SetFFmpegFailedToLoad();
}
}
for (auto& current : mCurrentPDMs) {
if (!current->SupportsMimeType(aConfig.mMimeType, aDiagnostics)) {
continue;
@@ -285,17 +288,19 @@ PDMFactory::CreatePDMs()
if(sAndroidMCDecoderPreferred && sAndroidMCDecoderEnabled) {
m = new AndroidDecoderModule();
StartupPDM(m);
}
#endif
#ifdef XP_WIN
if (sWMFDecoderEnabled) {
m = new WMFDecoderModule();
- StartupPDM(m);
+ if (!StartupPDM(m)) {
+ mWMFFailedToLoad = true;
+ }
}
#endif
#ifdef MOZ_FFVPX
if (sFFVPXDecoderEnabled) {
m = FFVPXRuntimeLinker::CreateDecoderModule();
StartupPDM(m);
}
#endif
@@ -345,16 +350,19 @@ PDMFactory::StartupPDM(PlatformDecoderMo
already_AddRefed<PlatformDecoderModule>
PDMFactory::GetDecoder(const nsACString& aMimeType,
DecoderDoctorDiagnostics* aDiagnostics) const
{
if (aDiagnostics) {
// If libraries failed to load, the following loop over mCurrentPDMs
// will not even try to use them. So we record failures now.
+ if (mWMFFailedToLoad) {
+ aDiagnostics->SetWMFFailedToLoad();
+ }
if (mFFmpegFailedToLoad) {
aDiagnostics->SetFFmpegFailedToLoad();
}
}
RefPtr<PlatformDecoderModule> pdm;
for (auto& current : mCurrentPDMs) {
if (current->SupportsMimeType(aMimeType, aDiagnostics)) {
--- a/dom/media/platforms/PDMFactory.h
+++ b/dom/media/platforms/PDMFactory.h
@@ -90,14 +90,15 @@ private:
#endif
static bool sEnableFuzzingWrapper;
static uint32_t sVideoOutputMinimumInterval_ms;
static bool sDontDelayInputExhausted;
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
RefPtr<PlatformDecoderModule> mEMEPDM;
+ bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};
} // namespace mozilla
#endif /* PDMFactory_h_ */