diff --git a/OBSApi/OBSApi.h b/OBSApi/OBSApi.h index 3f278c2b..3dadef12 100644 --- a/OBSApi/OBSApi.h +++ b/OBSApi/OBSApi.h @@ -98,6 +98,7 @@ inline BOOL CloseDouble(double f1, double f2, double precision=0.001) return fabs(f1-f2) <= precision; } +/* this actually can't work without a 128bit integer, so commenting out for now inline QWORD GetQPCTime100NS(LONGLONG clockFreq) { LARGE_INTEGER currentTime; @@ -108,7 +109,7 @@ inline QWORD GetQPCTime100NS(LONGLONG clockFreq) timeVal /= clockFreq; return timeVal; -} +}*/ inline QWORD GetQPCTimeMS(LONGLONG clockFreq) { diff --git a/Source/DesktopImageSource.cpp b/Source/DesktopImageSource.cpp index 47aa2828..0dfd3ae2 100644 --- a/Source/DesktopImageSource.cpp +++ b/Source/DesktopImageSource.cpp @@ -1439,7 +1439,7 @@ INT_PTR CALLBACK ConfigDesktopSourceProc(HWND hwnd, UINT message, WPARAM wParam, //-------------------------------------------- regionWindowData.hwndConfigDialog = hwnd; - HWND hwndRegion = CreateWindowEx(0, CAPTUREREGIONCLASS, NULL, WS_POPUP|WS_VISIBLE, posX, posY, sizeX, sizeY, hwnd, NULL, hinstMain, NULL); + HWND hwndRegion = CreateWindowEx(WS_EX_TOPMOST, CAPTUREREGIONCLASS, NULL, WS_POPUP|WS_VISIBLE, posX, posY, sizeX, sizeY, hwnd, NULL, hinstMain, NULL); //everyone better thank homeworld for this SetWindowLongW(hwndRegion, GWL_EXSTYLE, GetWindowLong(hwndRegion, GWL_EXSTYLE) | WS_EX_LAYERED); diff --git a/Source/OBSCapture.cpp b/Source/OBSCapture.cpp index b5664d4e..5c85581a 100644 --- a/Source/OBSCapture.cpp +++ b/Source/OBSCapture.cpp @@ -804,7 +804,7 @@ void OBS::MainAudioLoop() while(TRUE) { - Sleep(5); //screw it, just run it every 5ms + OSSleep(5); //screw it, just run it every 5ms if(!bRunning) break; diff --git a/Source/OBSVideoCapture.cpp b/Source/OBSVideoCapture.cpp index a7d8f030..e893cd69 100644 --- a/Source/OBSVideoCapture.cpp +++ b/Source/OBSVideoCapture.cpp @@ -200,6 +200,9 @@ bool OBS::ProcessFrame(FrameProcessInfo &frameInfo) } +//#define USE_100NS_TIME 1 + +#ifdef USE_100NS_TIME void STDCALL SleepTo(LONGLONG clockFreq, QWORD qw100NSTime) { QWORD t = GetQPCTime100NS(clockFreq); @@ -216,10 +219,9 @@ void STDCALL SleepTo(LONGLONG clockFreq, QWORD qw100NSTime) Sleep(0); } } +#endif -//#define USE_100NS_TIME 1 - //todo: this function is an abomination, this is just disgusting. fix it. //...seriously, this is really, really horrible. I mean this is amazingly bad. void OBS::MainCaptureLoop() @@ -269,14 +271,6 @@ void OBS::MainCaptureLoop() LARGE_INTEGER clockFreq; QueryPerformanceFrequency(&clockFreq); - /*LARGE_INTEGER currentTime; - QueryPerformanceCounter(¤tTime); - - QWORD timeVal = currentTime.QuadPart; - QWORD chi1 = timeVal * 1000 / clockFreq.QuadPart; - QWORD chi2 = timeVal * 10000000 / clockFreq.QuadPart; - Log(TEXT("qpc %llu, clockFreq: %llu, ms: %llu, 100ns: %llu"), timeVal, clockFreq.QuadPart, chi1, chi2);*/ - bufferedTimes.Clear(); #ifdef USE_100NS_TIME @@ -293,7 +287,7 @@ void OBS::MainCaptureLoop() curPTS = 0; lastAudioTimestamp = 0; - latestVideoTime = firstSceneTimestamp = GetQPCTime100NS(clockFreq.QuadPart)/10000; + latestVideoTime = firstSceneTimestamp = GetQPCTimeMS(clockFreq.QuadPart); DWORD fpsTimeNumerator = 1000-(frameTime*fps); DWORD fpsTimeDenominator = fps; @@ -422,7 +416,7 @@ void OBS::MainCaptureLoop() lastStreamTime = renderStartTime; #else - QWORD qwTime = GetQPCTime100NS(clockFreq.QuadPart)/10000; + QWORD qwTime = GetQPCTimeMS(clockFreq.QuadPart); latestVideoTime = qwTime; QWORD frameDelta = qwTime-lastStreamTime;