How shyamalp16/cloudgaming works
Main Components
• Host Module (Screen Capture and Streaming):
• Contains the core capture logic (files like main.cpp, FrameCaptureThread.cpp, Encoder.cpp).
• Utilizes Windows.Graphics.Capture and Direct3D 11 (as indicated by names like D3DHelpers).
• Handles encoding, frame capturing, and likely WebSocket-based signaling (see Websocket.cpp).
• Implements observers for SDP offer/answer negotiation (MyCreateSdpObserver, MySetRemoteObserver).
• Client Module:
• Found in the Client directory and includes files such as PeerClient.js and an HTML server (index.html).
• Likely responsible for receiving the streaming data and rendering the captured video.
• Uses JavaScript and node’s package management (package.json, package-lock.json) to facilitate client operations.
• Server Module (Matchmaking/Signaling Server):
• Located in the Server directory, containing PureSignalingServer.js and SignalingServer.js.
• Provides the lightweight matchmaking service needed to connect hosts and clients via a P2P overlay.
• Additional/Supporting Components:
• gortc_main in Go may be an alternative or complementary signaling/connection module.
• Build configuration files (DisplayCaptureProject.sln, .vcxproj files) indicate the Host is built using Visual Studio.
• Auxiliary scripts (create_def.py, test.bat) could be used for definition generation or automation tasks.
Detail Relationships & Interactions
• Data Flow:
• The Host module captures the screen using Direct3D 11 and Windows.Graphics.Capture, encodes the frames (Encoder.cpp), and then streams the data.
• The streaming mechanism employs a P2P network, where signaling messages allow for negotiation via SDP methods (MyCreateSdpObserver and MySetRemoteObserver).
• The Server (SignalingServer) acts as the intermediary for connection setup, receiving and redistributing signaling information between Host and Client.
• The Client module (including the HTML server and JavaScript code) sets up a peer connection with the Host after matchmaking, enabling display of the captured gameplay.
• Architectural Patterns:
• Modular architecture: separation of concerns into distinct modules (capture/streaming, client display, and signaling).
• Use of client–server patterns for match-making.
• Utilization of observer patterns for SDP negotiation.
• Clear separation between presentation (Client), processing (Host), and coordination (Server).