welp, 100ns timing turned out to be a really bad idea
This commit is contained in:
parent
56761c988d
commit
8c1b200f43
@ -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)
|
||||
{
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user