Unified RFX server color format.
This commit is contained in:
parent
ddced3f3ca
commit
9a1c60885c
@ -63,10 +63,9 @@ BOOL mf_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
|
||||
{
|
||||
if (info_event_queue->pipe_fd[0] == -1)
|
||||
return TRUE;
|
||||
|
||||
rfds[*rcount] = (void *)(long) info_event_queue->pipe_fd[0];
|
||||
|
||||
rfds[*rcount] = (void*)(long) info_event_queue->pipe_fd[0];
|
||||
(*rcount)++;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -74,28 +73,25 @@ BOOL mf_peer_check_fds(freerdp_peer* client)
|
||||
{
|
||||
mfPeerContext* context = (mfPeerContext*) client->context;
|
||||
mfEvent* event;
|
||||
|
||||
|
||||
if (context->activated == FALSE)
|
||||
return TRUE;
|
||||
|
||||
|
||||
event = mf_event_peek(info_event_queue);
|
||||
|
||||
|
||||
if (event != NULL)
|
||||
{
|
||||
if (event->type == MF_EVENT_TYPE_REGION)
|
||||
{
|
||||
|
||||
}
|
||||
else if (event->type == MF_EVENT_TYPE_FRAME_TICK)
|
||||
{
|
||||
event = mf_event_pop(info_event_queue);
|
||||
|
||||
mf_peer_rfx_update(client);
|
||||
|
||||
mf_event_free(event);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -103,76 +99,59 @@ void mf_peer_rfx_update(freerdp_peer* client)
|
||||
{
|
||||
//check
|
||||
mfInfo* mfi = mf_info_get_instance();
|
||||
|
||||
mf_info_find_invalid_region(mfi);
|
||||
|
||||
if (mf_info_have_invalid_region(mfi) == false) {
|
||||
|
||||
if (mf_info_have_invalid_region(mfi) == false)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
long width;
|
||||
long height;
|
||||
int pitch;
|
||||
BYTE* dataBits = NULL;
|
||||
|
||||
mf_info_getScreenData(mfi, &width, &height, &dataBits, &pitch);
|
||||
|
||||
mf_info_clear_invalid_region(mfi);
|
||||
|
||||
//encode
|
||||
|
||||
wStream* s;
|
||||
RFX_RECT rect;
|
||||
rdpUpdate* update;
|
||||
mfPeerContext* mfp;
|
||||
SURFACE_BITS_COMMAND* cmd;
|
||||
|
||||
update = client->update;
|
||||
mfp = (mfPeerContext*) client->context;
|
||||
cmd = &update->surface_bits_command;
|
||||
|
||||
|
||||
s = mfp->s;
|
||||
Stream_Clear(s);
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
UINT32 x = mfi->invalid.x / mfi->scale;
|
||||
UINT32 y = mfi->invalid.y / mfi->scale;
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = width;
|
||||
rect.height = height;
|
||||
|
||||
mfp->rfx_context->width = mfi->servscreen_width;
|
||||
mfp->rfx_context->height = mfi->servscreen_height;
|
||||
|
||||
|
||||
if (!(rfx_compose_message(mfp->rfx_context, s, &rect, 1,
|
||||
(BYTE*) dataBits, rect.width, rect.height, pitch)))
|
||||
(BYTE*) dataBits, rect.width, rect.height, pitch)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
cmd->destLeft = x;
|
||||
cmd->destTop = y;
|
||||
cmd->destRight = x + rect.width;
|
||||
cmd->destBottom = y + rect.height;
|
||||
|
||||
|
||||
cmd->bpp = 32;
|
||||
cmd->codecID = 3;
|
||||
cmd->width = rect.width;
|
||||
cmd->height = rect.height;
|
||||
cmd->bitmapDataLength = Stream_GetPosition(s);
|
||||
cmd->bitmapData = Stream_Buffer(s);
|
||||
|
||||
//send
|
||||
|
||||
update->SurfaceBits(update->context, cmd);
|
||||
|
||||
//clean up... maybe?
|
||||
|
||||
}
|
||||
|
||||
/* Called when we have a new peer connecting */
|
||||
@ -187,24 +166,18 @@ BOOL mf_peer_context_new(freerdp_peer* client, mfPeerContext* context)
|
||||
context->rfx_context->mode = RLGR3;
|
||||
context->rfx_context->width = client->settings->DesktopWidth;
|
||||
context->rfx_context->height = client->settings->DesktopHeight;
|
||||
rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
|
||||
|
||||
//if (!(context->nsc_context = nsc_context_new()))
|
||||
// goto fail_nsc_context;
|
||||
//nsc_context_set_pixel_format(context->nsc_context, RDP_PIXEL_FORMAT_B8G8R8A8);
|
||||
|
||||
rfx_context_set_pixel_format(context->rfx_context, RDP_PIXEL_FORMAT_BGRA32);
|
||||
|
||||
if (!(context->s = Stream_New(NULL, 0xFFFF)))
|
||||
goto fail_stream_new;
|
||||
|
||||
|
||||
context->vcm = WTSOpenServerA((LPSTR) client->context);
|
||||
|
||||
if (!context->vcm || context->vcm == INVALID_HANDLE_VALUE)
|
||||
goto fail_open_server;
|
||||
|
||||
|
||||
mf_info_peer_register(context->info, context);
|
||||
|
||||
return TRUE;
|
||||
|
||||
fail_open_server:
|
||||
Stream_Free(context->s, TRUE);
|
||||
context->s = NULL;
|
||||
@ -212,7 +185,6 @@ fail_stream_new:
|
||||
rfx_context_free(context->rfx_context);
|
||||
context->rfx_context = NULL;
|
||||
fail_rfx_context:
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -222,25 +194,23 @@ void mf_peer_context_free(freerdp_peer* client, mfPeerContext* context)
|
||||
if (context)
|
||||
{
|
||||
mf_info_peer_unregister(context->info, context);
|
||||
|
||||
dispatch_suspend(info_timer);
|
||||
|
||||
Stream_Free(context->s, TRUE);
|
||||
|
||||
rfx_context_free(context->rfx_context);
|
||||
//nsc_context_free(context->nsc_context);
|
||||
|
||||
#ifdef CHANNEL_AUDIN_SERVER
|
||||
|
||||
if (context->audin)
|
||||
audin_server_context_free(context->audin);
|
||||
|
||||
#endif
|
||||
|
||||
//#ifdef CHANNEL_RDPSND_SERVER
|
||||
mf_peer_rdpsnd_stop();
|
||||
|
||||
if (context->rdpsnd)
|
||||
rdpsnd_server_context_free(context->rdpsnd);
|
||||
|
||||
//#endif
|
||||
|
||||
WTSCloseServer(context->vcm);
|
||||
}
|
||||
}
|
||||
@ -254,21 +224,25 @@ BOOL mf_peer_init(freerdp_peer* client)
|
||||
|
||||
if (!freerdp_peer_context_new(client))
|
||||
return FALSE;
|
||||
|
||||
|
||||
info_event_queue = mf_event_queue_new();
|
||||
|
||||
info_queue = dispatch_queue_create("FreeRDP.update.timer", DISPATCH_QUEUE_SERIAL);
|
||||
info_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, info_queue);
|
||||
|
||||
if(info_timer)
|
||||
info_queue = dispatch_queue_create("FreeRDP.update.timer",
|
||||
DISPATCH_QUEUE_SERIAL);
|
||||
info_timer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,
|
||||
info_queue);
|
||||
|
||||
if (info_timer)
|
||||
{
|
||||
//DEBUG_WARN( "created timer\n");
|
||||
dispatch_source_set_timer(info_timer, DISPATCH_TIME_NOW, 42ull * NSEC_PER_MSEC, 100ull * NSEC_PER_MSEC);
|
||||
dispatch_source_set_event_handler(info_timer, ^{
|
||||
dispatch_source_set_timer(info_timer, DISPATCH_TIME_NOW, 42ull * NSEC_PER_MSEC,
|
||||
100ull * NSEC_PER_MSEC);
|
||||
dispatch_source_set_event_handler(info_timer, ^
|
||||
{
|
||||
//DEBUG_WARN( "dispatch\n");
|
||||
mfEvent* event = mf_event_new(MF_EVENT_TYPE_FRAME_TICK);
|
||||
mf_event_push(info_event_queue, (mfEvent*) event);}
|
||||
);
|
||||
mf_event_push(info_event_queue, (mfEvent*) event);
|
||||
}
|
||||
);
|
||||
dispatch_resume(info_timer);
|
||||
}
|
||||
|
||||
@ -279,25 +253,21 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
|
||||
{
|
||||
mfPeerContext* context = (mfPeerContext*) client->context;
|
||||
rdpSettings* settings = client->settings;
|
||||
|
||||
mfInfo* mfi = mf_info_get_instance();
|
||||
mfi->scale = 1;
|
||||
|
||||
//mfi->servscreen_width = 2880 / mfi->scale;
|
||||
//mfi->servscreen_height = 1800 / mfi->scale;
|
||||
UINT32 bitsPerPixel = 32;
|
||||
|
||||
if ((settings->DesktopWidth != mfi->servscreen_width) || (settings->DesktopHeight != mfi->servscreen_height))
|
||||
{
|
||||
|
||||
if ((settings->DesktopWidth != mfi->servscreen_width)
|
||||
|| (settings->DesktopHeight != mfi->servscreen_height))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
settings->DesktopWidth = mfi->servscreen_width;
|
||||
settings->DesktopHeight = mfi->servscreen_height;
|
||||
settings->ColorDepth = bitsPerPixel;
|
||||
|
||||
client->update->DesktopResize(client->update->context);
|
||||
|
||||
mfi->mouse_down_left = FALSE;
|
||||
mfi->mouse_down_right = FALSE;
|
||||
mfi->mouse_down_other = FALSE;
|
||||
@ -306,38 +276,32 @@ BOOL mf_peer_post_connect(freerdp_peer* client)
|
||||
{
|
||||
mf_peer_rdpsnd_init(context); /* Audio Output */
|
||||
}
|
||||
|
||||
|
||||
/* Dynamic Virtual Channels */
|
||||
|
||||
#ifdef CHANNEL_AUDIN_SERVER
|
||||
mf_peer_audin_init(context); /* Audio Input */
|
||||
#endif
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL mf_peer_activate(freerdp_peer* client)
|
||||
{
|
||||
mfPeerContext* context = (mfPeerContext*) client->context;
|
||||
|
||||
rfx_context_reset(context->rfx_context);
|
||||
context->activated = TRUE;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void mf_peer_synchronize_event(rdpInput* input, UINT32 flags)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
UINT16 down = 0x4000;
|
||||
//UINT16 up = 0x8000;
|
||||
|
||||
bool state_down = FALSE;
|
||||
|
||||
|
||||
if (flags == down)
|
||||
{
|
||||
state_down = TRUE;
|
||||
@ -346,18 +310,17 @@ void mf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
|
||||
void mf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static void mf_peer_suppress_output(rdpContext* context, BYTE allow, RECTANGLE_16* area)
|
||||
static void mf_peer_suppress_output(rdpContext* context, BYTE allow,
|
||||
RECTANGLE_16* area)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
BOOL mf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
|
||||
{
|
||||
pthread_t th;
|
||||
|
||||
|
||||
if (pthread_create(&th, 0, mf_peer_main_loop, client) == 0)
|
||||
{
|
||||
pthread_detach(th);
|
||||
@ -377,79 +340,72 @@ void* mf_peer_main_loop(void* arg)
|
||||
fd_set rfds_set;
|
||||
mfPeerContext* context;
|
||||
freerdp_peer* client = (freerdp_peer*) arg;
|
||||
|
||||
memset(rfds, 0, sizeof(rfds));
|
||||
|
||||
|
||||
if (!mf_peer_init(client))
|
||||
{
|
||||
freerdp_peer_free(client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
/* Initialize the real server settings here */
|
||||
client->settings->CertificateFile = _strdup("server.crt");
|
||||
client->settings->PrivateKeyFile = _strdup("server.key");
|
||||
|
||||
if (!client->settings->CertificateFile || !client->settings->PrivateKeyFile)
|
||||
{
|
||||
freerdp_peer_free(client);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
client->settings->NlaSecurity = FALSE;
|
||||
client->settings->RemoteFxCodec = TRUE;
|
||||
client->settings->ColorDepth = 32;
|
||||
client->settings->SuppressOutput = TRUE;
|
||||
client->settings->RefreshRect = FALSE;
|
||||
|
||||
client->PostConnect = mf_peer_post_connect;
|
||||
client->Activate = mf_peer_activate;
|
||||
|
||||
client->input->SynchronizeEvent = mf_peer_synchronize_event;
|
||||
client->input->KeyboardEvent = mf_input_keyboard_event;//mf_peer_keyboard_event;
|
||||
client->input->UnicodeKeyboardEvent = mf_peer_unicode_keyboard_event;
|
||||
client->input->MouseEvent = mf_input_mouse_event;
|
||||
client->input->ExtendedMouseEvent = mf_input_extended_mouse_event;
|
||||
|
||||
//client->update->RefreshRect = mf_peer_refresh_rect;
|
||||
client->update->SuppressOutput = mf_peer_suppress_output;
|
||||
|
||||
client->Initialize(client);
|
||||
context = (mfPeerContext*) client->context;
|
||||
|
||||
|
||||
while (1)
|
||||
{
|
||||
rcount = 0;
|
||||
|
||||
|
||||
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (mf_peer_get_fds(client, rfds, &rcount) != TRUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
WTSVirtualChannelManagerGetFileDescriptor(context->vcm, rfds, &rcount);
|
||||
|
||||
max_fds = 0;
|
||||
FD_ZERO(&rfds_set);
|
||||
|
||||
|
||||
for (i = 0; i < rcount; i++)
|
||||
{
|
||||
fds = (int)(long)(rfds[i]);
|
||||
|
||||
|
||||
if (fds > max_fds)
|
||||
max_fds = fds;
|
||||
|
||||
|
||||
FD_SET(fds, &rfds_set);
|
||||
}
|
||||
|
||||
|
||||
if (max_fds == 0)
|
||||
break;
|
||||
|
||||
|
||||
if (select(max_fds + 1, &rfds_set, NULL, NULL, NULL) == -1)
|
||||
{
|
||||
/* these are not really errors */
|
||||
@ -461,26 +417,25 @@ void* mf_peer_main_loop(void* arg)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (client->CheckFileDescriptor(client) != TRUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ((mf_peer_check_fds(client)) != TRUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (WTSVirtualChannelManagerCheckFileDescriptor(context->vcm) != TRUE)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
client->Disconnect(client);
|
||||
freerdp_peer_context_free(client);
|
||||
freerdp_peer_free(client);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
@ -60,11 +60,11 @@ BOOL test_peer_context_new(freerdp_peer* client, testPeerContext* context)
|
||||
goto fail_rfx_context;
|
||||
|
||||
if (!rfx_context_reset(context->rfx_context, SAMPLE_SERVER_DEFAULT_WIDTH,
|
||||
SAMPLE_SERVER_DEFAULT_HEIGHT))
|
||||
SAMPLE_SERVER_DEFAULT_HEIGHT))
|
||||
goto fail_rfx_context;
|
||||
|
||||
context->rfx_context->mode = RLGR3;
|
||||
rfx_context_set_pixel_format(context->rfx_context, PIXEL_FORMAT_RGB24);
|
||||
rfx_context_set_pixel_format(context->rfx_context, PIXEL_FORMAT_BGRX32);
|
||||
|
||||
if (!(context->nsc_context = nsc_context_new()))
|
||||
goto fail_nsc_context;
|
||||
@ -197,7 +197,7 @@ static BOOL test_peer_draw_background(freerdp_peer* client)
|
||||
if (client->settings->RemoteFxCodec)
|
||||
{
|
||||
if (!rfx_compose_message(context->rfx_context, s,
|
||||
&rect, 1, rgb_data, rect.width, rect.height, rect.width * 3))
|
||||
&rect, 1, rgb_data, rect.width, rect.height, rect.width * 3))
|
||||
{
|
||||
goto out;
|
||||
}
|
||||
@ -207,7 +207,7 @@ static BOOL test_peer_draw_background(freerdp_peer* client)
|
||||
else
|
||||
{
|
||||
nsc_compose_message(context->nsc_context, s,
|
||||
rgb_data, rect.width, rect.height, rect.width * 3);
|
||||
rgb_data, rect.width, rect.height, rect.width * 3);
|
||||
cmd->codecID = client->settings->NSCodecId;
|
||||
}
|
||||
|
||||
@ -279,7 +279,7 @@ static BOOL test_peer_load_icon(freerdp_peer* client)
|
||||
|
||||
/* background with same size, which will be used to erase the icon from old position */
|
||||
if (!(context->bg_data = malloc(context->icon_width * context->icon_height *
|
||||
3)))
|
||||
3)))
|
||||
goto out_fail;
|
||||
|
||||
memset(context->bg_data, 0xA0, context->icon_width * context->icon_height * 3);
|
||||
@ -323,13 +323,13 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
|
||||
if (client->settings->RemoteFxCodec)
|
||||
{
|
||||
rfx_compose_message(context->rfx_context, s,
|
||||
&rect, 1, context->bg_data, rect.width, rect.height, rect.width * 3);
|
||||
&rect, 1, context->bg_data, rect.width, rect.height, rect.width * 3);
|
||||
cmd->codecID = client->settings->RemoteFxCodecId;
|
||||
}
|
||||
else
|
||||
{
|
||||
nsc_compose_message(context->nsc_context, s,
|
||||
context->bg_data, rect.width, rect.height, rect.width * 3);
|
||||
context->bg_data, rect.width, rect.height, rect.width * 3);
|
||||
cmd->codecID = client->settings->NSCodecId;
|
||||
}
|
||||
|
||||
@ -350,13 +350,13 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
|
||||
if (client->settings->RemoteFxCodec)
|
||||
{
|
||||
rfx_compose_message(context->rfx_context, s,
|
||||
&rect, 1, context->icon_data, rect.width, rect.height, rect.width * 3);
|
||||
&rect, 1, context->icon_data, rect.width, rect.height, rect.width * 3);
|
||||
cmd->codecID = client->settings->RemoteFxCodecId;
|
||||
}
|
||||
else
|
||||
{
|
||||
nsc_compose_message(context->nsc_context, s,
|
||||
context->icon_data, rect.width, rect.height, rect.width * 3);
|
||||
context->icon_data, rect.width, rect.height, rect.width * 3);
|
||||
cmd->codecID = client->settings->NSCodecId;
|
||||
}
|
||||
|
||||
@ -376,7 +376,7 @@ static void test_peer_draw_icon(freerdp_peer* client, int x, int y)
|
||||
}
|
||||
|
||||
static BOOL test_sleep_tsdiff(UINT32* old_sec, UINT32* old_usec, UINT32 new_sec,
|
||||
UINT32 new_usec)
|
||||
UINT32 new_usec)
|
||||
{
|
||||
INT32 sec, usec;
|
||||
|
||||
@ -448,7 +448,7 @@ BOOL tf_peer_dump_rfx(freerdp_peer* client)
|
||||
|
||||
if (test_dump_rfx_realtime
|
||||
&& test_sleep_tsdiff(&prev_seconds, &prev_useconds, record.header.ts_sec,
|
||||
record.header.ts_usec) == FALSE)
|
||||
record.header.ts_usec) == FALSE)
|
||||
break;
|
||||
|
||||
update->SurfaceCommand(update->context, s);
|
||||
@ -472,7 +472,7 @@ static void* tf_debug_channel_thread_func(void* arg)
|
||||
testPeerContext* context = (testPeerContext*) arg;
|
||||
|
||||
if (WTSVirtualChannelQuery(context->debug_channel, WTSVirtualFileHandle,
|
||||
&buffer, &BytesReturned) == TRUE)
|
||||
&buffer, &BytesReturned) == TRUE)
|
||||
{
|
||||
fd = *((void**) buffer);
|
||||
WTSFreeMemory(buffer);
|
||||
@ -494,7 +494,7 @@ static void* tf_debug_channel_thread_func(void* arg)
|
||||
Stream_SetPosition(s, 0);
|
||||
|
||||
if (WTSVirtualChannelRead(context->debug_channel, 0, (PCHAR) Stream_Buffer(s),
|
||||
Stream_Capacity(s), &BytesReturned) == FALSE)
|
||||
Stream_Capacity(s), &BytesReturned) == FALSE)
|
||||
{
|
||||
if (BytesReturned == 0)
|
||||
break;
|
||||
@ -502,7 +502,7 @@ static void* tf_debug_channel_thread_func(void* arg)
|
||||
Stream_EnsureRemainingCapacity(s, BytesReturned);
|
||||
|
||||
if (WTSVirtualChannelRead(context->debug_channel, 0, (PCHAR) Stream_Buffer(s),
|
||||
Stream_Capacity(s), &BytesReturned) == FALSE)
|
||||
Stream_Capacity(s), &BytesReturned) == FALSE)
|
||||
{
|
||||
/* should not happen */
|
||||
break;
|
||||
@ -527,25 +527,25 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
|
||||
* callback returns.
|
||||
*/
|
||||
WLog_DBG(TAG, "Client %s is activated (osMajorType %d osMinorType %d)",
|
||||
client->local ? "(local)" : client->hostname,
|
||||
client->settings->OsMajorType, client->settings->OsMinorType);
|
||||
client->local ? "(local)" : client->hostname,
|
||||
client->settings->OsMajorType, client->settings->OsMinorType);
|
||||
|
||||
if (client->settings->AutoLogonEnabled)
|
||||
{
|
||||
WLog_DBG(TAG, " and wants to login automatically as %s\\%s",
|
||||
client->settings->Domain ? client->settings->Domain : "",
|
||||
client->settings->Username);
|
||||
client->settings->Domain ? client->settings->Domain : "",
|
||||
client->settings->Username);
|
||||
/* A real server may perform OS login here if NLA is not executed previously. */
|
||||
}
|
||||
|
||||
WLog_DBG(TAG, "");
|
||||
WLog_DBG(TAG, "Client requested desktop: %dx%dx%d",
|
||||
client->settings->DesktopWidth, client->settings->DesktopHeight,
|
||||
client->settings->ColorDepth);
|
||||
client->settings->DesktopWidth, client->settings->DesktopHeight,
|
||||
client->settings->ColorDepth);
|
||||
#if (SAMPLE_SERVER_USE_CLIENT_RESOLUTION == 1)
|
||||
|
||||
if (!rfx_context_reset(context->rfx_context, client->settings->DesktopWidth,
|
||||
client->settings->DesktopHeight))
|
||||
client->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
WLog_DBG(TAG, "Using resolution requested by client.");
|
||||
@ -553,7 +553,7 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
|
||||
client->settings->DesktopWidth = context->rfx_context->width;
|
||||
client->settings->DesktopHeight = context->rfx_context->height;
|
||||
WLog_DBG(TAG, "Resizing client to %dx%d", client->settings->DesktopWidth,
|
||||
client->settings->DesktopHeight);
|
||||
client->settings->DesktopHeight);
|
||||
client->update->DesktopResize(client->update->context);
|
||||
#endif
|
||||
|
||||
@ -567,7 +567,7 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
|
||||
if (WTSVirtualChannelManagerIsChannelJoined(context->vcm, "rdpdbg"))
|
||||
{
|
||||
context->debug_channel = WTSVirtualChannelOpen(context->vcm,
|
||||
WTS_CURRENT_SESSION, "rdpdbg");
|
||||
WTS_CURRENT_SESSION, "rdpdbg");
|
||||
|
||||
if (context->debug_channel != NULL)
|
||||
{
|
||||
@ -580,8 +580,8 @@ BOOL tf_peer_post_connect(freerdp_peer* client)
|
||||
}
|
||||
|
||||
if (!(context->debug_channel_thread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) tf_debug_channel_thread_func, (void*) context, 0,
|
||||
NULL)))
|
||||
(LPTHREAD_START_ROUTINE) tf_debug_channel_thread_func, (void*) context, 0,
|
||||
NULL)))
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to create debug channel thread");
|
||||
CloseHandle(context->stopEvent);
|
||||
@ -641,7 +641,7 @@ BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
rdpUpdate* update = client->update;
|
||||
testPeerContext* context = (testPeerContext*) input->context;
|
||||
WLog_DBG(TAG, "Client sent a keyboard event (flags:0x%X code:0x%X)", flags,
|
||||
code);
|
||||
code);
|
||||
|
||||
if ((flags & 0x4000) && code == 0x22) /* 'g' key */
|
||||
{
|
||||
@ -657,7 +657,7 @@ BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
}
|
||||
|
||||
if (!rfx_context_reset(context->rfx_context, client->settings->DesktopWidth,
|
||||
client->settings->DesktopHeight))
|
||||
client->settings->DesktopHeight))
|
||||
return FALSE;
|
||||
|
||||
update->DesktopResize(update->context);
|
||||
@ -698,7 +698,7 @@ BOOL tf_peer_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
BOOL tf_peer_unicode_keyboard_event(rdpInput* input, UINT16 flags, UINT16 code)
|
||||
{
|
||||
WLog_DBG(TAG, "Client sent a unicode keyboard event (flags:0x%X code:0x%X)",
|
||||
flags, code);
|
||||
flags, code);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -710,14 +710,14 @@ BOOL tf_peer_mouse_event(rdpInput* input, UINT16 flags, UINT16 x, UINT16 y)
|
||||
}
|
||||
|
||||
BOOL tf_peer_extended_mouse_event(rdpInput* input, UINT16 flags, UINT16 x,
|
||||
UINT16 y)
|
||||
UINT16 y)
|
||||
{
|
||||
//WLog_DBG(TAG, "Client sent an extended mouse event (flags:0x%X pos:%d,%d)", flags, x, y);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count,
|
||||
const RECTANGLE_16* areas)
|
||||
const RECTANGLE_16* areas)
|
||||
{
|
||||
BYTE i;
|
||||
WLog_DBG(TAG, "Client requested to refresh:");
|
||||
@ -725,19 +725,19 @@ static BOOL tf_peer_refresh_rect(rdpContext* context, BYTE count,
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
WLog_DBG(TAG, " (%d, %d) (%d, %d)", areas[i].left, areas[i].top,
|
||||
areas[i].right, areas[i].bottom);
|
||||
areas[i].right, areas[i].bottom);
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL tf_peer_suppress_output(rdpContext* context, BYTE allow,
|
||||
const RECTANGLE_16* area)
|
||||
const RECTANGLE_16* area)
|
||||
{
|
||||
if (allow > 0)
|
||||
{
|
||||
WLog_DBG(TAG, "Client restore output (%d, %d) (%d, %d).", area->left, area->top,
|
||||
area->right, area->bottom);
|
||||
area->right, area->bottom);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -798,7 +798,7 @@ static void* test_peer_mainloop(void* arg)
|
||||
client->Initialize(client);
|
||||
context = (testPeerContext*) client->context;
|
||||
WLog_INFO(TAG, "We've got a client %s",
|
||||
client->local ? "(local)" : client->hostname);
|
||||
client->local ? "(local)" : client->hostname);
|
||||
|
||||
while (1)
|
||||
{
|
||||
@ -821,7 +821,7 @@ static void* test_peer_mainloop(void* arg)
|
||||
}
|
||||
|
||||
WLog_INFO(TAG, "Client %s disconnected.",
|
||||
client->local ? "(local)" : client->hostname);
|
||||
client->local ? "(local)" : client->hostname);
|
||||
client->Disconnect(client);
|
||||
freerdp_peer_context_free(client);
|
||||
freerdp_peer_free(client);
|
||||
@ -833,7 +833,7 @@ static BOOL test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
|
||||
HANDLE hThread;
|
||||
|
||||
if (!(hThread = CreateThread(NULL, 0,
|
||||
(LPTHREAD_START_ROUTINE) test_peer_mainloop, (void*) client, 0, NULL)))
|
||||
(LPTHREAD_START_ROUTINE) test_peer_mainloop, (void*) client, 0, NULL)))
|
||||
return FALSE;
|
||||
|
||||
CloseHandle(hThread);
|
||||
|
@ -43,9 +43,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
||||
wfInfo* wfi;
|
||||
DWORD beg, end;
|
||||
DWORD diff, rate;
|
||||
|
||||
wfi = (wfInfo*) lpParam;
|
||||
|
||||
fps = wfi->framesPerSecond;
|
||||
rate = 1000 / fps;
|
||||
|
||||
@ -64,6 +62,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
||||
wf_update_encode(wfi);
|
||||
//WLog_DBG(TAG, "Start of parallel sending");
|
||||
index = 0;
|
||||
|
||||
for (peerindex = 0; peerindex < wfi->peerCount; peerindex++)
|
||||
{
|
||||
for (; index < WF_INFO_MAXPEERS; index++)
|
||||
@ -74,7 +73,6 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
||||
SetEvent(((wfPeerContext*) wfi->peers[index]->context)->updateEvent);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (index = 0; index < wfi->activePeerCount; index++)
|
||||
@ -111,17 +109,11 @@ void wf_update_encode(wfInfo* wfi)
|
||||
long height, width;
|
||||
BYTE* pDataBits = NULL;
|
||||
int stride;
|
||||
|
||||
SURFACE_BITS_COMMAND* cmd;
|
||||
|
||||
wf_info_find_invalid_region(wfi);
|
||||
|
||||
cmd = &wfi->cmd;
|
||||
|
||||
Stream_SetPosition(wfi->s, 0);
|
||||
|
||||
wf_info_getScreenData(wfi, &width, &height, &pDataBits, &stride);
|
||||
|
||||
rect.x = 0;
|
||||
rect.y = 0;
|
||||
rect.width = (UINT16) width;
|
||||
@ -130,18 +122,16 @@ void wf_update_encode(wfInfo* wfi)
|
||||
Stream_Clear(wfi->s);
|
||||
|
||||
if (!(rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
|
||||
pDataBits, width, height, stride)))
|
||||
pDataBits, width, height, stride)))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wfi->frame_idx = wfi->rfx_context->frameIdx;
|
||||
|
||||
cmd->destLeft = wfi->invalid.left;
|
||||
cmd->destTop = wfi->invalid.top;
|
||||
cmd->destRight = wfi->invalid.left + width;
|
||||
cmd->destBottom = wfi->invalid.top + height;
|
||||
|
||||
cmd->bpp = 32;
|
||||
cmd->codecID = 3;
|
||||
cmd->width = width;
|
||||
@ -168,13 +158,12 @@ void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context)
|
||||
if ((context->frame_idx + 1) != wfi->frame_idx)
|
||||
{
|
||||
/* This frame is meant to be discarded */
|
||||
|
||||
if (context->frame_idx == 0)
|
||||
return;
|
||||
|
||||
/* This is an unexpected error condition */
|
||||
WLog_DBG(TAG, "Unexpected Frame Index: Actual: %d Expected: %d",
|
||||
wfi->frame_idx, context->frame_idx + 1);
|
||||
wfi->frame_idx, context->frame_idx + 1);
|
||||
}
|
||||
|
||||
wfi->cmd.codecID = client->settings->RemoteFxCodecId;
|
||||
@ -198,12 +187,11 @@ void wf_update_encoder_reset(wfInfo* wfi)
|
||||
wfi->rfx_context->mode = RLGR3;
|
||||
wfi->rfx_context->width = wfi->servscreen_width;
|
||||
wfi->rfx_context->height = wfi->servscreen_height;
|
||||
rfx_context_set_pixel_format(wfi->rfx_context, RDP_PIXEL_FORMAT_B8G8R8A8);
|
||||
rfx_context_set_pixel_format(wfi->rfx_context, RDP_PIXEL_FORMAT_BGRA32);
|
||||
wfi->s = Stream_New(NULL, 0xFFFF);
|
||||
}
|
||||
|
||||
wf_info_invalidate_full_screen(wfi);
|
||||
|
||||
wf_info_unlock(wfi);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user