1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-28 11:20:56 +00:00

ao_wasapi: initialize COM in main thread with MTA

Since the main thread is shared by other things in the player, using STA (single
threaded aparement) may have caused problems. Instead initialize in MTA
(multithreaded apartment).
This commit is contained in:
Kevin Mitchell 2016-05-31 21:39:23 -07:00
parent c1cb04b6a3
commit b3e74f652b

View File

@ -270,7 +270,7 @@ static void uninit(struct ao *ao)
static int init(struct ao *ao)
{
MP_DBG(ao, "Init wasapi\n");
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
struct wasapi_state *state = ao->priv;
state->log = ao->log;
@ -469,7 +469,7 @@ static int hotplug_init(struct ao *ao)
MP_DBG(ao, "Hotplug init\n");
struct wasapi_state *state = ao->priv;
state->log = ao->log;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
CoInitializeEx(NULL, COINIT_MULTITHREADED);
HRESULT hr = wasapi_change_init(ao, true);
EXIT_ON_ERROR(hr);