Merge pull request #1786 from nfedera/fix-2014-04-10-02

core/server: only enable activated bitmap codecs
This commit is contained in:
Marc-André Moreau 2014-04-10 13:26:47 -04:00
commit 7932bf4490
1 changed files with 12 additions and 9 deletions

View File

@ -2590,6 +2590,8 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
BYTE bitmapCodecCount;
UINT16 codecPropertiesLength;
UINT16 remainingLength;
BOOL receivedRemoteFxCodec = FALSE;
BOOL receivedNSCodec = FALSE;
if (length < 5)
return FALSE;
@ -2597,13 +2599,6 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
Stream_Read_UINT8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */
remainingLength = length - 5;
if (settings->ServerMode)
{
settings->RemoteFxCodec = FALSE;
settings->NSCodec = FALSE;
settings->JpegCodec = FALSE;
}
while (bitmapCodecCount > 0)
{
if (remainingLength < 19)
@ -2616,12 +2611,12 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
if (UuidEqual(&codecGuid, &CODEC_GUID_REMOTEFX, &rpc_status))
{
Stream_Read_UINT8(s, settings->RemoteFxCodecId);
settings->RemoteFxCodec = TRUE;
receivedRemoteFxCodec = TRUE;
}
else if (UuidEqual(&codecGuid, &CODEC_GUID_NSCODEC, &rpc_status))
{
Stream_Read_UINT8(s, settings->NSCodecId);
settings->NSCodec = TRUE;
receivedNSCodec = TRUE;
}
else
{
@ -2660,6 +2655,14 @@ BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSetting
bitmapCodecCount--;
}
if (settings->ServerMode)
{
/* only enable a codec if we've announced/enabled it before */
settings->RemoteFxCodec = settings->RemoteFxCodec && receivedRemoteFxCodec;
settings->NSCodec = settings->NSCodec && receivedNSCodec;
settings->JpegCodec = FALSE;
}
return TRUE;
}