Skip to content

Commit

Permalink
wfreerdp-server: fix encoder on Windows 7
Browse files Browse the repository at this point in the history
  • Loading branch information
awakecoding committed Sep 20, 2012
1 parent 34b5965 commit 58525ca
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 15 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ client/X11/xfreerdp.1
*.opensdf
ipch
Debug
RelWithDebInfo

# Binaries
*.a
Expand Down
21 changes: 6 additions & 15 deletions server/Windows/wf_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
#else
wf_mirror_driver_activate(wfi);
#endif
}
else
{
wf_mirror_driver_activate(wfi);
}

wfi->peers[wfi->peerCount++] = ((rdpContext*) context)->peer;

Expand All @@ -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);
}
Expand All @@ -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
}

Expand All @@ -274,7 +267,7 @@ void wf_info_find_invalid_region(wfInfo* wfi)
#endif

if (wfi->invalid.left < 0)
wfi->invalid.left = 0;
wfi->invalid.left = 0;

if (wfi->invalid.top < 0)
wfi->invalid.top = 0;
Expand All @@ -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)
Expand Down Expand Up @@ -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
}
12 changes: 12 additions & 0 deletions server/Windows/wf_peer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)
Expand Down

0 comments on commit 58525ca

Please sign in to comment.