Bug 1254858: P9. Search libmozav* lib relative to lgpllibs. r=glandium
XUL location can't be used as reference as its location varies.
MozReview-Commit-ID: EKGVpjeepIR
--- a/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
+++ b/dom/media/platforms/ffmpeg/ffvpx/FFVPXRuntimeLinker.cpp
@@ -3,20 +3,23 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "FFVPXRuntimeLinker.h"
#include "FFmpegLibWrapper.h"
#include "FFmpegLog.h"
#include "nsIFile.h"
-#include "nsXPCOMPrivate.h" // for XUL_DLL
#include "prmem.h"
#include "prlink.h"
+// We use a known symbol located in lgpllibs to determine its location.
+// soundtouch happens to be always included in lgpllibs
+#include "soundtouch/SoundTouch.h"
+
namespace mozilla
{
template <int V> class FFmpegDecoderModule
{
public:
static already_AddRefed<PlatformDecoderModule> Create(FFmpegLibWrapper*);
};
@@ -44,20 +47,26 @@ FFVPXRuntimeLinker::Init()
{
if (sLinkStatus) {
return sLinkStatus == LinkStatus_SUCCEEDED;
}
MOZ_ASSERT(NS_IsMainThread());
sLinkStatus = LinkStatus_FAILED;
- // We retrieve the path of the XUL library as this is where mozavcodec and
- // mozavutil libs are located.
+ // We retrieve the path of the lgpllibs library as this is where mozavcodec
+ // and mozavutil libs are located.
+ char* lgpllibsname = PR_GetLibraryName(nullptr, "lgpllibs");
+ if (!lgpllibsname) {
+ return false;
+ }
char* path =
- PR_GetLibraryFilePathname(XUL_DLL, (PRFuncPtr)&FFVPXRuntimeLinker::Init);
+ PR_GetLibraryFilePathname(lgpllibsname,
+ (PRFuncPtr)&soundtouch::SoundTouch::getVersionId);
+ PR_FreeLibraryName(lgpllibsname);
if (!path) {
return false;
}
nsCOMPtr<nsIFile> xulFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID);
if (!xulFile ||
NS_FAILED(xulFile->InitWithNativePath(nsDependentCString(path)))) {
PR_Free(path);
return false;