Bug 1273310 - Simplify DecoderDoctor failure flags. r=gerald
This is a bit easier to read. Currently there's no difference
since Startup is only called once, but it's probably better
future-proofing too, since the diagnostics should care more
about the current state than whether there's every been a
failure. Likewise reset the flags if the decoder is turned
off by a preference change.
MozReview-Commit-ID: 4zD7rkD6A3J
--- a/dom/media/platforms/PDMFactory.cpp
+++ b/dom/media/platforms/PDMFactory.cpp
@@ -250,33 +250,33 @@ PDMFactory::CreatePDMs()
MediaPrefs::PDMAndroidMediaCodecEnabled()) {
m = new AndroidDecoderModule();
StartupPDM(m);
}
#endif
#ifdef XP_WIN
if (MediaPrefs::PDMWMFEnabled()) {
m = new WMFDecoderModule();
- if (!StartupPDM(m)) {
- mWMFFailedToLoad = true;
- }
+ mWMFFailedToLoad = !StartupPDM(m);
+ } else {
+ mWMFFailedToLoad = false;
}
#endif
#ifdef MOZ_FFVPX
if (MediaPrefs::PDMFFVPXEnabled()) {
m = FFVPXRuntimeLinker::CreateDecoderModule();
StartupPDM(m);
}
#endif
#ifdef MOZ_FFMPEG
if (MediaPrefs::PDMFFmpegEnabled()) {
m = FFmpegRuntimeLinker::CreateDecoderModule();
- if (!StartupPDM(m)) {
- mFFmpegFailedToLoad = true;
- }
+ mFFmpegFailedToLoad = !StartupPDM(m);
+ } else {
+ mFFmpegFailedToLoad = false;
}
#endif
#ifdef MOZ_APPLEMEDIA
m = new AppleDecoderModule();
StartupPDM(m);
#endif
#ifdef MOZ_GONK_MEDIACODEC
if (MediaPrefs::PDMGonkDecoderEnabled()) {
@@ -291,19 +291,19 @@ PDMFactory::CreatePDMs()
}
#endif
m = new AgnosticDecoderModule();
StartupPDM(m);
if (MediaPrefs::PDMGMPEnabled()) {
m = new GMPDecoderModule();
- if (!StartupPDM(m)) {
- mGMPPDMFailedToStartup = true;
- }
+ mGMPPDMFailedToStartup = !StartupPDM(m);
+ } else {
+ mGMPPDMFailedToStartup = false;
}
}
bool
PDMFactory::StartupPDM(PlatformDecoderModule* aPDM)
{
if (aPDM && NS_SUCCEEDED(aPDM->Startup())) {
mCurrentPDMs.AppendElement(aPDM);