diff --git a/plugins/win-dshow/virtualcam-module/virtualcam-filter.cpp b/plugins/win-dshow/virtualcam-module/virtualcam-filter.cpp index 20bde29a9..634db5fd4 100644 --- a/plugins/win-dshow/virtualcam-module/virtualcam-filter.cpp +++ b/plugins/win-dshow/virtualcam-module/virtualcam-filter.cpp @@ -108,7 +108,7 @@ VCamFilter::VCamFilter() th = std::thread([this] { Thread(); }); AddRef(); - InterlockedIncrement(&locks); + os_atomic_inc_long(&locks); } VCamFilter::~VCamFilter() @@ -121,7 +121,7 @@ VCamFilter::~VCamFilter() if (placeholder.scaled_data) free(placeholder.scaled_data); - InterlockedDecrement(&locks); + os_atomic_dec_long(&locks); } const wchar_t *VCamFilter::FilterName() const diff --git a/plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp b/plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp index fd5cb1ddc..bf79d9bc6 100644 --- a/plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp +++ b/plugins/win-dshow/virtualcam-module/virtualcam-filter.hpp @@ -8,6 +8,7 @@ #include "../libdshowcapture/source/output-filter.hpp" #include "../libdshowcapture/source/dshow-formats.hpp" #include "../../../libobs/util/windows/WinHandle.hpp" +#include "../../../libobs/util/threading-windows.h" #define DEFAULT_CX 1920 #define DEFAULT_CY 1080 diff --git a/plugins/win-dshow/virtualcam-module/virtualcam-module.cpp b/plugins/win-dshow/virtualcam-module/virtualcam-module.cpp index cdc8e72c6..9b56b7b5c 100644 --- a/plugins/win-dshow/virtualcam-module/virtualcam-module.cpp +++ b/plugins/win-dshow/virtualcam-module/virtualcam-module.cpp @@ -51,12 +51,12 @@ STDMETHODIMP VCamFactory::QueryInterface(REFIID riid, void **p_ptr) STDMETHODIMP_(ULONG) VCamFactory::AddRef() { - return InterlockedIncrement(&refs); + return os_atomic_inc_long(&refs); } STDMETHODIMP_(ULONG) VCamFactory::Release() { - long new_refs = InterlockedDecrement(&refs); + long new_refs = os_atomic_dec_long(&refs); if (new_refs == 0) { delete this; return 0; @@ -89,9 +89,9 @@ STDMETHODIMP VCamFactory::CreateInstance(LPUNKNOWN parent, REFIID, void **p_ptr) STDMETHODIMP VCamFactory::LockServer(BOOL lock) { if (lock) { - InterlockedIncrement(&locks); + os_atomic_inc_long(&locks); } else { - InterlockedDecrement(&locks); + os_atomic_dec_long(&locks); } return S_OK; @@ -252,7 +252,7 @@ STDAPI DllInstall(BOOL install, LPCWSTR) STDAPI DllCanUnloadNow() { - return InterlockedOr(&locks, 0) == 0 ? S_OK : S_FALSE; + return os_atomic_load_long(&locks) ? S_OK : S_FALSE; } STDAPI DllGetClassObject(REFCLSID cls, REFIID riid, void **p_ptr)