wfreerdp-server: partialy fixed the corruption issue

This commit is contained in:
C-o-r-E 2012-08-20 13:47:44 -04:00
parent 5ed441e116
commit 1438d28d97
2 changed files with 23 additions and 5 deletions

View File

@ -216,8 +216,24 @@ void wf_info_find_invalid_region(wfInfo* info)
WaitForSingleObject(info->mutex, INFINITE);
buf = (GETCHANGESBUF*)info->changeBuffer;
if(info->enc_data == false)
{
info->invalid_x1 = 1920;//info->width;
info->invalid_x2 = 0;
info->invalid_y1 = 1200;// info->height;
info->invalid_y2 = 0;
}
printf("\tFIND = (%d, %d), (%d, %d)\n", info->invalid_x1, info->invalid_y1, info->invalid_x2, info->invalid_y2);
for(i = info->lastUpdate; i != info->nextUpdate; i = (i+1) % MAXCHANGES_BUF )
{
/*printf("\t(%d, %d), (%d, %d)\n",
buf->buffer->pointrect[i].rect.left,
buf->buffer->pointrect[i].rect.top,
buf->buffer->pointrect[i].rect.right,
buf->buffer->pointrect[i].rect.bottom);
*/
info->invalid_x1 = min(info->invalid_x1, buf->buffer->pointrect[i].rect.left);
info->invalid_x2 = max(info->invalid_x2, buf->buffer->pointrect[i].rect.right);
info->invalid_y1 = min(info->invalid_y1, buf->buffer->pointrect[i].rect.top);

View File

@ -65,7 +65,7 @@ static DWORD WINAPI wf_peer_mirror_monitor(LPVOID lpParam)
wf_info_update_changes(wfInfoSingleton);
if(wf_info_have_updates(wfInfoSingleton))
{
wf_info_find_invalid_region(wfInfoSingleton);
//wf_info_find_invalid_region(wfInfoSingleton);
//printf("Fake Encode!\n");
wf_rfx_encode(client);
}
@ -117,6 +117,8 @@ void wf_rfx_encode(freerdp_peer* client)
{
case WAIT_OBJECT_0:
wf_info_find_invalid_region(wfInfoSingleton);
if( (wfp->activated == false) ||
(wf_info_has_subscribers(wfi) == false) ||
!wf_info_have_invalid_region(wfi) )
@ -138,10 +140,10 @@ void wf_rfx_encode(freerdp_peer* client)
stream_set_pos(wfp->s, 0);
s = wfp->s;
rect.x = wfi->invalid_x1;
rect.y = wfi->invalid_y1;
rect.x = 0;
rect.y = 0;
rect.width = width;
rect.height = width;
rect.height = height;
rfx_compose_message(wfp->rfx_context, s, &rect, 1,
@ -150,7 +152,7 @@ void wf_rfx_encode(freerdp_peer* client)
cmd->destLeft = wfi->invalid_x1;
cmd->destTop = wfi->invalid_y1;
cmd->destRight = wfi->invalid_x1 + width;
cmd->destBottom = wfi->invalid_y1 + height;
cmd->destBottom = wfi->invalid_y2 + height;
cmd->bpp = 32;