wfreerdp-server: fix encoder on Windows 7

This commit is contained in:
Marc-André Moreau 2012-09-20 00:22:13 -04:00
parent 34b59653dd
commit 58525ca415
3 changed files with 19 additions and 15 deletions

1
.gitignore vendored
View File

@ -31,6 +31,7 @@ client/X11/xfreerdp.1
*.opensdf
ipch
Debug
RelWithDebInfo
# Binaries
*.a

View File

@ -125,6 +125,7 @@ wfInfo* wf_info_init()
}
wfi->updateEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
printf("updateEvent created\n");
wfi->updateSemaphore = CreateSemaphore(NULL, 0, 32, NULL);
@ -192,16 +193,12 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
context->info = wfi;
context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
if (wfi->peerCount == 0)
{
#ifdef WITH_WIN8
if (wfi->peerCount == 0)
wf_dxgi_init(wfi);
#endif
}
else
{
#else
wf_mirror_driver_activate(wfi);
}
#endif
wfi->peers[wfi->peerCount++] = ((rdpContext*) context)->peer;
@ -220,12 +217,10 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
printf("Unregistering Peer: %d\n", wfi->peerCount);
if(wfi->peerCount == 0)
{
#ifdef WITH_WIN8
if (wfi->peerCount == 0)
wf_dxgi_cleanup(wfi);
#endif
}
wf_info_unlock(wfi);
}
@ -248,12 +243,10 @@ void wf_info_update_changes(wfInfo* wfi)
#ifdef WITH_WIN8
wf_dxgi_nextFrame(wfi, wfi->framesPerSecond / 1000);
#else
GETCHANGESBUF* buf;
buf = (GETCHANGESBUF*) wfi->changeBuffer;
wfi->nextUpdate = buf->buffer->counter;
#endif
}
@ -284,7 +277,6 @@ void wf_info_find_invalid_region(wfInfo* wfi)
if (wfi->invalid.bottom >= wfi->height)
wfi->invalid.bottom = wfi->height - 1;
}
void wf_info_clear_invalid_region(wfInfo* wfi)
@ -323,6 +315,5 @@ void wf_info_getScreenData(wfInfo* wfi, long* width, long* height, uint8** pBits
*pBits = ((uint8*) (changes->Userbuffer)) + offset;
*pitch = wfi->width * 4;
}
#endif
}

View File

@ -138,6 +138,8 @@ DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
ZeroMemory(rfds, sizeof(rfds));
context = (wfPeerContext*) client->context;
printf("PeerSocketListener\n");
while (1)
{
rcount = 0;
@ -220,11 +222,15 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
wfi = context->info;
context->socketEvent = CreateEvent(NULL, TRUE, FALSE, NULL);
printf("socketEvent created\n");
context->socketSemaphore = CreateSemaphore(NULL, 0, 1, NULL);
context->socketThread = CreateThread(NULL, 0, wf_peer_socket_listener, client, 0, NULL);
printf("We've got a client %s\n", client->local ? "(local)" : client->hostname);
printf("Setting Handles\n");
nCount = 0;
handles[nCount++] = context->updateEvent;
handles[nCount++] = context->socketEvent;
@ -233,6 +239,12 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
{
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
if ((status == WAIT_FAILED) || (status == WAIT_TIMEOUT))
{
printf("WaitForMultipleObjects failed\n");
break;
}
if (WaitForSingleObject(context->updateEvent, 0) == 0)
{
if (client->activated)