wfreerdp-server: fixed some syncronization bugs

This commit is contained in:
C-o-r-E 2012-08-19 15:46:47 -04:00
parent 390926d134
commit 62b5b3f83b
3 changed files with 13 additions and 5 deletions

View File

@ -238,3 +238,10 @@ void wf_info_clear_invalid_region(wfInfo* info)
info->invalid_y2 = 0;
ReleaseMutex(info->mutex);
}
BOOL wf_info_have_invalid_region(wfInfo* info)
{
if((info->invalid_x1 >= info->invalid_x2) || (info->invalid_y1 >= info->invalid_y2))
return false;
return true;
}

View File

@ -63,6 +63,7 @@ void wf_info_updated(wfInfo* info);
void wf_info_update_changes(wfInfo* info);
void wf_info_find_invalid_region(wfInfo* info);
void wf_info_clear_invalid_region(wfInfo* info);
BOOL wf_info_have_invalid_region(wfInfo* info);
#endif

View File

@ -166,11 +166,11 @@ void wf_rfx_encode(freerdp_peer* client)
buf = (GETCHANGESBUF*)wfi->changeBuffer;
if( (wfp->activated == false) )//|| ( (wfi->nextUpdate - wfi->lastUpdate) == 0) )
if( (wfp->activated == false) || (wf_info_has_subscribers(wfi) == false) )
return;
if ( (wfi->invalid_x1 >= wfi->invalid_x2) || (wfi->invalid_y1 >= wfi->invalid_y2) )
return;
if ( !wf_info_have_invalid_region(wfi) )
return;
dRes = WaitForSingleObject(wfInfoSingleton->encodeMutex, INFINITE);
switch(dRes)
@ -322,7 +322,7 @@ void wf_peer_send_changes(rdpUpdate* update)
{
case WAIT_OBJECT_0:
//are there changes to send?
if(!wf_info_have_updates(wfInfoSingleton))
if( !wf_info_have_updates(wfInfoSingleton) || !wf_info_have_invalid_region(wfInfoSingleton) )
{
ReleaseMutex(wfInfoSingleton->encodeMutex);
break;
@ -332,7 +332,7 @@ void wf_peer_send_changes(rdpUpdate* update)
wf_info_updated(wfInfoSingleton);
printf("\tSend...\n");
update->SurfaceBits(update->context, &update->surface_bits_command);
//wf_info_clear_invalid_region(wfInfoSingleton);
ReleaseMutex(wfInfoSingleton->encodeMutex);
break;