Bug 1329543 - Remove IsPrimetimeKeySystem(string) from Gecko. r=gerald draft
authorChris Pearce <cpearce@mozilla.com>
Mon, 09 Jan 2017 21:51:40 +0800
changeset 462223 4ff0a6d12d230f7df846bb40242fe2504dd11285
parent 462222 e3a49fc51c133d5351bb83106bbbf2ab4aa27042
child 462224 91f72829ea1b894ebbfa9df250c2911350cf9ee6
push id41681
push userbmo:cpearce@mozilla.com
push dateMon, 16 Jan 2017 21:45:55 +0000
reviewersgerald
bugs1329543
milestone53.0a1
Bug 1329543 - Remove IsPrimetimeKeySystem(string) from Gecko. r=gerald MozReview-Commit-ID: LX1ywPZDHtj
dom/html/HTMLMediaElement.cpp
dom/media/eme/EMEUtils.cpp
dom/media/eme/EMEUtils.h
dom/media/eme/MediaKeySystemAccessManager.cpp
--- a/dom/html/HTMLMediaElement.cpp
+++ b/dom/html/HTMLMediaElement.cpp
@@ -6061,26 +6061,16 @@ void HTMLMediaElement::SuspendOrResumeEl
       // For EME content, we may force destruction of the CDM client (and CDM
       // instance if this is the last client for that CDM instance) and
       // the CDM's decoder. This ensures the CDM gets reliable and prompt
       // shutdown notifications, as it may have book-keeping it needs
       // to do on shutdown.
       if (mMediaKeys) {
         nsAutoString keySystem;
         mMediaKeys->GetKeySystem(keySystem);
-        // If we're using Primetime we need to shutdown the key system and
-        // decoder to preserve secure stop like behavior, other CDMs don't
-        // implement this so we don't need to worry with them on a suspend.
-        if (IsPrimetimeKeySystem(keySystem)) {
-          mMediaKeys->Shutdown();
-          mMediaKeys = nullptr;
-          if (mDecoder) {
-            ShutdownDecoder();
-          }
-        }
       }
       if (mDecoder) {
         mDecoder->Pause();
         mDecoder->Suspend();
       }
       mEventDeliveryPaused = aSuspendEvents;
     } else {
       if (mDecoder) {
--- a/dom/media/eme/EMEUtils.cpp
+++ b/dom/media/eme/EMEUtils.cpp
@@ -49,33 +49,24 @@ CopyArrayBufferViewOrArrayBufferData(con
 
 bool
 IsClearkeyKeySystem(const nsAString& aKeySystem)
 {
   return !CompareUTF8toUTF16(kEMEKeySystemClearkey, aKeySystem);
 }
 
 bool
-IsPrimetimeKeySystem(const nsAString& aKeySystem)
-{
-  return !CompareUTF8toUTF16(kEMEKeySystemPrimetime, aKeySystem);
-}
-
-bool
 IsWidevineKeySystem(const nsAString& aKeySystem)
 {
   return !CompareUTF8toUTF16(kEMEKeySystemWidevine, aKeySystem);
 }
 
 nsString
 KeySystemToGMPName(const nsAString& aKeySystem)
 {
-  if (IsPrimetimeKeySystem(aKeySystem)) {
-    return NS_LITERAL_STRING("gmp-eme-adobe");
-  }
   if (IsClearkeyKeySystem(aKeySystem)) {
     return NS_LITERAL_STRING("gmp-clearkey");
   }
   if (IsWidevineKeySystem(aKeySystem)) {
     return NS_LITERAL_STRING("gmp-widevinecdm");
   }
   MOZ_ASSERT(false, "We should only call this for known GMPs");
   return EmptyString();
@@ -83,15 +74,13 @@ KeySystemToGMPName(const nsAString& aKey
 
 CDMType
 ToCDMTypeTelemetryEnum(const nsString& aKeySystem)
 {
   if (IsWidevineKeySystem(aKeySystem)) {
     return CDMType::eWidevine;
   } else if (IsClearkeyKeySystem(aKeySystem)) {
     return CDMType::eClearKey;
-  } else if (IsPrimetimeKeySystem(aKeySystem)) {
-    return CDMType::ePrimetime;
   }
   return CDMType::eUnknown;
 }
 
 } // namespace mozilla
--- a/dom/media/eme/EMEUtils.h
+++ b/dom/media/eme/EMEUtils.h
@@ -82,24 +82,24 @@ GetArrayBufferViewOrArrayBufferData(cons
 
 nsString
 KeySystemToGMPName(const nsAString& aKeySystem);
 
 bool
 IsClearkeyKeySystem(const nsAString& aKeySystem);
 
 bool
-IsPrimetimeKeySystem(const nsAString& aKeySystem);
-
-bool
 IsWidevineKeySystem(const nsAString& aKeySystem);
 
+// Note: Primetime is now unsupported, but we leave it in the enum so
+// that the telemetry enum values are not changed; doing so would break
+// existing telemetry probes.
 enum CDMType {
   eClearKey = 0,
-  ePrimetime = 1,
+  ePrimetime = 1, // Note: Unsupported.
   eWidevine = 2,
   eUnknown = 3
 };
 
 CDMType
 ToCDMTypeTelemetryEnum(const nsString& aKeySystem);
 
 } // namespace mozilla
--- a/dom/media/eme/MediaKeySystemAccessManager.cpp
+++ b/dom/media/eme/MediaKeySystemAccessManager.cpp
@@ -89,19 +89,17 @@ MediaKeySystemAccessManager::Request(Det
     // Don't notify DecoderDoctor, as there's nothing we or the user can
     // do to fix this situation; the site is using the API wrong.
     return;
   }
 
   DecoderDoctorDiagnostics diagnostics;
 
   // Ensure keysystem is supported.
-  if (!IsWidevineKeySystem(aKeySystem) &&
-      !IsClearkeyKeySystem(aKeySystem) &&
-      !IsPrimetimeKeySystem(aKeySystem)) {
+  if (!IsWidevineKeySystem(aKeySystem) && !IsClearkeyKeySystem(aKeySystem)) {
     // Not to inform user, because nothing to do if the keySystem is not
     // supported.
     aPromise->MaybeReject(NS_ERROR_DOM_NOT_SUPPORTED_ERR,
                           NS_LITERAL_CSTRING("Key system is unsupported"));
     diagnostics.StoreMediaKeySystemAccess(mWindow->GetExtantDoc(),
                                           aKeySystem, false, __func__);
     return;
   }
@@ -127,17 +125,17 @@ MediaKeySystemAccessManager::Request(Det
   nsPrintfCString msg("MediaKeySystemAccess::GetKeySystemStatus(%s) "
                       "result=%s msg='%s'",
                       NS_ConvertUTF16toUTF8(aKeySystem).get(),
                       MediaKeySystemStatusValues::strings[(size_t)status].value,
                       message.get());
   LogToBrowserConsole(NS_ConvertUTF8toUTF16(msg));
 
   if (status == MediaKeySystemStatus::Cdm_not_installed &&
-      (IsPrimetimeKeySystem(aKeySystem) || IsWidevineKeySystem(aKeySystem))) {
+      IsWidevineKeySystem(aKeySystem)) {
     // These are cases which could be resolved by downloading a new(er) CDM.
     // When we send the status to chrome, chrome's GMPProvider will attempt to
     // download or update the CDM. In AwaitInstall() we add listeners to wait
     // for the update to complete, and we'll call this function again with
     // aType==Subsequent once the download has completed and the GMPService
     // has had a new plugin added. AwaitInstall() sets a timer to fail if the
     // update/download takes too long or fails.
     if (aType == RequestType::Initial &&