Przeglądaj źródła

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 lat temu
rodzic
commit
18c1f10488
1 zmienionych plików z 4 dodań i 1 usunięć
  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)
 static inline uint64_t get_clockfreq(void)
 {
 {
-	if (!have_clockfreq)
+	if (!have_clockfreq) {
 		QueryPerformanceFrequency(&clock_freq);
 		QueryPerformanceFrequency(&clock_freq);
+		have_clockfreq = true;
+	}
+
 	return clock_freq.QuadPart;
 	return clock_freq.QuadPart;
 }
 }