Bug 1271483 - p6. Separate unplayable formats by missing decoder - r=cpearce
This helps determine how each format is affected by some issues. It will be
needed in later patches, to see when the issue get fixed (by noticing that
these formats become playable again).
MozReview-Commit-ID: 2wFzmnX5rBY
--- a/dom/media/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/DecoderDoctorDiagnostics.cpp
@@ -354,48 +354,51 @@ static void AppendToStringList(nsAString
list += item;
}
void
DecoderDoctorDocumentWatcher::SynthesizeAnalysis()
{
MOZ_ASSERT(NS_IsMainThread());
+ nsAutoString playableFormats;
+ nsAutoString unplayableFormats;
+ // Subsets of unplayableFormats that require a specific platform decoder:
#if defined(XP_WIN)
- bool WMFNeeded = false;
+ nsAutoString formatsRequiringWMF;
#endif
#if defined(MOZ_FFMPEG)
- bool FFMpegNeeded = false;
+ nsAutoString formatsRequiringFFMpeg;
#endif
- nsAutoString playableFormats;
- nsAutoString unplayableFormats;
nsAutoString supportedKeySystems;
nsAutoString unsupportedKeySystems;
DecoderDoctorDiagnostics::KeySystemIssue lastKeySystemIssue =
DecoderDoctorDiagnostics::eUnset;
for (const auto& diag : mDiagnosticsSequence) {
switch (diag.mDecoderDoctorDiagnostics.Type()) {
case DecoderDoctorDiagnostics::eFormatSupportCheck:
if (diag.mDecoderDoctorDiagnostics.CanPlay()) {
AppendToStringList(playableFormats,
diag.mDecoderDoctorDiagnostics.Format());
} else {
+ AppendToStringList(unplayableFormats,
+ diag.mDecoderDoctorDiagnostics.Format());
#if defined(XP_WIN)
if (diag.mDecoderDoctorDiagnostics.DidWMFFailToLoad()) {
- WMFNeeded = true;
+ AppendToStringList(formatsRequiringWMF,
+ diag.mDecoderDoctorDiagnostics.Format());
}
#endif
#if defined(MOZ_FFMPEG)
if (diag.mDecoderDoctorDiagnostics.DidFFmpegFailToLoad()) {
- FFMpegNeeded = true;
+ AppendToStringList(formatsRequiringFFMpeg,
+ diag.mDecoderDoctorDiagnostics.Format());
}
#endif
- AppendToStringList(unplayableFormats,
- diag.mDecoderDoctorDiagnostics.Format());
}
break;
case DecoderDoctorDiagnostics::eMediaKeySystemAccessRequest:
if (diag.mDecoderDoctorDiagnostics.IsKeySystemSupported()) {
AppendToStringList(supportedKeySystems,
diag.mDecoderDoctorDiagnostics.KeySystem());
} else {
AppendToStringList(unsupportedKeySystems,
@@ -433,32 +436,33 @@ DecoderDoctorDocumentWatcher::Synthesize
break;
}
}
// 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...
+ // No requested formats can be played. See if we can help the user, by
+ // going through expected decoders from most to least desirable.
#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());
+ if (!formatsRequiringWMF.IsEmpty()) {
+ DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because WMF was not found",
+ this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringWMF).get());
ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
- "MediaWMFNeeded", unplayableFormats);
+ "MediaWMFNeeded", formatsRequiringWMF);
return;
}
#endif
#if defined(MOZ_FFMPEG)
- if (FFMpegNeeded) {
+ if (!formatsRequiringFFMpeg.IsEmpty()) {
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());
+ this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringFFMpeg).get());
ReportAnalysis(dom::DecoderDoctorNotificationType::Platform_decoder_not_found,
- "MediaPlatformDecoderNotFound", unplayableFormats);
+ "MediaPlatformDecoderNotFound", formatsRequiringFFMpeg);
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;