自动调整远程桌面传屏速率
This commit is contained in:
@@ -210,3 +210,6 @@ TestRun在写入开机自启动项时先提升权限,以防止因权限不足
|
||||
|
||||
2019.5.8
|
||||
优化左键点击Yama托盘图标的效果。
|
||||
|
||||
2019.5.11
|
||||
优化远程桌面发送屏幕的功能,可动态调整发送屏幕的速率。
|
||||
|
||||
@@ -60,7 +60,7 @@ int main(int argc, const char *argv[])
|
||||
SetConsoleCtrlHandler(&callback, TRUE);
|
||||
const char *szServerIP = argv[1];
|
||||
int uPort = atoi(argv[2]);
|
||||
printf("[remote] %s:%d\n", szServerIP, uPort);
|
||||
printf("[server] %s:%d\n", szServerIP, uPort);
|
||||
|
||||
memcpy(g_szServerIP,szServerIP,strlen(szServerIP));
|
||||
g_uPort = uPort;
|
||||
|
||||
@@ -285,7 +285,7 @@ VOID IOCPClient::OnServerReceiving(char* szBuffer, ULONG ulLength)
|
||||
|
||||
BOOL IOCPClient::OnServerSending(const char* szBuffer, ULONG ulOriginalLength) //Hello
|
||||
{
|
||||
AUTO_TICK(10);
|
||||
AUTO_TICK(50);
|
||||
assert (ulOriginalLength > 0);
|
||||
{
|
||||
//<2F><><EFBFBD><EFBFBD>1.001<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD>õ<EFBFBD><EFBFBD>ڴ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD> +12
|
||||
|
||||
@@ -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