diff options
author | Kevin Mitchell <kevmitch@gmail.com> | 2014-11-28 10:43:48 -0800 |
---|---|---|
committer | Diogo Franco (Kovensky) <diogomfranco@gmail.com> | 2015-01-25 17:00:11 +0900 |
commit | 01401b5f5b4a255e7a071ae720dd8ebdba620805 (patch) | |
tree | f61c60358a72351987c185689ad4e8ffc85e717b /audio/out/ao_wasapi_utils.c | |
parent | f794eca25531fb0743c28bb262dbc9c63b850837 (diff) | |
download | mpv-01401b5f5b4a255e7a071ae720dd8ebdba620805.tar.bz2 mpv-01401b5f5b4a255e7a071ae720dd8ebdba620805.tar.xz |
ao/wasapi: handle VistaBlob failure more gracefully
Diffstat (limited to 'audio/out/ao_wasapi_utils.c')
-rwxr-xr-x | audio/out/ao_wasapi_utils.c | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c index 8a57c8660b..10b435dbe8 100755 --- a/audio/out/ao_wasapi_utils.c +++ b/audio/out/ao_wasapi_utils.c @@ -100,16 +100,25 @@ bool wasapi_fill_VistaBlob(wasapi_state *state) state->VistaBlob.hAvrt = LoadLibraryW(L"avrt.dll"); if (!state->VistaBlob.hAvrt) goto exit_label; + state->VistaBlob.pAvSetMmThreadCharacteristicsW = (HANDLE (WINAPI *)(LPCWSTR, LPDWORD)) - GetProcAddress(state->VistaBlob.hAvrt, "AvSetMmThreadCharacteristicsW"); + GetProcAddress(state->VistaBlob.hAvrt, "AvSetMmThreadCharacteristicsW"); + if (!state->VistaBlob.pAvSetMmThreadCharacteristicsW) + goto exit_label; + state->VistaBlob.pAvRevertMmThreadCharacteristics = (WINBOOL (WINAPI *)(HANDLE)) - GetProcAddress(state->VistaBlob.hAvrt, "AvRevertMmThreadCharacteristics"); + GetProcAddress(state->VistaBlob.hAvrt, "AvRevertMmThreadCharacteristics"); + if (!state->VistaBlob.pAvRevertMmThreadCharacteristics) + goto exit_label; + return true; exit_label: - if (state->VistaBlob.hAvrt) + if (state->VistaBlob.hAvrt) { FreeLibrary(state->VistaBlob.hAvrt); + state->VistaBlob.hAvrt = NULL; + } return false; } @@ -581,8 +590,11 @@ reinit: hr = init_session_display(state); EXIT_ON_ERROR(hr); - state->hTask = - state->VistaBlob.pAvSetMmThreadCharacteristicsW(L"Pro Audio", &state->taskIndex); + if (state->VistaBlob.hAvrt) { + state->hTask = + state->VistaBlob.pAvSetMmThreadCharacteristicsW(L"Pro Audio", &state->taskIndex); + } + MP_VERBOSE(state, "Format fixed. Using %lld byte buffer block size\n", (long long) state->buffer_block_size); |