summaryrefslogtreecommitdiffstats
path: root/osdep/threads-win32.h
diff options
context:
space:
mode:
authornanahi <130121847+na-na-hi@users.noreply.github.com>2023-10-26 15:13:12 -0400
committerKacper Michajłow <kasper93@gmail.com>2024-03-19 20:23:25 +0100
commitaff376e066359afbb78fca1c53355104281d9712 (patch)
treec95950a0a4dcb325c424c95c0712fdfb64a4297d /osdep/threads-win32.h
parentbfd016d1013ad6cac9a190ec109e814744055d8c (diff)
downloadmpv-aff376e066359afbb78fca1c53355104281d9712.tar.bz2
mpv-aff376e066359afbb78fca1c53355104281d9712.tar.xz
win32: increase hires timer resolution
timeBeginPeriod() only allows setting minimum timer resolution to 1 ms. However, modern x86 platforms support a minimum timer resolution of 0.5 ms. Use NtSetTimerResolution() instead for the increased resolution, which can be set with MPV_HRT_RES. Additionally, change the units of mp_start_hires_timers(), mp_end_hires_timer(), MPV_HRT_RES, and MPV_HRT_MAX to nanoseconds, in accordance with other functions used in timer.h.
Diffstat (limited to 'osdep/threads-win32.h')
-rw-r--r--osdep/threads-win32.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/osdep/threads-win32.h b/osdep/threads-win32.h
index f1c654a5cb..ec90fe9387 100644
--- a/osdep/threads-win32.h
+++ b/osdep/threads-win32.h
@@ -115,7 +115,7 @@ static inline int mp_cond_timedwait(mp_cond *cond, mp_mutex *mutex, int64_t time
timeout = MPCLAMP(timeout, 0, MP_TIME_MS_TO_NS(INFINITE)) / MP_TIME_MS_TO_NS(1);
int ret = 0;
- int hrt = mp_start_hires_timers(timeout);
+ int64_t hrt = mp_start_hires_timers(MP_TIME_MS_TO_NS(timeout));
BOOL bRet;
if (mutex->use_cs) {