|
|
|
|
@ -6,6 +6,10 @@
|
|
|
|
|
#include <atomic> |
|
|
|
|
#include <thread> |
|
|
|
|
#include <vector> |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
#include "platform_compat.h" |
|
|
|
|
#include <objbase.h> |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
struct AudioCapture::Session { |
|
|
|
|
struct Slot { |
|
|
|
|
@ -156,7 +160,14 @@ void AudioCapture::closeAsync() {
|
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_CALL, "capture: asynchronous close started shared=%d", session.use_count() > 1); |
|
|
|
|
try { |
|
|
|
|
m_closeThread = std::thread([this, session = std::move(session)]() mutable { |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
HRESULT com = CoInitializeEx(nullptr, COINIT_MULTITHREADED); |
|
|
|
|
if (FAILED(com)) DEBUG_ERROR(DEBUG_CATEGORY_CALL, "capture: close worker COM init failed HRESULT=0x%08lx", (unsigned long)com); |
|
|
|
|
#endif |
|
|
|
|
session.reset(); |
|
|
|
|
#ifdef _WIN32 |
|
|
|
|
if (SUCCEEDED(com)) CoUninitialize(); |
|
|
|
|
#endif |
|
|
|
|
DEBUG_INFO(DEBUG_CATEGORY_CALL, "capture: asynchronous close completed"); |
|
|
|
|
m_closeDone.store(true, std::memory_order_release); |
|
|
|
|
}); |
|
|
|
|
|