Bug 1390453 - Don't call VerifyCdmHost_0 in non-official builds. r=cpearce, a=lizzard
authorJames Cheng <jacheng@mozilla.com>
Thu, 17 Aug 2017 14:41:54 -0400
changeset 423733 553d2a5f53a3da40f55babcd83d239939e0dda5b
parent 423732 00944b797230fc688374776aea588c6e48f6cc30
child 423734 7b56dc8cc01b9d711a011a439dcc5ff48410ab8e
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerscpearce, lizzard
bugs1390453
milestone56.0
Bug 1390453 - Don't call VerifyCdmHost_0 in non-official builds. r=cpearce, a=lizzard MozReview-Commit-ID: 3rzMDq0upBm
dom/media/gmp/ChromiumCDMAdapter.cpp
media/gmp-clearkey/0.1/gmp-clearkey.cpp
--- a/dom/media/gmp/ChromiumCDMAdapter.cpp
+++ b/dom/media/gmp/ChromiumCDMAdapter.cpp
@@ -46,45 +46,49 @@ ChromiumCdmHost(int aHostInterfaceVersio
     return nullptr;
   }
   return static_cast<cdm::Host_8*>(aUserData);
 }
 
 #define STRINGIFY(s) _STRINGIFY(s)
 #define _STRINGIFY(s) #s
 
+#ifdef MOZILLA_OFFICIAL
 static cdm::HostFile
 TakeToCDMHostFile(HostFileData& aHostFileData)
 {
   return cdm::HostFile(aHostFileData.mBinary.Path().get(),
                        aHostFileData.mBinary.TakePlatformFile(),
                        aHostFileData.mSig.TakePlatformFile());
 }
+#endif
 
 GMPErr
 ChromiumCDMAdapter::GMPInit(const GMPPlatformAPI* aPlatformAPI)
 {
   CDM_LOG("ChromiumCDMAdapter::GMPInit");
   sPlatform = aPlatformAPI;
   if (!mLib) {
     return GMPGenericErr;
   }
 
+#ifdef MOZILLA_OFFICIAL
   // Note: we must call the VerifyCdmHost_0 function if it's present before
   // we call the initialize function.
   auto verify = reinterpret_cast<decltype(::VerifyCdmHost_0)*>(
     PR_FindFunctionSymbol(mLib, STRINGIFY(VerifyCdmHost_0)));
   if (verify) {
     nsTArray<cdm::HostFile> files;
     for (HostFileData& hostFile : mHostFiles) {
       files.AppendElement(TakeToCDMHostFile(hostFile));
     }
     bool result = verify(files.Elements(), files.Length());
     GMP_LOG("%s VerifyCdmHost_0 returned %d", __func__, result);
   }
+#endif
 
   auto init = reinterpret_cast<decltype(::INITIALIZE_CDM_MODULE)*>(
     PR_FindFunctionSymbol(mLib, STRINGIFY(INITIALIZE_CDM_MODULE)));
   if (!init) {
     return GMPGenericErr;
   }
 
   CDM_LOG(STRINGIFY(INITIALIZE_CDM_MODULE)"()");
--- a/media/gmp-clearkey/0.1/gmp-clearkey.cpp
+++ b/media/gmp-clearkey/0.1/gmp-clearkey.cpp
@@ -58,20 +58,22 @@ void* CreateCdmInstance(int cdm_interfac
 
 #ifdef ENABLE_WMF
   if (!wmf::EnsureLibs()) {
     CK_LOGE("Required libraries were not found");
     return nullptr;
   }
 #endif
 
+#ifdef MOZILLA_OFFICIAL
   // Test that we're able to read the host files.
   if (!sCanReadHostVerificationFiles) {
     return nullptr;
   }
+#endif
 
   cdm::Host_8* host = static_cast<cdm::Host_8*>(
     get_cdm_host_func(cdm_interface_version, user_data));
   ClearKeyCDM* clearKey = new ClearKeyCDM(host);
 
   CK_LOGE("Created ClearKeyCDM instance!");
 
   return clearKey;