mirror of https://github.com/mpv-player/mpv
ao_wasapi: move pre-resume reset into resume function
This commit is contained in:
parent
1841cac9f8
commit
af90616ebe
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue