Commit 6ff68bce authored by Andreas Pehrson's avatar Andreas Pehrson
Browse files

Bug 1788592 - Pre-load oleaut32.dll for all gmp plugins. r=bobowen,media-playback-reviewers,alwu

parent eaa901eb
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -210,7 +210,7 @@ mozilla::ipc::IPCResult GMPChild::RecvPreloadLibs(const nsCString& aLibs) {
      u"msmpeg2vdec.dll",  // H.264 decoder
      u"nss3.dll",         // NSS for clearkey CDM
      u"ole32.dll",        // required for OPM
      u"oleaut32.dll",     // For fake-cdm, unclear dependency, see bug 1785030
      u"oleaut32.dll",     // Unclear dependency, see bugs 1785030, 1788592
      u"psapi.dll",        // For GetMappedFileNameW, see bug 1383611
      u"softokn3.dll",     // NSS for clearkey CDM
      u"winmm.dll",        // Dependency for widevine
+22 −1
Original line number Diff line number Diff line
@@ -790,6 +790,19 @@ static void ApplyGlibcWorkaround(nsCString& aLibs) {
}
#endif

#if defined(XP_WIN)
static void ApplyOleaut32(nsCString& aLibs) {
  // Crashes have been seen across most if not all GMP plugins since the
  // libwebrtc update in bug 1766646. It is still unclear what is triggering the
  // load of oleaut32.dll, so this serves as a band-aid for now; see bugs
  // 1785030, 1788592.
  if (!aLibs.IsEmpty()) {
    aLibs.AppendLiteral(", ");
  }
  aLibs.AppendLiteral("oleaut32.dll");
}
#endif

RefPtr<GenericPromise> GMPParent::ReadGMPInfoFile(nsIFile* aFile) {
  MOZ_ASSERT(GMPEventTarget()->IsOnCurrentThread());
  GMPInfoFileParser parser;
@@ -818,6 +831,10 @@ RefPtr<GenericPromise> GMPParent::ReadGMPInfoFile(nsIFile* aFile) {
  }
#endif

#ifdef XP_WIN
  ApplyOleaut32(mLibs);
#endif

  nsTArray<nsCString> apiTokens;
  SplitAt(", ", apis, apiTokens);
  for (nsCString api : apiTokens) {
@@ -946,7 +963,7 @@ RefPtr<GenericPromise> GMPParent::ParseChromiumManifest(
    // The fake CDM just exposes a key system with id "fake".
    video.mAPITags.AppendElement(nsCString{"fake"});
#if XP_WIN
    mLibs = "dxva2.dll, ole32.dll, oleaut32.dll"_ns;
    mLibs = "dxva2.dll, ole32.dll"_ns;
#endif
  } else {
    GMP_PARENT_LOG_DEBUG("%s: Unrecognized key system: %s, failing.",
@@ -958,6 +975,10 @@ RefPtr<GenericPromise> GMPParent::ParseChromiumManifest(
  ApplyGlibcWorkaround(mLibs);
#endif

#ifdef XP_WIN
  ApplyOleaut32(mLibs);
#endif

  nsCString codecsString = NS_ConvertUTF16toUTF8(m.mX_cdm_codecs);
  nsTArray<nsCString> codecs;
  SplitAt(",", codecsString, codecs);