-
Notifications
You must be signed in to change notification settings - Fork 1
Implementing Custom Protocols
While Streaming SDK provides an implementation of a robust transport protocol which can transfer data over a UDP or a TCP stream, in some cases you might want to use another protocol, either a standard, such as RTP/RTCP or proprietary. Whatever your reasons for using a different protocol might be, Streaming SDK is designed in a way which makes protocol replacement a relatively easy exercise.
The transport protocol implementation is abstracted with two interfaces defined in sdk/transports/transport-common/ServerTransport.h and sdk/transports/transport-common/ClientTransport.h. The server and the client application must provide an implementation of the ssdk::transport_common::ServerTransport and the ssdk::transport_common::ClientTransport interfaces respectively. The AMD Transport's implementation can be found in the sdk/transports/transport-amd/ directory. The RemoteDesktopServer sample instantiates the ssdk::transport_amd::ServerTransportImpl class, which implements the ssdk::transport_common::ServerTransport interface, in the RemoteDesktopServer::InitNetwork() method. Likewise, the Simple Streaming Client sample instantiates the ssdk::transport_amd::ClientTransportImpl class, which implements the ssdk::transport_common::ClientTransport interface, in the SimpleStreamingClient::InitNetwork() method.
Your own protocol's implementation must follow the same path:
- Implement the server transport in a class derived from ssdk::transport_common::ServerTransport interface. Call the appropriate callbacks implemented by the application.
- Implement the client transport in a class derived from ssdk::transport_common::ClientTransport interface. Call the appropriate callbacks implemented by the application.
- Instantiate your own classes instead of ssdk::transport_amd::ServerTransportImpl and ssdk::transport_amd::ClientTransportImpl.
To pass parameters necessary for the transport initialization, derive classes from the ssdk::transport_common::ServerTransport::ServerInitParameters and ssdk::transport_common::ClientTransport::ServerInitParameters classes for the server and the client respectively. Add the necessary parameters to your child classes and pass them to ssdk::transport_common::ServerTransport::Start() and ssdk::transport_common::ClientTransport::Start. Upcast them inside your implementation.
The AMD Transport finds available servers by sending a UDP broadcast to the local subnet. Your protocol may support a different mechanism of how a client discovers a server to connect to. This might involve communicating with a separate directory server or other methods of discovery. Ensure that your discovery mechanism calls the methods for every server that is made available to the client.