ao_wasapi: move pre-resume reset into resume function

This commit is contained in:
Kevin Mitchell 2016-02-26 10:36:40 -08:00
parent 1841cac9f8
commit af90616ebe
1 changed files with 14 additions and 16 deletions

View File

@ -147,21 +147,6 @@ exit_label:
return false; 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) static void thread_reset(struct ao *ao)
{ {
struct wasapi_state *state = ao->priv; struct wasapi_state *state = ao->priv;
@ -178,6 +163,20 @@ static void thread_reset(struct ao *ao)
atomic_store(&state->sample_count, 0); 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) static void thread_wakeup(void *ptr)
{ {
struct ao *ao = ptr; struct ao *ao = ptr;
@ -222,7 +221,6 @@ static DWORD __stdcall AudioThread(void *lpParameter)
thread_reset(ao); thread_reset(ao);
break; break;
case WASAPI_THREAD_RESUME: case WASAPI_THREAD_RESUME:
thread_reset(ao);
thread_resume(ao); thread_resume(ao);
break; break;
case WASAPI_THREAD_SHUTDOWN: case WASAPI_THREAD_SHUTDOWN: