diff --git a/channels/server/channels.c b/channels/server/channels.c index be0f1e942..64bc1b20a 100644 --- a/channels/server/channels.c +++ b/channels/server/channels.c @@ -38,7 +38,9 @@ * will need to fix that later on cleanly */ +#if defined(CHANNEL_AUDIN_SERVER) #include +#endif #include #include #include @@ -69,7 +71,9 @@ extern void freerdp_channels_dummy(void); void freerdp_channels_dummy(void) { +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context* audin; +#endif RdpsndServerContext* rdpsnd; CliprdrServerContext* cliprdr; echo_server_context* echo; @@ -89,8 +93,12 @@ void freerdp_channels_dummy(void) #ifdef WITH_CHANNEL_GFXREDIR GfxRedirServerContext* gfxredir; #endif // WITH_CHANNEL_GFXREDIR +#if defined(CHANNEL_AUDIN_SERVER) audin = audin_server_context_new(NULL); +#endif +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context_free(audin); +#endif rdpsnd = rdpsnd_server_context_new(NULL); rdpsnd_server_context_free(rdpsnd); cliprdr = cliprdr_server_context_new(NULL); diff --git a/include/freerdp/server/audin.h b/include/freerdp/server/audin.h index acae2c8a4..36037913d 100644 --- a/include/freerdp/server/audin.h +++ b/include/freerdp/server/audin.h @@ -26,6 +26,10 @@ #include #include +#if !defined(CHANNEL_AUDIN_SERVER) +#error "This header must not be included if CHANNEL_AUDIN_SERVER is not defined" +#endif + typedef struct s_audin_server_context audin_server_context; typedef BOOL (*psAudinServerChannelIdAssigned)(audin_server_context* context, UINT32 channelId); diff --git a/include/freerdp/server/shadow.h b/include/freerdp/server/shadow.h index bf6bc4c06..f9386ef8a 100644 --- a/include/freerdp/server/shadow.h +++ b/include/freerdp/server/shadow.h @@ -32,7 +32,9 @@ #include #include #include +#if defined(CHANNEL_AUDIN_SERVER) #include +#endif #include #include @@ -114,7 +116,9 @@ struct rdp_shadow_client EncomspServerContext* encomsp; RemdeskServerContext* remdesk; RdpsndServerContext* rdpsnd; +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context* audin; +#endif RdpgfxServerContext* rdpgfx; BOOL resizeRequested; diff --git a/server/Sample/sf_audin.c b/server/Sample/sf_audin.c index 4ecc29f8a..85e221a98 100644 --- a/server/Sample/sf_audin.c +++ b/server/Sample/sf_audin.c @@ -31,6 +31,7 @@ #include #define TAG SERVER_TAG("sample") +#if defined(CHANNEL_AUDIN_SERVER) /** * Function description * @@ -78,11 +79,12 @@ static UINT sf_peer_audin_receive_samples(audin_server_context* context, const A WLog_DBG(TAG, "receive %" PRIdz " frames.", nframes); return CHANNEL_RC_OK; } +#endif void sf_peer_audin_init(testPeerContext* context) { WINPR_ASSERT(context); - +#if defined(CHANNEL_AUDIN_SERVER) context->audin = audin_server_context_new(context->vcm); WINPR_ASSERT(context->audin); @@ -96,33 +98,48 @@ void sf_peer_audin_init(testPeerContext* context) context->audin->Opening = sf_peer_audin_opening; context->audin->OpenResult = sf_peer_audin_open_result; context->audin->ReceiveSamples = sf_peer_audin_receive_samples; +#endif } BOOL sf_peer_audin_start(testPeerContext* context) { +#if defined(CHANNEL_AUDIN_SERVER) if (!context || !context->audin || !context->audin->Open) return FALSE; return context->audin->Open(context->audin); +#else + return FALSE; +#endif } BOOL sf_peer_audin_stop(testPeerContext* context) { +#if defined(CHANNEL_AUDIN_SERVER) if (!context || !context->audin || !context->audin->Close) return FALSE; return context->audin->Close(context->audin); +#else + return FALSE; +#endif } BOOL sf_peer_audin_running(testPeerContext* context) { +#if defined(CHANNEL_AUDIN_SERVER) if (!context || !context->audin || !context->audin->IsOpen) return FALSE; return context->audin->IsOpen(context->audin); +#else + return FALSE; +#endif } void sf_peer_audin_uninit(testPeerContext* context) { +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context_free(context->audin); +#endif } diff --git a/server/Sample/sf_audin.h b/server/Sample/sf_audin.h index 3069bc89f..c00067d83 100644 --- a/server/Sample/sf_audin.h +++ b/server/Sample/sf_audin.h @@ -22,7 +22,6 @@ #include #include -#include #include "sfreerdp.h" diff --git a/server/Sample/sf_rdpsnd.c b/server/Sample/sf_rdpsnd.c index 55dff634b..6d4c1ecc3 100644 --- a/server/Sample/sf_rdpsnd.c +++ b/server/Sample/sf_rdpsnd.c @@ -23,8 +23,6 @@ #include -#include - #include "sf_rdpsnd.h" #include diff --git a/server/Sample/sfreerdp.h b/server/Sample/sfreerdp.h index 212556a4d..4baf09f6d 100644 --- a/server/Sample/sfreerdp.h +++ b/server/Sample/sfreerdp.h @@ -28,7 +28,9 @@ #if defined(CHANNEL_AINPUT_SERVER) #include #endif +#if defined(CHANNEL_AUDIN_SERVER) #include +#endif #include #include #include @@ -56,7 +58,9 @@ struct test_peer_context HANDLE vcm; void* debug_channel; HANDLE debug_channel_thread; +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context* audin; +#endif BOOL audin_open; #if defined(CHANNEL_AINPUT_SERVER) ainput_server_context* ainput; diff --git a/server/shadow/shadow_audin.c b/server/shadow/shadow_audin.c index a0400b1af..e78a25492 100644 --- a/server/shadow/shadow_audin.c +++ b/server/shadow/shadow_audin.c @@ -25,8 +25,13 @@ #include "shadow_audin.h" #include +#if defined(CHANNEL_AUDIN_SERVER) +#include +#endif + #define TAG SERVER_TAG("shadow") +#if defined(CHANNEL_AUDIN_SERVER) /** * Function description * @@ -92,9 +97,11 @@ static UINT AudinServerReceiveSamples(audin_server_context* context, const AUDIO return CHANNEL_RC_OK; } +#endif BOOL shadow_client_audin_init(rdpShadowClient* client) { +#if defined(CHANNEL_AUDIN_SERVER) audin_server_context* audin; audin = client->audin = audin_server_context_new(client->vcm); @@ -135,14 +142,17 @@ BOOL shadow_client_audin_init(rdpShadowClient* client) fail: audin_server_context_free(audin); client->audin = NULL; +#endif return FALSE; } void shadow_client_audin_uninit(rdpShadowClient* client) { +#if defined(CHANNEL_AUDIN_SERVER) if (client->audin) { audin_server_context_free(client->audin); client->audin = NULL; } +#endif } diff --git a/server/shadow/shadow_client.c b/server/shadow/shadow_client.c index 1dc62c931..68357616a 100644 --- a/server/shadow/shadow_client.c +++ b/server/shadow/shadow_client.c @@ -2223,6 +2223,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg) break; case DRDYNVC_STATE_READY: +#if defined(CHANNEL_AUDIN_SERVER) if (client->audin && !IFCALLRESULT(TRUE, client->audin->IsOpen, client->audin)) { if (!IFCALLRESULT(FALSE, client->audin->Open, client->audin)) @@ -2231,6 +2232,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg) goto fail; } } +#endif /* Init RDPGFX dynamic channel */ if (settings->SupportGraphicsPipeline && client->rdpgfx && !gfxstatus.gfxOpened) @@ -2341,6 +2343,7 @@ static DWORD WINAPI shadow_client_thread(LPVOID arg) fail: /* Free channels early because we establish channels in post connect */ +#if defined(CHANNEL_AUDIN_SERVER) if (client->audin && !IFCALLRESULT(TRUE, client->audin->IsOpen, client->audin)) { if (!IFCALLRESULT(FALSE, client->audin->Close, client->audin)) @@ -2348,6 +2351,7 @@ fail: WLog_WARN(TAG, "AUDIN shutdown failure!"); } } +#endif if (gfxstatus.gfxOpened) {