summaryrefslogtreecommitdiffstats
path: root/audio/out/ao_wasapi_utils.c
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2023-10-11 11:34:14 -0500
committerDudemanguy <random342@airmail.cc>2023-10-16 15:38:59 +0000
commitde9b800879706734721810427248e75ea5bdc0f9 (patch)
treef2cc425e6050d215b239372e2dba88167aaf7d5e /audio/out/ao_wasapi_utils.c
parent9d3e607cf749b7be057ba8f30ffd3d55c695a70b (diff)
downloadmpv-de9b800879706734721810427248e75ea5bdc0f9.tar.bz2
mpv-de9b800879706734721810427248e75ea5bdc0f9.tar.xz
timer: add convenience time unit conversion macros
There's a lot of wild 1e6, 1000, etc. lying around in the code. A macro is much easier to read and understand at a glance. Add some helpers for this. We don't need to convert everything now but there's some simple things that can be done so they are included in this commit.
Diffstat (limited to 'audio/out/ao_wasapi_utils.c')
-rw-r--r--audio/out/ao_wasapi_utils.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/audio/out/ao_wasapi_utils.c b/audio/out/ao_wasapi_utils.c
index 6c5bfb3ab1..e26e591ba8 100644
--- a/audio/out/ao_wasapi_utils.c
+++ b/audio/out/ao_wasapi_utils.c
@@ -945,7 +945,7 @@ bool wasapi_thread_init(struct ao *ao)
{
struct wasapi_state *state = ao->priv;
MP_DBG(ao, "Init wasapi thread\n");
- int64_t retry_wait = 1000;
+ int64_t retry_wait = MP_TIME_US_TO_NS(1);
bool align_hack = false;
HRESULT hr;
@@ -1028,12 +1028,12 @@ retry:
goto retry;
case AUDCLNT_E_DEVICE_IN_USE:
case AUDCLNT_E_DEVICE_INVALIDATED:
- if (retry_wait > 8000) {
+ if (retry_wait > MP_TIME_US_TO_NS(8)) {
MP_FATAL(ao, "Bad device retry failed\n");
return false;
}
wasapi_thread_uninit(ao);
- MP_WARN(ao, "Retrying in %"PRId64" us\n", retry_wait);
+ MP_WARN(ao, "Retrying in %"PRId64" ns\n", retry_wait);
mp_sleep_ns(retry_wait);
retry_wait *= 2;
goto retry;