From 18c1f10488dd56abe0a2d11e215c2c90d2c9ee48 Mon Sep 17 00:00:00 2001 From: JetMeta <126.org@gmail.com> Date: Tue, 6 Feb 2018 22:50:28 +0800 Subject: [PATCH] libobs/util: Cache windows CPU frequency Caches the frequency of the performance counter. It was supposed to be caching it already, but it seems that code was unintentionally not included. Closes jp9000/obs-studio#1185 --- libobs/util/platform-windows.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libobs/util/platform-windows.c b/libobs/util/platform-windows.c index 5435b680c..d0c146429 100644 --- a/libobs/util/platform-windows.c +++ b/libobs/util/platform-windows.c @@ -37,8 +37,11 @@ static uint32_t winver = 0; static inline uint64_t get_clockfreq(void) { - if (!have_clockfreq) + if (!have_clockfreq) { QueryPerformanceFrequency(&clock_freq); + have_clockfreq = true; + } + return clock_freq.QuadPart; }