3.2.5.7 Receiving a SelectStream Request
The server MUST first follow the steps specified in section 3.2.5.1.
The server MUST process the stream selection information specified on the stream-switch-entry (section 2.2.1.4.27) token on the Pragma header, if any. Any new streams that are transmitted as a result of the stream-switch-entry token MUST be transmitted beginning with an ASF key-frame payload. Any streams that are replaced by different streams MUST continue to be transmitted until the first ASF key-frame payload of the new stream is transmitted. How to determine if an ASF payload contains a key-frame is as specified in [ASF] section 5.
If the value of the Session-State variable is WAITING, and the value of the KeepAlive-Mode variable specifies that the non-pipelined mode of the protocol is used, then the State variable MUST be set to STREAMING and the server MUST start sending $D (Data) packets on the TCP connection that is identified by the value of the Data-Connection variable .
The server MUST store the current local time in the SelectStream-Time variable in the Abstract Data Model (section 3.2.1).
If the value of the Session-State variable is STREAMING and the value of the KeepAlive-Mode variable specifies that the pipelined mode of the protocol is used then the server MUST send a zero-length chunk.
If the Pending-Responses variable is not an empty list, then the server MUST send all of the responses stored in the Pending-Responses variable. The responses MUST be sent by removing the element at the head of the list in the Pending-Responses variable, sending it, and then repeating this until Pending-Responses is an empty list.
The SelectStream response MUST follow the rules in sections 3.2.5.2 and 2.2.2.8.
If the value of the State variable is STREAMING and the value of the Request-Connection variable is equal to the value of the Data-Connection variable and if the value of the KeepAlive-Mode variable specifies that the pipelined mode of the protocol is used, the SelectStream response SHOULD use Chunked Transfer Coding.
If the value of the State variable is STREAMING and the value of the Request-Connection variable is equal to the value of the Data-Connection variable, then the server MUST continue sending $D packets after sending the SelectStream response.