diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2017-07-12 23:37:45 -0700 |
---|---|---|
committer | Kevin Mitchell <kevmitch@gmail.com> | 2017-08-07 14:33:03 -0700 |
commit | bee602da8287ba1ccf80a44f7c826429927bfc54 (patch) | |
tree | 64fddfd0ac6289a4103d950ce7cfb5280febce71 /audio/out/ao_wasapi.c | |
parent | 61c8a147b5fef7337ba4e68673d521d5479e49e5 (diff) | |
download | mpv-bee602da8287ba1ccf80a44f7c826429927bfc54.tar.bz2 mpv-bee602da8287ba1ccf80a44f7c826429927bfc54.tar.xz |
ao_wasapi: return bool instead of HRESULT from thread_init
Any bad HRESULTs should have been printed already and lots of failure modes
don't have an HRESULT leading to awkward hr = E_FAIL business.
This also checks the exit status of GetBufferSize in the align hack. A final
fatal message is added if either of the retry hacks fail.
Diffstat (limited to 'audio/out/ao_wasapi.c')
-rw-r--r-- | audio/out/ao_wasapi.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/out/ao_wasapi.c b/audio/out/ao_wasapi.c index dbca270e00..e432266a09 100644 --- a/audio/out/ao_wasapi.c +++ b/audio/out/ao_wasapi.c @@ -201,9 +201,9 @@ static DWORD __stdcall AudioThread(void *lpParameter) mpthread_set_name("wasapi event"); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); - state->init_ret = wasapi_thread_init(ao); + state->init_ok = wasapi_thread_init(ao); SetEvent(state->hInitDone); - if (FAILED(state->init_ret)) + if (!state->init_ok) goto exit_label; MP_DBG(ao, "Entering dispatch loop\n"); @@ -302,7 +302,7 @@ static int init(struct ao *ao) state->dispatch = mp_dispatch_create(state); mp_dispatch_set_wakeup_fn(state->dispatch, thread_wakeup, ao); - state->init_ret = E_FAIL; + state->init_ok = false; state->hAudioThread = CreateThread(NULL, 0, &AudioThread, ao, 0, NULL); if (!state->hAudioThread) { MP_FATAL(ao, "Failed to create audio thread\n"); @@ -312,7 +312,7 @@ static int init(struct ao *ao) WaitForSingleObject(state->hInitDone, INFINITE); // wait on init complete SAFE_DESTROY(state->hInitDone,CloseHandle(state->hInitDone)); - if (FAILED(state->init_ret)) { + if (!state->init_ok) { if (!ao->probing) MP_FATAL(ao, "Received failure from audio thread\n"); uninit(ao); |