Bug 1271483 - p6. Separate unplayable formats by missing decoder - r=cpearce, a=lizzard
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 12 May 2016 16:28:11 +1000
changeset 339794 812548e445458eb870d0fe31779f59c7f6dbafd8
parent 339793 41617bfea7c83715fbad786b9f795d233a47b40c
child 339795 a3b704b37e5fe2c76b1baa3e7aa927c0fef52783
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lizzard
bugs1271483
milestone49.0a2
Bug 1271483 - p6. Separate unplayable formats by missing decoder - r=cpearce, a=lizzard 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;