自动调整远程桌面传屏速率
This commit is contained in:
@@ -53,6 +53,8 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
|
||||
const int fps = 8;// ֡<><D6A1>
|
||||
#endif
|
||||
const int sleep = 1000 / fps;// <20><><EFBFBD><EFBFBD>ʱ<EFBFBD>䣨ms<6D><73>
|
||||
int c1 = 0, c2 = 0, s0 = sleep;
|
||||
const int frames = fps; // ÿ<><C3BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD>ٶ<EFBFBD>
|
||||
timeBeginPeriod(1);
|
||||
while (This->m_bIsWorking)
|
||||
{
|
||||
@@ -60,10 +62,28 @@ DWORD WINAPI CScreenManager::WorkThreadProc(LPVOID lParam)
|
||||
const char* szBuffer = This->GetNextScreen(ulNextSendLength);
|
||||
if (szBuffer)
|
||||
{
|
||||
int span = sleep-(clock() - last);
|
||||
int span = s0-(clock() - last);
|
||||
Sleep(span > 0 ? span : 1);
|
||||
if (span < 0)
|
||||
printf("SendScreen Span = %d ms\n", span);
|
||||
{
|
||||
c2 = 0;
|
||||
if (frames == ++c1) {
|
||||
s0 = (s0 <= sleep*4) ? s0*2 : s0;
|
||||
c1 = 0;
|
||||
#ifdef _DEBUG
|
||||
printf("[+]SendScreen Span= %dms, s0= %d\n", span, s0);
|
||||
#endif
|
||||
}
|
||||
} else {
|
||||
c1 = 0;
|
||||
if (frames == ++c2) {
|
||||
s0 = (s0 >= sleep/4) ? s0/2 : s0;
|
||||
c2 = 0;
|
||||
#ifdef _DEBUG
|
||||
printf("[-]SendScreen Span= %dms, s0= %d\n", span, s0);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
last = clock();
|
||||
This->SendNextScreen(szBuffer, ulNextSendLength);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user