Bug 848994 - p2. Detect when WMF is not found - r=cpearce

MozReview-Commit-ID: IHvgJNjuyQA
This commit is contained in:
Gerald Squelart 2016-04-22 13:42:11 +10:00
Родитель 0451e54ac6
Коммит 6494d247f8
4 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -446,6 +446,9 @@ DecoderDoctorDiagnostics::GetDescription() const
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";
}

Просмотреть файл

@ -48,6 +48,9 @@ public:
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; }
@ -56,6 +59,7 @@ private:
// True if there is at least one decoder that can play that format.
bool mCanPlay = false;
bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};

Просмотреть файл

@ -165,6 +165,9 @@ PDMFactory::CreateDecoder(const TrackInfo& aConfig,
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();
}
@ -290,7 +293,9 @@ PDMFactory::CreatePDMs()
#ifdef XP_WIN
if (sWMFDecoderEnabled) {
m = new WMFDecoderModule();
StartupPDM(m);
if (!StartupPDM(m)) {
mWMFFailedToLoad = true;
}
}
#endif
#ifdef MOZ_FFVPX
@ -350,6 +355,9 @@ PDMFactory::GetDecoder(const nsACString& aMimeType,
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();
}

Просмотреть файл

@ -95,6 +95,7 @@ private:
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
RefPtr<PlatformDecoderModule> mEMEPDM;
bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};