rdpsnd server: add support for clients version < 6

MS-RDPEA 2.2.2.3 states (Appendix A <6>) that quality mode PDU
should be ignored if the client version is < 6. For these clients the sound
channel got never activated since activated was only called after
reception of the quality mode PDU.

For clients < version 6 activated is now called after
CLIENT_AUDIO_VERSION_AND_FORMATS was received.
This commit is contained in:
Bernhard Miklautz 2014-09-11 11:33:10 +02:00
parent c3f49c307b
commit bbaecbd42d
2 changed files with 12 additions and 5 deletions

View File

@ -118,7 +118,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
{
int i, num_known_format = 0;
UINT32 flags, vol, pitch;
UINT16 udpPort, version;
UINT16 udpPort;
BYTE lastblock;
if (Stream_GetRemainingLength(s) < 20)
@ -130,7 +130,7 @@ static BOOL rdpsnd_server_recv_formats(RdpsndServerContext* context, wStream* s)
Stream_Read_UINT16(s, udpPort); /* wDGramPort */
Stream_Read_UINT16(s, context->num_client_formats); /* wNumberOfFormats */
Stream_Read_UINT8(s, lastblock); /* cLastBlockConfirmed */
Stream_Read_UINT16(s, version); /* wVersion */
Stream_Read_UINT16(s, context->clientVersion); /* wVersion */
Stream_Seek_UINT8(s); /* bPad */
/* this check is only a guess as cbSize can influence the size of a format record */
@ -674,16 +674,18 @@ BOOL rdpsnd_server_handle_messages(RdpsndServerContext *context)
case SNDC_FORMATS:
ret = rdpsnd_server_recv_formats(context, s);
if (ret && context->clientVersion < 6)
IFCALL(context->Activated, context);
break;
case SNDC_QUALITYMODE:
ret = rdpsnd_server_recv_quality_mode(context, s);
Stream_SetPosition(s, 0); /* in case the Activated callback tries to treat some messages */
if (ret)
{
if (ret && context->clientVersion >= 6)
IFCALL(context->Activated, context);
}
break;
default:

View File

@ -105,6 +105,11 @@ struct _rdpsnd_server_context
* synchronization.
*/
psRdpsndServerActivated Activated;
/**
* MS-RDPEA channel version the client announces
*/
UINT16 clientVersion;
};
#ifdef __cplusplus