[channel,server] fix unguarded use of functions

If functions of channel_<name>_server are used guard them so the code
compiles if the channel is not compiled in.
This commit is contained in:
Armin Novak
2024-06-12 09:26:48 +02:00
parent 0d2a94f373
commit 1806daa375
4 changed files with 38 additions and 15 deletions

View File

@@ -41,26 +41,16 @@ UINT shadow_client_channels_post_connect(rdpShadowClient* client)
shadow_client_audin_init(client);
if (freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
{
shadow_client_rdpgfx_init(client);
}
shadow_client_rdpgfx_init(client);
return CHANNEL_RC_OK;
}
void shadow_client_channels_free(rdpShadowClient* client)
{
if (freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
{
shadow_client_rdpgfx_uninit(client);
}
shadow_client_rdpgfx_uninit(client);
shadow_client_audin_uninit(client);
shadow_client_rdpsnd_uninit(client);
shadow_client_remdesk_uninit(client);
shadow_client_encomsp_uninit(client);
}

View File

@@ -2196,10 +2196,12 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
events[nCount++] = ChannelEvent;
events[nCount++] = MessageQueue_Event(MsgQueue);
#if defined(CHANNEL_RDPGFX_SERVER)
HANDLE gfxevent = rdpgfx_server_get_event_handle(client->rdpgfx);
if (gfxevent)
events[nCount++] = gfxevent;
#endif
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
@@ -2329,6 +2331,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
}
}
#if defined(CHANNEL_RDPGFX_SERVER)
if (gfxevent)
{
if (WaitForSingleObject(gfxevent, 0) == WAIT_OBJECT_0)
@@ -2336,6 +2339,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg)
rdpgfx_server_handle_messages(client->rdpgfx);
}
}
#endif
if (WaitForSingleObject(MessageQueue_Event(MsgQueue), 0) == WAIT_OBJECT_0)
{

View File

@@ -29,11 +29,13 @@ int shadow_client_rdpgfx_init(rdpShadowClient* client)
{
WINPR_ASSERT(client);
if (!freerdp_settings_get_bool(client->context.settings, FreeRDP_SupportGraphicsPipeline))
return 1;
#if defined(CHANNEL_RDPGFX_SERVER)
RdpgfxServerContext* rdpgfx = client->rdpgfx = rdpgfx_server_context_new(client->vcm);
if (!rdpgfx)
{
return 0;
}
rdpgfx->rdpcontext = &client->context;
@@ -41,15 +43,19 @@ int shadow_client_rdpgfx_init(rdpShadowClient* client)
if (!IFCALLRESULT(CHANNEL_RC_OK, rdpgfx->Initialize, rdpgfx, TRUE))
return -1;
#endif
return 1;
}
void shadow_client_rdpgfx_uninit(rdpShadowClient* client)
{
WINPR_ASSERT(client);
if (client->rdpgfx)
{
#if defined(CHANNEL_RDPGFX_SERVER)
rdpgfx_server_context_free(client->rdpgfx);
#endif
client->rdpgfx = NULL;
}
}