mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
wfreerdp-server: add registry key for framerate
This commit is contained in:
@@ -27,6 +27,7 @@
|
||||
#include <winpr/windows.h>
|
||||
|
||||
#include "wf_info.h"
|
||||
#include "wf_update.h"
|
||||
#include "wf_mirage.h"
|
||||
|
||||
static wfInfo* wfInfoInstance = NULL;
|
||||
@@ -103,6 +104,12 @@ wfInfo* wf_info_init()
|
||||
|
||||
if (wfi != NULL)
|
||||
{
|
||||
HKEY hKey;
|
||||
LONG status;
|
||||
DWORD dwType;
|
||||
DWORD dwSize;
|
||||
DWORD dwValue;
|
||||
|
||||
wfi->mutex = CreateMutex(NULL, FALSE, NULL);
|
||||
|
||||
if (wfi->mutex == NULL)
|
||||
@@ -112,7 +119,27 @@ wfInfo* wf_info_init()
|
||||
|
||||
wfi->updateEvent = CreateEvent(0, 1, 0, 0);
|
||||
|
||||
wfi->updateThread = CreateThread(NULL, 0, wf_update_thread, wfi, CREATE_SUSPENDED, NULL);
|
||||
|
||||
if (!wfi->updateThread)
|
||||
{
|
||||
_tprintf(_T("Failed to create update thread\n"));
|
||||
}
|
||||
|
||||
wfi->peers = (wfPeerContext**) malloc(sizeof(wfPeerContext*) * 32);
|
||||
|
||||
wfi->framesPerSecond = 24;
|
||||
|
||||
status = RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\FreeRDP\\Server"), 0, KEY_READ | KEY_WOW64_64KEY, &hKey);
|
||||
|
||||
if (status == ERROR_SUCCESS)
|
||||
{
|
||||
if (RegQueryValueEx(hKey, _T("FramesPerSecond"), NULL, &dwType, (BYTE*) &dwValue, &dwSize) == ERROR_SUCCESS)
|
||||
wfi->framesPerSecond = dwValue;
|
||||
|
||||
}
|
||||
|
||||
RegCloseKey(hKey);
|
||||
}
|
||||
|
||||
return wfi;
|
||||
|
||||
@@ -36,6 +36,7 @@ struct wf_info
|
||||
int peerCount;
|
||||
BOOL activated;
|
||||
void* changeBuffer;
|
||||
int framesPerSecond;
|
||||
LPTSTR deviceKey;
|
||||
TCHAR deviceName[32];
|
||||
wfPeerContext** peers;
|
||||
@@ -66,4 +67,4 @@ void wf_info_find_invalid_region(wfInfo* wfi);
|
||||
void wf_info_clear_invalid_region(wfInfo* wfi);
|
||||
BOOL wf_info_have_invalid_region(wfInfo* wfi);
|
||||
|
||||
#endif
|
||||
#endif /* WF_INFO_H */
|
||||
|
||||
@@ -46,24 +46,6 @@ void wf_peer_context_free(freerdp_peer* client, wfPeerContext* context)
|
||||
wf_info_peer_unregister(context->info, context);
|
||||
}
|
||||
|
||||
void wf_peer_start_encoder_thread(freerdp_peer* client)
|
||||
{
|
||||
wfInfo* wfi;
|
||||
|
||||
wfi = ((wfPeerContext*) client->context)->info;
|
||||
|
||||
wf_info_lock(wfi);
|
||||
|
||||
wfi->updateThread = CreateThread(NULL, 0, wf_update_thread, wfi, 0, NULL);
|
||||
|
||||
if (!wfi->updateThread)
|
||||
{
|
||||
_tprintf(_T("Failed to create update thread\n"));
|
||||
}
|
||||
|
||||
wf_info_unlock(wfi);
|
||||
}
|
||||
|
||||
void wf_peer_init(freerdp_peer* client)
|
||||
{
|
||||
client->context_size = sizeof(wfPeerContext);
|
||||
@@ -99,9 +81,10 @@ boolean wf_peer_post_connect(freerdp_peer* client)
|
||||
settings->color_depth = wfi->bitsPerPixel;
|
||||
|
||||
client->update->DesktopResize(client->update->context);
|
||||
client->activated = false;
|
||||
}
|
||||
|
||||
wf_peer_start_encoder_thread(client);
|
||||
ResumeThread(wfi->updateThread);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -38,10 +38,11 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
||||
DWORD beg, end;
|
||||
DWORD diff, rate;
|
||||
|
||||
fps = 24;
|
||||
rate = 1000 / fps;
|
||||
wfi = (wfInfo*) lpParam;
|
||||
|
||||
|
||||
fps = wfi->framesPerSecond;
|
||||
rate = 1000 / fps;
|
||||
|
||||
while (1)
|
||||
{
|
||||
beg = GetTickCount();
|
||||
|
||||
Reference in New Issue
Block a user