浏览代码

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
JetMeta 7 年之前
父节点
当前提交
18c1f10488
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      libobs/util/platform-windows.c

+ 4 - 1
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;
 }