diff --git a/xrdp/xrdp_tconfig.c b/xrdp/xrdp_tconfig.c index 58d6d8deb..46543b81b 100644 --- a/xrdp/xrdp_tconfig.c +++ b/xrdp/xrdp_tconfig.c @@ -206,7 +206,7 @@ static int tconfig_load_gfx_order(toml_table_t *tfile, struct xrdp_tconfig_gfx * * H264/RFX support. Just loads configurations as-is. */ - TCLOG(LOG_LEVEL_DEBUG, "tconfig_load_gfx_order:"); + TCLOG(LOG_LEVEL_TRACE, "[codec]"); int h264_found = 0; int rfx_found = 0; @@ -215,61 +215,52 @@ static int tconfig_load_gfx_order(toml_table_t *tfile, struct xrdp_tconfig_gfx * config->codec.rfx_idx = -1; toml_table_t *codec = toml_table_in(tfile, "codec"); - if (!codec) - { - goto return_default_codec_order; - } - toml_array_t *order = toml_array_in(codec, "order"); - if (!order) - { - goto return_default_codec_order; - } - for (int i = 0; ; i++) + if (codec && order) { - toml_datum_t datum = toml_string_at(order, i); - - if (datum.ok) + for (int i = 0; ; i++) { - if (g_strcasecmp(datum.u.s, "h264") == 0 || - g_strcasecmp(datum.u.s, "h.264") == 0) + toml_datum_t datum = toml_string_at(order, i); + + if (datum.ok) { - h264_found = 1; - config->codec.h264_idx = i; + if (g_strcasecmp(datum.u.s, "h264") == 0 || + g_strcasecmp(datum.u.s, "h.264") == 0) + { + h264_found = 1; + config->codec.h264_idx = i; + } + if (g_strcasecmp(datum.u.s, "rfx") == 0) + { + rfx_found = 1; + config->codec.rfx_idx = i; + } + free(datum.u.s); } - if (g_strcasecmp(datum.u.s, "rfx") == 0) + else { - rfx_found = 1; - config->codec.rfx_idx = i; + break; } - free(datum.u.s); - } - else - { - break; } } if (h264_found == 0 && rfx_found == 0) { - goto return_default_codec_order; - } + /* prefer H264 if no priority found */ + config->codec.h264_idx = 0; + config->codec.rfx_idx = 1; - TCLOG(LOG_LEVEL_DEBUG, "codec_order: h264_idx=%d, rfx_idx=%d", - config->codec.h264_idx, config->codec.rfx_idx); - return 0; + TCLOG(LOG_LEVEL_WARNING, "[codec] could not get GFX codec order, using default order" + " h264_idx [%d], rfx_idx [%d]", + config->codec.h264_idx, config->codec.rfx_idx); -return_default_codec_order: - /* prefer H264 if no priority found */ - config->codec.h264_idx = 0; - config->codec.rfx_idx = 1; + return 1; + } - TCLOG(LOG_LEVEL_ERROR, "coder_order: could not get codec order, using default order" - "h264_idx=%d, rfx_idx=%d", + TCLOG(LOG_LEVEL_DEBUG, "[codec] h264_idx [%d], rfx_idx [%d]", config->codec.h264_idx, config->codec.rfx_idx); - - return 1; + return 0; } int