[server,shadow] Fix RFX SurfaceBitsCommands

* Use RLGR mode from settings (might be overwritten by client)
* Only send RFX SurfaceBits if SURFCMDS_STREAM_SURFACE_BITS was set in
  capabilities
This commit is contained in:
Armin Novak 2024-07-24 13:18:30 +02:00 committed by akallabeth
parent 557844277f
commit d757dfee24
No known key found for this signature in database
GPG Key ID: A49454A3FC909FD5
5 changed files with 15 additions and 9 deletions

View File

@ -160,7 +160,7 @@ extern "C"
RECTANGLE_16 subRect;
/* Codec settings */
RLGR_MODE rfxMode;
RLGR_MODE rfxMode; /* unused */
H264_RATECONTROL_MODE h264RateControlMode;
UINT32 h264BitRate;
UINT32 h264FrameRate;

View File

@ -129,6 +129,8 @@ int main(int argc, char** argv)
if (!freerdp_settings_set_uint32(settings, FreeRDP_ColorDepth, 32) ||
!freerdp_settings_set_bool(settings, FreeRDP_NSCodec, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxImageCodec, TRUE) ||
!freerdp_settings_set_uint32(settings, FreeRDP_RemoteFxRlgrMode, RLGR3) ||
!freerdp_settings_set_bool(settings, FreeRDP_GfxH264, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444, TRUE) ||
!freerdp_settings_set_bool(settings, FreeRDP_GfxAVC444v2, TRUE) ||

View File

@ -215,6 +215,10 @@ static BOOL shadow_client_context_new(freerdp_peer* peer, rdpContext* context)
if (!freerdp_settings_set_bool(settings, FreeRDP_RemoteFxCodec,
freerdp_settings_get_bool(srvSettings, FreeRDP_RemoteFxCodec)))
return FALSE;
if (!freerdp_settings_set_uint32(
settings, FreeRDP_RemoteFxRlgrMode,
freerdp_settings_get_uint32(srvSettings, FreeRDP_RemoteFxRlgrMode)))
return FALSE;
if (!freerdp_settings_set_bool(settings, FreeRDP_BitmapCacheV3Enabled, TRUE))
return FALSE;
if (!freerdp_settings_set_bool(settings, FreeRDP_FrameMarkerCommandEnabled, TRUE))
@ -1377,8 +1381,6 @@ static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcD
rdpSettings* settings = NULL;
rdpShadowEncoder* encoder = NULL;
SURFACE_BITS_COMMAND cmd = { 0 };
UINT32 nsID = 0;
UINT32 rfxID = 0;
if (!context || !pSrcData)
return FALSE;
@ -1393,8 +1395,9 @@ static BOOL shadow_client_send_surface_bits(rdpShadowClient* client, BYTE* pSrcD
if (encoder->frameAck)
frameId = shadow_encoder_create_frame_id(encoder);
nsID = freerdp_settings_get_uint32(settings, FreeRDP_NSCodecId);
rfxID = freerdp_settings_get_uint32(settings, FreeRDP_RemoteFxCodecId);
// TODO: Check FreeRDP_RemoteFxCodecMode if we should send RFX IMAGE or VIDEO data
const UINT32 nsID = freerdp_settings_get_uint32(settings, FreeRDP_NSCodecId);
const UINT32 rfxID = freerdp_settings_get_uint32(settings, FreeRDP_RemoteFxCodecId);
if (freerdp_settings_get_bool(settings, FreeRDP_RemoteFxCodec) && (rfxID != 0))
{
RFX_RECT rect = { 0 };
@ -1868,8 +1871,9 @@ static BOOL shadow_client_send_surface_update(rdpShadowClient* client, SHADOW_GF
ret = TRUE;
}
}
else if (freerdp_settings_get_bool(settings, FreeRDP_RemoteFxCodec) ||
freerdp_settings_get_bool(settings, FreeRDP_NSCodec))
else if (freerdp_settings_get_bool(settings, FreeRDP_SurfaceCommandsEnabled) &&
(freerdp_settings_get_bool(settings, FreeRDP_RemoteFxCodec) ||
freerdp_settings_get_bool(settings, FreeRDP_NSCodec)))
{
WINPR_ASSERT(nXSrc >= 0);
WINPR_ASSERT(nXSrc <= UINT16_MAX);

View File

@ -140,7 +140,8 @@ static int shadow_encoder_init_rfx(rdpShadowEncoder* encoder)
if (!rfx_context_reset(encoder->rfx, encoder->width, encoder->height))
goto fail;
rfx_context_set_mode(encoder->rfx, encoder->server->rfxMode);
rfx_context_set_mode(encoder->rfx, freerdp_settings_get_uint32(encoder->server->settings,
FreeRDP_RemoteFxRlgrMode));
rfx_context_set_pixel_format(encoder->rfx, PIXEL_FORMAT_BGRX32);
encoder->codecs |= FREERDP_CODEC_REMOTEFX;
return 1;

View File

@ -980,7 +980,6 @@ rdpShadowServer* shadow_server_new(void)
server->port = 3389;
server->mayView = TRUE;
server->mayInteract = TRUE;
server->rfxMode = RLGR3;
server->h264RateControlMode = H264_RATECONTROL_VBR;
server->h264BitRate = 10000000;
server->h264FrameRate = 30;