Bug 1271483 - p15. Check if issues have been solved - r=cpearce
authorGerald Squelart <gsquelart@mozilla.com>
Wed, 25 May 2016 00:41:53 +1000
changeset 302286 575198d83ce778cd2dad9e7ce6978b6f58937738
parent 302285 d780f0ca52436491f471b24bb99a22222aa9c870
child 302287 da005aa1d83c4a32c2ff1d211d359581013352ed
push id78676
push usergsquelart@mozilla.com
push dateWed, 22 Jun 2016 03:54:32 +0000
treeherdermozilla-inbound@da005aa1d83c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce
bugs1271483
milestone50.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1271483 - p15. Check if issues have been solved - r=cpearce To determine if an issue has been solved, go through the possible prefs that would have been saved by the front-end, to see if any previously-unplayable formats/key systems are now playable, in which case we notify the frontend, to record the issue-solved telemetry. MozReview-Commit-ID: DmU50i6FtG8
dom/media/DecoderDoctorDiagnostics.cpp
--- a/dom/media/DecoderDoctorDiagnostics.cpp
+++ b/dom/media/DecoderDoctorDiagnostics.cpp
@@ -366,16 +366,26 @@ static const NotificationAndReportString
     "MediaPlatformDecoderNotFound" };
 static const NotificationAndReportStringId sMediaCannotPlayNoDecoders =
   { dom::DecoderDoctorNotificationType::Cannot_play,
     "MediaCannotPlayNoDecoders" };
 static const NotificationAndReportStringId sMediaNoDecoders =
   { dom::DecoderDoctorNotificationType::Can_play_but_some_missing_decoders,
     "MediaNoDecoders" };
 
+static const NotificationAndReportStringId*
+sAllNotificationsAndReportStringIds[] =
+{
+  &sMediaWidevineNoWMFNoSilverlight,
+  &sMediaWMFNeeded,
+  &sMediaPlatformDecoderNotFound,
+  &sMediaCannotPlayNoDecoders,
+  &sMediaNoDecoders
+};
+
 static void
 DispatchNotification(nsISupports* aSubject,
                      const NotificationAndReportStringId& aNotification,
                      bool aIsSolved,
                      const nsAString& aFormats)
 {
   if (!aSubject) {
     return;
@@ -561,24 +571,76 @@ DecoderDoctorDocumentWatcher::Synthesize
         MOZ_ASSERT(diag.mDecoderDoctorDiagnostics.Type()
                      == DecoderDoctorDiagnostics::eFormatSupportCheck
                    || diag.mDecoderDoctorDiagnostics.Type()
                         == DecoderDoctorDiagnostics::eMediaKeySystemAccessRequest);
         break;
     }
   }
 
+  // Check if issues have been solved, by finding if some now-playable
+  // key systems or formats were previously recorded as having issues.
+  if (!supportedKeySystems.IsEmpty() || !playableFormats.IsEmpty()) {
+    DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - supported key systems '%s', playable formats '%s'; See if they show issues have been solved...",
+             this, mDocument,
+             NS_ConvertUTF16toUTF8(supportedKeySystems).Data(),
+             NS_ConvertUTF16toUTF8(playableFormats).get());
+    const nsAString* workingFormatsArray[] =
+      { &supportedKeySystems, &playableFormats };
+    // For each type of notification, retrieve the pref that contains formats/
+    // key systems with issues.
+    for (const NotificationAndReportStringId* id :
+           sAllNotificationsAndReportStringIds) {
+      nsAutoCString formatsPref("media.decoder-doctor.");
+      formatsPref += id->mReportStringId;
+      formatsPref += ".formats";
+      nsAdoptingString formatsWithIssues =
+        Preferences::GetString(formatsPref.Data());
+      if (formatsWithIssues.IsEmpty()) {
+        continue;
+      }
+      // See if that list of formats-with-issues contains any formats that are
+      // now playable/supported.
+      bool solved = false;
+      for (const nsAString* workingFormats : workingFormatsArray) {
+        for (const auto& workingFormat : MakeStringListRange(*workingFormats)) {
+          if (FormatsListContains(formatsWithIssues, workingFormat)) {
+            // This now-working format used not to work -> Report solved issue.
+            DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - %s solved ('%s' now works, it was in pref(%s)='%s')",
+                    this, mDocument, id->mReportStringId,
+                    NS_ConvertUTF16toUTF8(workingFormat).get(),
+                    formatsPref.Data(),
+                    NS_ConvertUTF16toUTF8(formatsWithIssues).get());
+            ReportAnalysis(*id, true, workingFormat);
+            // This particular Notification&ReportId has been solved, no need
+            // to keep looking at other keysys/formats that might solve it too.
+            solved = true;
+            break;
+          }
+        }
+        if (solved) {
+          break;
+        }
+      }
+      if (!solved) {
+        DD_DEBUG("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - %s not solved (pref(%s)='%s')",
+                 this, mDocument, id->mReportStringId, formatsPref.Data(),
+                 NS_ConvertUTF16toUTF8(formatsWithIssues).get());
+      }
+    }
+  }
+
   // 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());
+          DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unsupported key systems: %s, widevine without WMF nor Silverlight",
+                  this, mDocument, NS_ConvertUTF16toUTF8(unsupportedKeySystems).get());
           ReportAnalysis(
             sMediaWidevineNoWMFNoSilverlight, false, unsupportedKeySystems);
           return;
         }
         break;
       default:
         break;
     }
@@ -587,32 +649,32 @@ DecoderDoctorDocumentWatcher::Synthesize
   // 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, by
       // going through expected decoders from most to least desirable.
 #if defined(XP_WIN)
       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());
+        DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because WMF was not found",
+                this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringWMF).get());
         ReportAnalysis(sMediaWMFNeeded, false, formatsRequiringWMF);
         return;
       }
 #endif
 #if defined(MOZ_FFMPEG)
       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(formatsRequiringFFMpeg).get());
+        DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - unplayable formats: %s -> Cannot play media because platform decoder was not found",
+                this, mDocument, NS_ConvertUTF16toUTF8(formatsRequiringFFMpeg).get());
         ReportAnalysis(sMediaPlatformDecoderNotFound,
                        false, formatsRequiringFFMpeg);
         return;
       }
 #endif
-      DD_WARN("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - Cannot play media, unplayable formats: %s",
+      DD_INFO("DecoderDoctorDocumentWatcher[%p, doc=%p]::SynthesizeAnalysis() - Cannot play media, unplayable formats: %s",
               this, mDocument, NS_ConvertUTF16toUTF8(unplayableFormats).get());
       ReportAnalysis(sMediaCannotPlayNoDecoders, false, unplayableFormats);
       return;
     }
 
     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)) {