summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2017-07-09 15:34:53 -0700
committerKevin Mitchell <kevmitch@gmail.com>2017-07-10 21:01:39 -0700
commit63b6aa3f57862b194fbecf22d865e1fda8325183 (patch)
tree6e8c77b38a14192714b76f59757e077324f88a64 /audio
parent4389ddcc349dca38309e7597274a6b7e4c8301e8 (diff)
downloadmpv-63b6aa3f57862b194fbecf22d865e1fda8325183.tar.bz2
mpv-63b6aa3f57862b194fbecf22d865e1fda8325183.tar.xz
ao_waspi: use switch for handling fix_format errors
Diffstat (limited to 'audio')
-rw-r--r--audio/out/ao_wasapi_utils.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index e00b763e8e..bf1a3697ee 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -995,7 +995,10 @@ retry:
MP_DBG(ao, "Fixing format\n");
hr = fix_format(ao, align_hack);
- if (hr == AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED && !align_hack) {
+ switch (hr) {
+ case AUDCLNT_E_BUFFER_SIZE_NOT_ALIGNED:
+ if (align_hack)
+ break;
// According to MSDN, we must use this as base after the failure.
IAudioClient_GetBufferSize(state->pAudioClient,
&state->bufferFrameCount);
@@ -1003,10 +1006,10 @@ retry:
align_hack = true;
MP_WARN(ao, "This appears to require a weird Windows 7 hack. Retrying.\n");
goto retry;
- }
- if ((hr == AUDCLNT_E_DEVICE_IN_USE || hr == AUDCLNT_E_DEVICE_INVALIDATED) &&
- retry_wait <= 8)
- {
+ case AUDCLNT_E_DEVICE_IN_USE:
+ case AUDCLNT_E_DEVICE_INVALIDATED:
+ if (retry_wait > 8)
+ break;
wasapi_thread_uninit(ao);
MP_WARN(ao, "Retrying in %"PRId64" us\n", retry_wait);
mp_sleep_us(retry_wait);