diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:35:29 +0000 |
commit | 59203c63bb777a3bacec32fb8830fba33540e809 (patch) | |
tree | 58298e711c0ff0575818c30485b44a2f21bf28a0 /dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp | |
parent | Adding upstream version 126.0.1. (diff) | |
download | firefox-59203c63bb777a3bacec32fb8830fba33540e809.tar.xz firefox-59203c63bb777a3bacec32fb8830fba33540e809.zip |
Adding upstream version 127.0.upstream/127.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp')
-rw-r--r-- | dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp | 48 |
1 files changed, 26 insertions, 22 deletions
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 <windows.h> -#endif namespace mozilla { @@ -84,29 +80,37 @@ bool FFVPXRuntimeLinker::Init() { sFFVPXLib.LinkVAAPILibs(); #endif - nsCOMPtr<nsIFile> 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<nsIFile> 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<nsIFile> 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<nsIFile> 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))) { |