summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2016-02-26 10:36:40 -0800
committerKevin Mitchell <kevmitch@gmail.com>2016-02-26 15:43:51 -0800
commitaf90616ebe973f3ed06cc1c502b23891e76e747a (patch)
treea20cd116d842cddd135974f5aa561e5d962dd778 /audio
parent1841cac9f83c8f3a0ba589587e3b111ccdae09a1 (diff)
downloadmpv-af90616ebe973f3ed06cc1c502b23891e76e747a.tar.bz2
mpv-af90616ebe973f3ed06cc1c502b23891e76e747a.tar.xz
ao_wasapi: move pre-resume reset into resume function
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi.c30
1 files changed, 14 insertions, 16 deletions
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: