mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 09:54:42 +00:00
Bug 1901554 p1: Call CoTaskMemFree directly from combase.dll for MFTEncoder. r=padenot
This prevents us from having to preload ole32.dll and all of its associated dependencies. Differential Revision: https://phabricator.services.mozilla.com/D213256
This commit is contained in:
parent
59b0794780
commit
caa2cde4ba
@ -8,6 +8,7 @@
|
||||
#include "mozilla/Logging.h"
|
||||
#include "mozilla/WindowsProcessMitigations.h"
|
||||
#include "mozilla/StaticPrefs_media.h"
|
||||
#include "mozilla/mscom/COMWrappers.h"
|
||||
#include "mozilla/mscom/Utils.h"
|
||||
#include "WMFUtils.h"
|
||||
#include <comdef.h>
|
||||
@ -166,7 +167,7 @@ static void PopulateEncoderInfo(const GUID& aSubtype,
|
||||
activates[i]->Release();
|
||||
activates[i] = nullptr;
|
||||
}
|
||||
CoTaskMemFree(activates);
|
||||
mscom::wrapped::CoTaskMemFree(activates);
|
||||
}
|
||||
|
||||
Maybe<MFTEncoder::Info> MFTEncoder::GetInfo(const GUID& aSubtype) {
|
||||
@ -221,7 +222,7 @@ already_AddRefed<IMFActivate> MFTEncoder::CreateFactory(const GUID& aSubtype) {
|
||||
activates[i]->Release();
|
||||
activates[i] = nullptr;
|
||||
}
|
||||
CoTaskMemFree(activates);
|
||||
mscom::wrapped::CoTaskMemFree(activates);
|
||||
|
||||
return factory.forget();
|
||||
}
|
||||
|
@ -98,4 +98,14 @@ HRESULT CoCreateGuid(GUID* pguid) {
|
||||
return pCoCreateGuid(pguid);
|
||||
}
|
||||
|
||||
void CoTaskMemFree(LPVOID pv) {
|
||||
static const StaticDynamicallyLinkedFunctionPtr<decltype(&::CoTaskMemFree)>
|
||||
pCoTaskMemFree(L"combase.dll", "CoTaskMemFree");
|
||||
if (!pCoTaskMemFree) {
|
||||
return ::CoTaskMemFree(pv);
|
||||
}
|
||||
|
||||
return pCoTaskMemFree(pv);
|
||||
}
|
||||
|
||||
} // namespace mozilla::mscom::wrapped
|
||||
|
@ -33,6 +33,8 @@ HRESULT CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
|
||||
|
||||
HRESULT CoCreateGuid(GUID* pguid);
|
||||
|
||||
void CoTaskMemFree(LPVOID pv);
|
||||
|
||||
} // namespace mozilla::mscom::wrapped
|
||||
|
||||
#endif // mozilla_mscom_COMWrappers_h
|
||||
|
Loading…
Reference in New Issue
Block a user