Disable GFX H264 if no backend compiled in.

This commit is contained in:
Armin Novak 2017-07-17 09:00:57 +02:00
parent f580bea738
commit 5764d5a78a
10 changed files with 89 additions and 34 deletions

View File

@ -87,26 +87,29 @@ static UINT rdpgfx_send_caps_advertise_pdu(RDPGFX_CHANNEL_CALLBACK* callback)
if (gfx->SmallCache) if (gfx->SmallCache)
capsSet->flags |= RDPGFX_CAPS_FLAG_SMALL_CACHE; capsSet->flags |= RDPGFX_CAPS_FLAG_SMALL_CACHE;
#ifdef WITH_GFX_H264
if (gfx->H264) if (gfx->H264)
capsSet->flags |= RDPGFX_CAPS_FLAG_AVC420_ENABLED; capsSet->flags |= RDPGFX_CAPS_FLAG_AVC420_ENABLED;
#endif
if (gfx->AVC444) capsSet = &capsSets[pdu.capsSetCount++];
{ capsSet->version = RDPGFX_CAPVERSION_10;
capsSet = &capsSets[pdu.capsSetCount++]; capsSet->flags = 0;
capsSet->version = RDPGFX_CAPVERSION_10;
capsSet->flags = 0;
if (gfx->SmallCache) if (gfx->SmallCache)
capsSet->flags |= RDPGFX_CAPS_FLAG_SMALL_CACHE; capsSet->flags |= RDPGFX_CAPS_FLAG_SMALL_CACHE;
if (!gfx->H264) #ifdef WITH_GFX_H264
capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED; if (!gfx->AVC444)
capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED;
#else
capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED;
#endif
capsSets[pdu.capsSetCount] = *capsSet; capsSets[pdu.capsSetCount] = *capsSet;
capsSets[pdu.capsSetCount++].version = RDPGFX_CAPVERSION_102; capsSets[pdu.capsSetCount++].version = RDPGFX_CAPVERSION_102;
capsSets[pdu.capsSetCount] = *capsSet; capsSets[pdu.capsSetCount] = *capsSet;
capsSets[pdu.capsSetCount++].version = RDPGFX_CAPVERSION_103; capsSets[pdu.capsSetCount++].version = RDPGFX_CAPVERSION_103;
}
header.pduLength = RDPGFX_HEADER_SIZE + 2 + (pdu.capsSetCount * header.pduLength = RDPGFX_HEADER_SIZE + 2 + (pdu.capsSetCount *
RDPGFX_CAPSET_SIZE); RDPGFX_CAPSET_SIZE);

View File

@ -121,11 +121,17 @@ static COMMAND_LINE_ARGUMENT_A args[] =
{ "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable themes" }, { "themes", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable themes" },
{ "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable wallpaper" }, { "wallpaper", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueTrue, NULL, -1, NULL, "Enable wallpaper" },
{ "gdi", COMMAND_LINE_VALUE_REQUIRED, "<sw|hw>", NULL, NULL, -1, NULL, "GDI rendering" }, { "gdi", COMMAND_LINE_VALUE_REQUIRED, "<sw|hw>", NULL, NULL, -1, NULL, "GDI rendering" },
#ifdef WITH_GFX_H264
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "<RFX|AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" }, { "gfx", COMMAND_LINE_VALUE_OPTIONAL, "<RFX|AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" },
#else
{ "gfx", COMMAND_LINE_VALUE_OPTIONAL, "<RFX>", NULL, NULL, -1, NULL, "RDP8 graphics pipeline (experimental)" },
#endif
{ "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using thin client mode" }, { "gfx-thin-client", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using thin client mode" },
{ "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using small cache mode" }, { "gfx-small-cache", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using small cache mode" },
{ "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using progressive codec" }, { "gfx-progressive", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "RDP8 graphics pipeline using progressive codec" },
#ifdef WITH_GFX_H264
{ "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "<AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline using H264 codec" }, { "gfx-h264", COMMAND_LINE_VALUE_OPTIONAL, "<AVC420|AVC444>", NULL, NULL, -1, NULL, "RDP8.1 graphics pipeline using H264 codec" },
#endif
{ "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" }, { "rfx", COMMAND_LINE_VALUE_FLAG, NULL, NULL, NULL, -1, NULL, "RemoteFX" },
{ "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "<image|video>", NULL, NULL, -1, NULL, "RemoteFX mode" }, { "rfx-mode", COMMAND_LINE_VALUE_REQUIRED, "<image|video>", NULL, NULL, -1, NULL, "RemoteFX mode" },
{ "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Number of frame acknowledgement" }, { "frame-ack", COMMAND_LINE_VALUE_REQUIRED, "<number>", NULL, NULL, -1, NULL, "Number of frame acknowledgement" },
@ -2085,6 +2091,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
if (arg->Value) if (arg->Value)
{ {
#ifdef WITH_GFX_H264
if (_strnicmp("AVC444", arg->Value, 6) == 0) if (_strnicmp("AVC444", arg->Value, 6) == 0)
{ {
settings->GfxH264 = TRUE; settings->GfxH264 = TRUE;
@ -2094,7 +2101,9 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
{ {
settings->GfxH264 = TRUE; settings->GfxH264 = TRUE;
} }
else if (_strnicmp("RFX", arg->Value, 3) != 0) else
#endif
if (_strnicmp("RFX", arg->Value, 3) != 0)
return COMMAND_LINE_ERROR; return COMMAND_LINE_ERROR;
} }
} }
@ -2114,6 +2123,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
settings->GfxThinClient = settings->GfxProgressive ? FALSE : TRUE; settings->GfxThinClient = settings->GfxProgressive ? FALSE : TRUE;
settings->SupportGraphicsPipeline = TRUE; settings->SupportGraphicsPipeline = TRUE;
} }
#ifdef WITH_GFX_H264
CommandLineSwitchCase(arg, "gfx-h264") CommandLineSwitchCase(arg, "gfx-h264")
{ {
settings->SupportGraphicsPipeline = TRUE; settings->SupportGraphicsPipeline = TRUE;
@ -2129,6 +2139,7 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
return COMMAND_LINE_ERROR; return COMMAND_LINE_ERROR;
} }
} }
#endif
CommandLineSwitchCase(arg, "rfx") CommandLineSwitchCase(arg, "rfx")
{ {
settings->RemoteFxCodec = TRUE; settings->RemoteFxCodec = TRUE;

View File

@ -41,13 +41,15 @@ if(CMAKE_C_COMPILER_ID MATCHES "Clang" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_COMPILER_IS_CLANG 1) set(CMAKE_COMPILER_IS_CLANG 1)
endif() endif()
option(WITH_GFX_H264 "Build GFX H264 support. A backend (OpenH264|FFMPEG|X264|MediaFoundation) must also be compiled in." OFF)
if(NOT WIN32) if(NOT WIN32)
CMAKE_DEPENDENT_OPTION(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF "NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_LEAK" OFF) CMAKE_DEPENDENT_OPTION(WITH_VALGRIND_MEMCHECK "Compile with valgrind helpers." OFF "NOT WITH_SANITIZE_ADDRESS; NOT WITH_SANITIZE_LEAK" OFF)
CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_ADDRESS "Compile with gcc/clang address sanitizer." OFF "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_LEAK" OFF) CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_ADDRESS "Compile with gcc/clang address sanitizer." OFF "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_LEAK" OFF)
CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_LEAK "Compile with gcc/clang leak sanitizer." OFF "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS" OFF) CMAKE_DEPENDENT_OPTION(WITH_SANITIZE_LEAK "Compile with gcc/clang leak sanitizer." OFF "NOT WITH_VALGRIND_MEMCHECK; NOT WITH_SANITIZE_ADDRESS" OFF)
else() else()
if(NOT UWP) if(NOT UWP)
option(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." ON) CMAKE_DEPENDENT_OPTION(WITH_MEDIA_FOUNDATION "Enable H264 media foundation decoder." ON
"WITH_GFX_H264" OFF)
endif() endif()
endif() endif()
@ -138,3 +140,4 @@ endif(ANDROID)
if(IOS) if(IOS)
include(ConfigOptionsiOS) include(ConfigOptionsiOS)
endif(IOS) endif(IOS)

View File

@ -37,7 +37,6 @@
#cmakedefine WITH_EVENTFD_READ_WRITE #cmakedefine WITH_EVENTFD_READ_WRITE
#cmakedefine HAVE_MATH_C99_LONG_DOUBLE #cmakedefine HAVE_MATH_C99_LONG_DOUBLE
#cmakedefine WITH_FFMPEG
#cmakedefine WITH_GSTREAMER_1_0 #cmakedefine WITH_GSTREAMER_1_0
#cmakedefine WITH_GSTREAMER_0_10 #cmakedefine WITH_GSTREAMER_0_10
#cmakedefine WITH_WINMM #cmakedefine WITH_WINMM
@ -48,6 +47,10 @@
#cmakedefine WITH_IOSAUDIO #cmakedefine WITH_IOSAUDIO
#cmakedefine WITH_OPENSLES #cmakedefine WITH_OPENSLES
#cmakedefine WITH_GSM #cmakedefine WITH_GSM
#cmakedefine WITH_GFX_H264
#cmakedefine WITH_OPENH264
#cmakedefine WITH_FFMPEG
#cmakedefine WITH_X264
#cmakedefine WITH_MEDIA_FOUNDATION #cmakedefine WITH_MEDIA_FOUNDATION
/* Plugins */ /* Plugins */

View File

@ -105,10 +105,10 @@ struct _RDPGFX_CAPSET
}; };
typedef struct _RDPGFX_CAPSET RDPGFX_CAPSET; typedef struct _RDPGFX_CAPSET RDPGFX_CAPSET;
#define RDPGFX_CAPS_FLAG_THINCLIENT 0x00000001 /* 8.0+ */ #define RDPGFX_CAPS_FLAG_THINCLIENT 0x00000001U /* 8.0+ */
#define RDPGFX_CAPS_FLAG_SMALL_CACHE 0x00000002 /* 8.0+ */ #define RDPGFX_CAPS_FLAG_SMALL_CACHE 0x00000002U /* 8.0+ */
#define RDPGFX_CAPS_FLAG_AVC420_ENABLED 0x00000010 /* 8.1+ */ #define RDPGFX_CAPS_FLAG_AVC420_ENABLED 0x00000010U /* 8.1+ */
#define RDPGFX_CAPS_FLAG_AVC_DISABLED 0x00000020 /* 10.0+ */ #define RDPGFX_CAPS_FLAG_AVC_DISABLED 0x00000020U /* 10.0+ */
struct _RDPGFX_CAPSET_VERSION8 struct _RDPGFX_CAPSET_VERSION8
{ {

View File

@ -166,21 +166,18 @@ endif()
if(WITH_X264) if(WITH_X264)
set(CODEC_SRCS ${CODEC_SRCS} codec/h264_x264.c) set(CODEC_SRCS ${CODEC_SRCS} codec/h264_x264.c)
freerdp_definition_add(-DWITH_X264)
freerdp_include_directory_add(${X264_INCLUDE_DIR}) freerdp_include_directory_add(${X264_INCLUDE_DIR})
freerdp_library_add(${X264_LIBRARIES}) freerdp_library_add(${X264_LIBRARIES})
endif() endif()
if(WITH_OPENH264) if(WITH_OPENH264)
set(CODEC_SRCS ${CODEC_SRCS} codec/h264_openh264.c) set(CODEC_SRCS ${CODEC_SRCS} codec/h264_openh264.c)
freerdp_definition_add(-DWITH_OPENH264)
freerdp_include_directory_add(${OPENH264_INCLUDE_DIR}) freerdp_include_directory_add(${OPENH264_INCLUDE_DIR})
freerdp_library_add(${OPENH264_LIBRARIES}) freerdp_library_add(${OPENH264_LIBRARIES})
endif() endif()
if(WITH_FFMPEG) if(WITH_FFMPEG)
set(CODEC_SRCS ${CODEC_SRCS} codec/h264_ffmpeg.c) set(CODEC_SRCS ${CODEC_SRCS} codec/h264_ffmpeg.c)
freerdp_definition_add(-DWITH_LIBAVCODEC)
freerdp_include_directory_add(${FFMPEG_INCLUDE_DIRS}) freerdp_include_directory_add(${FFMPEG_INCLUDE_DIRS})
freerdp_library_add(${FFMPEG_LIBRARIES}) freerdp_library_add(${FFMPEG_LIBRARIES})
endif() endif()

View File

@ -457,7 +457,7 @@ static BOOL CALLBACK h264_register_subsystems(PINIT_ONCE once, PVOID param, PVOI
i++; i++;
#endif #endif
#ifdef WITH_LIBAVCODEC #ifdef WITH_FFMPEG
extern H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec; extern H264_CONTEXT_SUBSYSTEM g_Subsystem_libavcodec;
subSystems[i] = &g_Subsystem_libavcodec; subSystems[i] = &g_Subsystem_libavcodec;
i++; i++;

View File

@ -26,6 +26,8 @@
#define TAG FREERDP_TAG("codec") #define TAG FREERDP_TAG("codec")
#warning "FFMPEG does not support H264 encoding (GFX H264 server mode). Please review your configuration!"
/* Fallback support for older libavcodec versions */ /* Fallback support for older libavcodec versions */
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 59, 100)
#define AV_CODEC_ID_H264 CODEC_ID_H264 #define AV_CODEC_ID_H264 CODEC_ID_H264

View File

@ -38,6 +38,8 @@
#include <x264.h> #include <x264.h>
#include <freerdp/codec/h264.h> #include <freerdp/codec/h264.h>
#error "X264 backend not implemented, please review your configuration!"
struct _H264_CONTEXT_X264 struct _H264_CONTEXT_X264
{ {
void* dummy; void* dummy;

View File

@ -621,7 +621,6 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise) RDPGFX_CAPS_ADVERTISE_PDU* capsAdvertise)
{ {
UINT16 index; UINT16 index;
RDPGFX_CAPS_CONFIRM_PDU pdu;
rdpSettings* settings = context->rdpcontext->settings; rdpSettings* settings = context->rdpcontext->settings;
UINT32 flags = 0; UINT32 flags = 0;
/* Request full screen update for new gfx channel */ /* Request full screen update for new gfx channel */
@ -629,15 +628,24 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
for (index = 0; index < capsAdvertise->capsSetCount; index++) for (index = 0; index < capsAdvertise->capsSetCount; index++)
{ {
pdu.capsSet = &(capsAdvertise->capsSets[index]); const RDPGFX_CAPSET* currentCaps = &capsAdvertise->capsSets[index];
if (pdu.capsSet->version == RDPGFX_CAPVERSION_102) if (currentCaps->version == RDPGFX_CAPVERSION_102)
{ {
RDPGFX_CAPSET caps = *currentCaps;
RDPGFX_CAPS_CONFIRM_PDU pdu;
pdu.capsSet = &caps;
if (settings) if (settings)
{ {
flags = pdu.capsSet->flags; flags = pdu.capsSet->flags;
settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE); settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE);
#ifndef WITH_GFX_H264
settings->GfxH264 = FALSE;
pdu.capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED;
#else
settings->GfxH264 = !(flags & RDPGFX_CAPS_FLAG_AVC_DISABLED); settings->GfxH264 = !(flags & RDPGFX_CAPS_FLAG_AVC_DISABLED);
#endif
} }
return context->CapsConfirm(context, &pdu); return context->CapsConfirm(context, &pdu);
@ -646,15 +654,24 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
for (index = 0; index < capsAdvertise->capsSetCount; index++) for (index = 0; index < capsAdvertise->capsSetCount; index++)
{ {
pdu.capsSet = &(capsAdvertise->capsSets[index]); const RDPGFX_CAPSET* currentCaps = &capsAdvertise->capsSets[index];
if (pdu.capsSet->version == RDPGFX_CAPVERSION_10) if (currentCaps->version == RDPGFX_CAPVERSION_10)
{ {
RDPGFX_CAPSET caps = *currentCaps;
RDPGFX_CAPS_CONFIRM_PDU pdu;
pdu.capsSet = &caps;
if (settings) if (settings)
{ {
flags = pdu.capsSet->flags; flags = pdu.capsSet->flags;
settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE); settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE);
#ifndef WITH_GFX_H264
settings->GfxH264 = FALSE;
pdu.capsSet->flags |= RDPGFX_CAPS_FLAG_AVC_DISABLED;
#else
settings->GfxH264 = !(flags & RDPGFX_CAPS_FLAG_AVC_DISABLED); settings->GfxH264 = !(flags & RDPGFX_CAPS_FLAG_AVC_DISABLED);
#endif
} }
return context->CapsConfirm(context, &pdu); return context->CapsConfirm(context, &pdu);
@ -663,14 +680,25 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
for (index = 0; index < capsAdvertise->capsSetCount; index++) for (index = 0; index < capsAdvertise->capsSetCount; index++)
{ {
if (pdu.capsSet->version == RDPGFX_CAPVERSION_81) const RDPGFX_CAPSET* currentCaps = &capsAdvertise->capsSets[index];
{
if (currentCaps->version == RDPGFX_CAPVERSION_81)
{
RDPGFX_CAPSET caps = *currentCaps;
RDPGFX_CAPS_CONFIRM_PDU pdu;
pdu.capsSet = &caps;
if (settings) if (settings)
{ {
flags = pdu.capsSet->flags; flags = pdu.capsSet->flags;
settings->GfxThinClient = (flags & RDPGFX_CAPS_FLAG_THINCLIENT); settings->GfxThinClient = (flags & RDPGFX_CAPS_FLAG_THINCLIENT);
settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE); settings->GfxSmallCache = (flags & RDPGFX_CAPS_FLAG_SMALL_CACHE);
#ifndef WITH_GFX_H264
settings->GfxH264 = FALSE;
pdu.capsSet->flags &= ~RDPGFX_CAPS_FLAG_AVC420_ENABLED;
#else
settings->GfxH264 = (flags & RDPGFX_CAPS_FLAG_AVC420_ENABLED); settings->GfxH264 = (flags & RDPGFX_CAPS_FLAG_AVC420_ENABLED);
#endif
} }
return context->CapsConfirm(context, &pdu); return context->CapsConfirm(context, &pdu);
@ -679,8 +707,14 @@ static UINT shadow_client_rdpgfx_caps_advertise(RdpgfxServerContext* context,
for (index = 0; index < capsAdvertise->capsSetCount; index++) for (index = 0; index < capsAdvertise->capsSetCount; index++)
{ {
if (pdu.capsSet->version == RDPGFX_CAPVERSION_8) const RDPGFX_CAPSET* currentCaps = &capsAdvertise->capsSets[index];
if (currentCaps->version == RDPGFX_CAPVERSION_8)
{ {
RDPGFX_CAPSET caps = *currentCaps;
RDPGFX_CAPS_CONFIRM_PDU pdu;
pdu.capsSet = &caps;
if (settings) if (settings)
{ {
flags = pdu.capsSet->flags; flags = pdu.capsSet->flags;