Bug 1271483 - p6. Separate unplayable formats by missing decoder - r=cpearce draft
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 12 May 2016 16:28:11 +1000
changeset 380469 a6106b8bfc58243337e83bbe6a70eefae7be5362
parent 380468 fd0e44afb3b33ff03324e1eb2c23117526941047
child 380470 ff1a3f46ec7348ed6bc0697bce932a072a8ee0c9
child 380480 10bfefe6fcf5456353408d07f5785689266c3f4e
push id21229
push usergsquelart@mozilla.com
push dateWed, 22 Jun 2016 01:27:56 +0000
reviewerscpearce
bugs1271483
milestone50.0a1
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
dom/media/DecoderDoctorDiagnostics.cpp
--- 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;