summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi.c6
-rw-r--r--audio/out/ao_wasapi_utils.c3
2 files changed, 6 insertions, 3 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c
index e6f1c32662..2a4834d1b1 100644
--- a/audio/out/ao_wasapi.c
+++ b/audio/out/ao_wasapi.c
@@ -273,7 +273,11 @@ static void uninit(struct ao *ao)
SAFE_RELEASE(state->hInitDone, CloseHandle(state->hInitDone));
SAFE_RELEASE(state->hWake, CloseHandle(state->hWake));
SAFE_RELEASE(state->hAudioThread,CloseHandle(state->hAudioThread));
+
+ wasapi_change_uninit(ao);
+
talloc_free(state->deviceID);
+
CoUninitialize();
MP_DBG(ao, "Uninit wasapi done\n");
}
@@ -292,6 +296,8 @@ static int init(struct ao *ao)
return -1;
}
+ wasapi_change_init(ao, false);
+
state->hInitDone = CreateEventW(NULL, FALSE, FALSE, NULL);
state->hWake = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!state->hInitDone || !state->hWake) {
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 92ca547a4d..15eb8beccf 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -1123,8 +1123,6 @@ retry: ;
MP_DBG(ao, "Creating proxies\n");
create_proxy_streams(state);
- wasapi_change_init(ao, false);
-
MP_DBG(ao, "Init wasapi thread done\n");
return S_OK;
exit_label:
@@ -1141,7 +1139,6 @@ void wasapi_thread_uninit(struct ao *ao)
if (state->pAudioClient)
IAudioClient_Stop(state->pAudioClient);
- wasapi_change_uninit(ao);
destroy_proxy_streams(state);
SAFE_RELEASE(state->pRenderClient, IAudioRenderClient_Release(state->pRenderClient));