From d22d24a6d53abdeac32e13317a78c0b905769185 Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Mon, 4 Jan 2016 17:43:22 -0800 Subject: ao_wasapi: move device selection to main thread In attempt to simplify the audio event thread, this can now be moved out. --- audio/out/ao_wasapi.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'audio/out/ao_wasapi.c') diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 37f6d3b4de..9f8a3fedd7 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -273,7 +273,7 @@ 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)); - + talloc_free(state->deviceID); CoUninitialize(); MP_DBG(ao, "Uninit wasapi done\n"); } @@ -286,6 +286,11 @@ static int init(struct ao *ao) struct wasapi_state *state = ao->priv; state->log = ao->log; + if (!find_device(ao)) { + uninit(ao); + return -1; + } + state->hInitDone = CreateEventW(NULL, FALSE, FALSE, NULL); state->hWake = CreateEventW(NULL, FALSE, FALSE, NULL); if (!state->hInitDone || !state->hWake) { -- cgit v1.2.3