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: