From 642f84f9227607f0c64bf35ec5896cb80804f64f Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Sat, 28 Mar 2015 17:12:48 -0700 Subject: ao/wasapi: use atomic state variable instead of different events Unfortunately, because we have proxy objects (pAudioVolumeProxy, pEndpointVolumeProxy, pSessionControlProxy) it looks like we still have to use MsgWaitForMultipleObjects and watch for and dispatch pending messages: https://msdn.microsoft.com/en-us/library/windows/desktop/ms680112%28v=vs.85%29.aspx --- audio/out/ao_wasapi_utils.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'audio/out/ao_wasapi_utils.c') diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index dfe76918f9..b0b0c10575 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -697,7 +697,7 @@ reinit: EXIT_ON_ERROR(hr); MP_DBG(state, "IAudioClient::Initialize IAudioClient_SetEventHandle\n"); - hr = IAudioClient_SetEventHandle(state->pAudioClient, state->hFeed); + hr = IAudioClient_SetEventHandle(state->pAudioClient, state->hWake); EXIT_ON_ERROR(hr); MP_DBG(state, "IAudioClient::Initialize IAudioClient_GetBufferSize\n"); @@ -1054,8 +1054,9 @@ static void destroy_proxies(struct wasapi_state *state) { SAFE_RELEASE(state->sSessionControl, IUnknown_Release(state->sSessionControl)); } -void wasapi_dispatch(void) +void wasapi_dispatch(struct ao *ao) { + MP_DBG(ao, "Dispatch\n"); /* dispatch any possible pending messages */ MSG msg; while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) @@ -1154,8 +1155,8 @@ exit_label: void wasapi_thread_uninit(struct ao *ao) { struct wasapi_state *state = ao->priv; - - wasapi_dispatch(); + MP_DBG(ao, "Thread shutdown\n"); + wasapi_dispatch(ao); if (state->pAudioClient) IAudioClient_Stop(state->pAudioClient); -- cgit v1.2.3