Allow freerdp clients to function with WITH_OPENH264_LOADING

If no library can be loaded at runtime ignore H264 capabilities.
This allows a build with only OpenH264 support and dynamic loading
enabled to function when no openh264 library was detected.
This commit is contained in:
Armin Novak 2019-10-07 09:31:20 +02:00
parent ade6b1007b
commit 441fb4d0ca
4 changed files with 27 additions and 3 deletions

View File

@ -875,7 +875,7 @@ find_feature(soxr ${SOXR_FEATURE_TYPE} ${SOXR_FEATURE_PURPOSE} ${SOXR_FEATURE_DE
find_feature(GSSAPI ${GSSAPI_FEATURE_TYPE} ${GSSAPI_FEATURE_PURPOSE} ${GSSAPI_FEATURE_DESCRIPTION})
if (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
set(WITH_OPENH264_LOADING OFF)
option(WITH_OPENH264_LOADING "Use LoadLibrary to load openh264 at runtime" OFF)
endif (WITH_OPENH264 AND NOT WITH_OPENH264_LOADING)
if ((WITH_FFMPEG OR WITH_DSP_FFMPEG) AND NOT FFMPEG_FOUND)

View File

@ -94,7 +94,9 @@ BOOL freerdp_client_codecs_prepare(rdpCodecs* codecs, UINT32 flags,
if (!(codecs->h264 = h264_context_new(FALSE)))
{
WLog_ERR(TAG, "Failed to create h264 codec context");
#ifndef WITH_OPENH264_LOADING
return FALSE;
#endif
}
}
#endif

View File

@ -184,8 +184,23 @@ static BOOL rdp_client_reset_codecs(rdpContext* context)
if (!context->codecs)
return FALSE;
return freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
settings->DesktopWidth, settings->DesktopHeight);
if (!freerdp_client_codecs_prepare(context->codecs, FREERDP_CODEC_ALL,
settings->DesktopWidth, settings->DesktopHeight))
return FALSE;
/* Runtime H264 detection. (only available if dynamic backend loading is defined)
* If no backend is available disable it before the channel is loaded.
*/
#if defined(WITH_GFX_H264) && defined(WITH_OPENH264_LOADING)
if (!context->codecs->h264)
{
settings->GfxH264 = FALSE;
settings->GfxAVC444 = FALSE;
settings->GfxAVC444v2 = FALSE;
}
#endif
return TRUE;
}
/**

View File

@ -459,6 +459,7 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
gdiGfxSurface* surface;
RDPGFX_H264_METABLOCK* meta;
RDPGFX_AVC420_BITMAP_STREAM* bs;
surface = (gdiGfxSurface*) context->GetSurfaceData(context, cmd->surfaceId);
if (!surface)
@ -482,6 +483,9 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
return ERROR_INTERNAL_ERROR;
}
if (!surface->h264)
return ERROR_NOT_SUPPORTED;
bs = (RDPGFX_AVC420_BITMAP_STREAM*) cmd->extra;
if (!bs)
@ -566,6 +570,9 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
return ERROR_INTERNAL_ERROR;
}
if (!surface->h264)
return ERROR_NOT_SUPPORTED;
bs = (RDPGFX_AVC444_BITMAP_STREAM*) cmd->extra;
if (!bs)