Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 848994 - p2. Detect when WMF is not found - r=cpearce
Browse files Browse the repository at this point in the history
MozReview-Commit-ID: IHvgJNjuyQA
  • Loading branch information
squelart committed Apr 22, 2016
1 parent 9df8db2 commit c3e9d00
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions dom/media/DecoderDoctorDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
}
Expand Down
4 changes: 4 additions & 0 deletions dom/media/DecoderDoctorDiagnostics.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ class DecoderDoctorDiagnostics
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; }

Expand All @@ -56,6 +59,7 @@ class DecoderDoctorDiagnostics
// True if there is at least one decoder that can play that format.
bool mCanPlay = false;

bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};

Expand Down
10 changes: 9 additions & 1 deletion dom/media/platforms/PDMFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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();
}
Expand Down
1 change: 1 addition & 0 deletions dom/media/platforms/PDMFactory.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ class PDMFactory final {
nsTArray<RefPtr<PlatformDecoderModule>> mCurrentPDMs;
RefPtr<PlatformDecoderModule> mEMEPDM;

bool mWMFFailedToLoad = false;
bool mFFmpegFailedToLoad = false;
};

Expand Down

0 comments on commit c3e9d00

Please sign in to comment.