--- a/dom/media/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/DecoderDoctorDiagnostics.cpp
@@ -354,17 +354,16 @@ static void AppendToStringList(nsAString
list += item;
}
void
DecoderDoctorDocumentWatcher::SynthesizeAnalysis()
{
MOZ_ASSERT(NS_IsMainThread());
- bool canPlay = false;
#if defined(XP_WIN)
bool WMFNeeded = false;
#endif
#if defined(MOZ_FFMPEG)
bool FFMpegNeeded = false;
#endif
nsAutoString playableFormats;
nsAutoString unplayableFormats;
@@ -372,17 +371,16 @@ DecoderDoctorDocumentWatcher::Synthesize
nsAutoString unsupportedKeySystems;
DecoderDoctorDiagnostics::KeySystemIssue lastKeySystemIssue =
DecoderDoctorDiagnostics::eUnset;
for (const auto& diag : mDiagnosticsSequence) {
switch (diag.mDecoderDoctorDiagnostics.Type()) {
case DecoderDoctorDiagnostics::eFormatSupportCheck:
if (diag.mDecoderDoctorDiagnostics.CanPlay()) {
- canPlay = true;
AppendToStringList(playableFormats,
diag.mDecoderDoctorDiagnostics.Format());
} else {
#if defined(XP_WIN)
if (diag.mDecoderDoctorDiagnostics.DidWMFFailToLoad()) {
WMFNeeded = true;
}
#endif
@@ -413,17 +411,17 @@ DecoderDoctorDocumentWatcher::Synthesize
MOZ_ASSERT(diag.mDecoderDoctorDiagnostics.Type()
== DecoderDoctorDiagnostics::eFormatSupportCheck
|| diag.mDecoderDoctorDiagnostics.Type()
== DecoderDoctorDiagnostics::eMediaKeySystemAccessRequest);
break;
}
}
- // Look at Key System issues first, as they may influence format checks.
+ // Look at Key System issues first, as they take precedence over format checks.
if (!unsupportedKeySystems.IsEmpty() && supportedKeySystems.IsEmpty()) {
// No supported key systems!
switch (lastKeySystemIssue) {
case DecoderDoctorDiagnostics::eWidevineWithNoWMF:
if (CheckSilverlight() != eSilverlightEnabled) {
DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unsupported key systems: %s, widevine without WMF nor Silverlight",
this, mDocument, NS_ConvertUTF16toUTF8(unsupportedKeySystems).get());
ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
@@ -431,42 +429,46 @@ DecoderDoctorDocumentWatcher::Synthesize
return;
}
break;
default:
break;
}
}
- if (!canPlay && !unplayableFormats.IsEmpty()) {
+ // Next, check playability of requested formats.
+ if (!unplayableFormats.IsEmpty()) {
+ // Some requested formats cannot be played.
+ if (playableFormats.IsEmpty()) {
+ // No requested formats can be played. See if we can help the user...
#if defined(XP_WIN)
- if (WMFNeeded) {
- DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - formats: %s -> Cannot play media because WMF was not found",
- this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
- ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
- "MediaWMFNeeded", unplayableFormats);
- return;
- }
+ if (WMFNeeded) {
+ DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - formats: %s -> Cannot play media because WMF was not found",
+ this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
+ ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
+ "MediaWMFNeeded", unplayableFormats);
+ return;
+ }
#endif
#if defined(MOZ_FFMPEG)
- if (FFMpegNeeded) {
- DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because platform decoder was not found",
- this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
- ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
- "MediaPlatformDecoderNotFound", unplayableFormats);
+ if (FFMpegNeeded) {
+ DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because platform decoder was not found",
+ this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
+ ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
+ "MediaPlatformDecoderNotFound", unplayableFormats);
+ return;
+ }
+#endif
+ DD_WARN("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - Cannot play media, unplayable formats: %s",
+ this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
+ ReportAnalysis(dom::DecoderDoctorNotificationType::Cannot_play,
+ "MediaCannotPlayNoDecoders", unplayableFormats);
return;
}
-#endif
- DD_WARN("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - Cannot play media, unplayable formats: %s",
- this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
- ReportAnalysis(dom::DecoderDoctorNotificationType::Cannot_play,
- "MediaCannotPlayNoDecoders", unplayableFormats);
- return;
- }
- if (!unplayableFormats.IsEmpty()) {
+
DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - Can play media, but no decoders for some requested formats: %s",
this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
if (Preferences::GetBool("media.decoder-doctor.verbose", false)) {
ReportAnalysis(
dom::DecoderDoctorNotificationType::Can_play_but_some_missing_decoders,
"MediaNoDecoders", unplayableFormats);
}
return;