From af90616ebe973f3ed06cc1c502b23891e76e747a Mon Sep 17 00:00:00 2001 From: Kevin Mitchell Date: Fri, 26 Feb 2016 10:36:40 -0800 Subject: ao_wasapi: move pre-resume reset into resume function --- audio/out/ao_wasapi.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) (limited to 'audio') diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index 7d74cf2e2d..f472c7eeb6 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -147,21 +147,6 @@ exit_label: return false; } -static void thread_resume(struct ao *ao) -{ - struct wasapi_state *state = ao->priv; - HRESULT hr; - - MP_DBG(state, "Thread Resume\n"); - thread_feed(ao); - - hr = IAudioClient_Start(state->pAudioClient); - if (FAILED(hr)) { - MP_ERR(state, "IAudioClient_Start returned %s\n", - mp_HRESULT_to_str(hr)); - } -} - static void thread_reset(struct ao *ao) { struct wasapi_state *state = ao->priv; @@ -178,6 +163,20 @@ static void thread_reset(struct ao *ao) atomic_store(&state->sample_count, 0); } +static void thread_resume(struct ao *ao) +{ + struct wasapi_state *state = ao->priv; + MP_DBG(state, "Thread Resume\n"); + thread_reset(ao); + thread_feed(ao); + + HRESULT hr = IAudioClient_Start(state->pAudioClient); + if (FAILED(hr)) { + MP_ERR(state, "IAudioClient_Start returned %s\n", + mp_HRESULT_to_str(hr)); + } +} + static void thread_wakeup(void *ptr) { struct ao *ao = ptr; @@ -222,7 +221,6 @@ static DWORD __stdcall AudioThread(void *lpParameter) thread_reset(ao); break; case WASAPI_THREAD_RESUME: - thread_reset(ao); thread_resume(ao); break; case WASAPI_THREAD_SHUTDOWN: -- cgit v1.2.3