3.1.8.3.1 Encode Message Sequencing

An encoded RemoteFX stream is composed of a sequence of encode messages that are described in section 2.2.2. The sequence of encode messages is encapsulated inside an Extended Bitmap Data structure ([MS-RDPBCGR] section 2.2.9.2.1.1), which is encapsulated in a Stream Surface Bits Surface Command ([MS-RDPBCGR] section 2.2.9.2.2).

All encode messages start with a TS_RFX_BLOCKT (section 2.2.2.1.1) structure. When parsing the message blocks, the blockLen field of a TS_RFX_BLOCKT MUST be used to obtain the length of the data block. This length MUST NOT be less than the length based on the blockType field of the TS_RFX_BLOCKT.

The RemoteFX stream is structured as a set of header messages followed by encoded data messages. The header messages contain global information necessary to decompress the data messages. The header messages are described in section 2.2.2.2, and the data messages are described in section 2.2.2.3. The stream MUST start with the header messages and any of these headers can appear in the stream at a later stage. The header messages can be repeated.

Message sequencing in the RemoteFX stream

Figure 16: Message sequencing in the RemoteFX stream

The first message in a RemoteFX stream MUST be the TS_RFX_SYNC (section 2.2.2.2.1) message. This message MUST be followed by the TS_RFX_CHANNELS (section 2.2.2.2.3), TS_RFX_CODEC_VERSIONS (section 2.2.2.2.2), and TS_RFX_CONTEXT (section 2.2.2.2.4) messages, as shown in the figure that follows. It is permissible for these three messages to occur in any order. These three messages contain all of the information needed to initialize the decoder.

Generation of RemoteFX encode header messages

Figure 17: Generation of RemoteFX encode header messages

The TS_RFX_CHANNELS message MUST contain a single channel, and the frame dimensions of this channel are given by the width and height fields of the corresponding TS_RFX_CHANNELT structure (section 2.2.2.1.3). The decoder MUST check the TS_RFX_CODEC_VERSIONS and TS_RFX_CONTEXT messages to determine whether it is compatible with the RemoteFX codec version and the encoding properties listed in these messages. If the decoder cannot support the codec version, the channel frame dimensions, or any of the listed encoding properties, it MUST reject the encoded stream.

The data associated with each encoded frame or image is always bracketed by the TS_RFX_FRAME_BEGIN (section 2.2.2.3.1) and TS_RFX_FRAME_END (section 2.2.2.3.2) messages. The sequence of blocks that comprise a frame are described in the figure that follows. There MUST only be one TS_RFX_REGION (section 2.2.2.3.3) message per frame and one TS_RFX_TILESET (section 2.2.2.3.4) message per TS_RFX_REGION. All of the messages corresponding to a frame associated with a given channel MUST occur consecutively within the codec byte-stream. The messages corresponding to frames from two different channels MUST NOT be interleaved.

Generation of RemoteFX encode data messages

Figure 18: Generation of RemoteFX encode data messages