From 8dd16259287f58f9273002717ec4d27e97127719 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 12 Jun 2024 07:43:14 +0200 Subject: Merging upstream version 127.0. Signed-off-by: Daniel Baumann --- .../platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp | 48 ++++++++++++---------- dom/media/platforms/ffmpeg/ffvpx/moz.build | 2 +- 2 files changed, 27 insertions(+), 23 deletions(-) (limited to 'dom/media/platforms/ffmpeg/ffvpx') diff --git a/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp b/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp index dfc8244f1d..c0a6e01f98 100644 --- a/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp +++ b/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp @@ -7,14 +7,10 @@ #include "FFVPXRuntimeLinker.h" #include "FFmpegLibWrapper.h" #include "FFmpegLog.h" -#include "BinaryPath.h" #include "mozilla/FileUtils.h" #include "nsLocalFile.h" -#include "prmem.h" +#include "nsXPCOMPrivate.h" #include "prlink.h" -#ifdef XP_WIN -# include -#endif namespace mozilla { @@ -84,29 +80,37 @@ bool FFVPXRuntimeLinker::Init() { sFFVPXLib.LinkVAAPILibs(); #endif - nsCOMPtr libFile; - if (NS_FAILED(mozilla::BinaryPath::GetFile(getter_AddRefs(libFile)))) { +#ifdef XP_WIN + PathString path = + GetLibraryFilePathname(LXUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init); +#else + PathString path = + GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init); +#endif + if (path.IsEmpty()) { + return false; + } + nsCOMPtr libFile = new nsLocalFile(path); + if (libFile->NativePath().IsEmpty()) { return false; } -#ifdef XP_DARWIN - if (!XRE_IsParentProcess() && - (XRE_GetChildProcBinPathType(XRE_GetProcessType()) == - BinPathType::PluginContainer)) { - // On macOS, PluginContainer processes have their binary in a - // plugin-container.app/Content/MacOS/ directory. - nsCOMPtr parentDir1, parentDir2; - if (NS_FAILED(libFile->GetParent(getter_AddRefs(parentDir1)))) { - return false; - } - if (NS_FAILED(parentDir1->GetParent(getter_AddRefs(parentDir2)))) { - return false; - } - if (NS_FAILED(parentDir2->GetParent(getter_AddRefs(libFile)))) { + if (getenv("MOZ_RUN_GTEST") +#ifdef FUZZING + || getenv("FUZZER") +#endif + ) { + // The condition above is the same as in + // xpcom/glue/standalone/nsXPCOMGlue.cpp. This means we can't reach here + // without the gtest libxul being loaded. In turn, that means the path to + // libxul leads to a subdirectory of where the libmozav* libraries are, so + // we get the parent. + nsCOMPtr parent; + if (NS_FAILED(libFile->GetParent(getter_AddRefs(parent)))) { return false; } + libFile = parent; } -#endif if (NS_FAILED(libFile->SetNativeLeafName(MOZ_DLL_PREFIX "mozavutil" MOZ_DLL_SUFFIX ""_ns))) { diff --git a/dom/media/platforms/ffmpeg/ffvpx/moz.build b/dom/media/platforms/ffmpeg/ffvpx/moz.build index bc72b6d1a7..a9236b25eb 100644 --- a/dom/media/platforms/ffmpeg/ffvpx/moz.build +++ b/dom/media/platforms/ffmpeg/ffvpx/moz.build @@ -25,7 +25,7 @@ SOURCES += [ ] LOCAL_INCLUDES += [ "..", - "../ffmpeg60/include", + "../ffmpeg61/include", "/media/mozva", ] -- cgit v1.2.3