#pragma once #include "screencast/network/rtp_packet.h" #include #include #include #include namespace sc { struct Endpoint { std::string address; uint16_t port = 0; }; // UDP transport for RTP packets. Owned by the sender or receiver pipeline. class RtpTransport { public: using ReceiveCallback = std::function; virtual ~RtpTransport() = default; // Bind locally and start the receive loop. Callback is invoked on the // transport's thread. virtual bool start(const Endpoint& local_endpoint, ReceiveCallback on_receive) = 0; // Send a packet to the configured peer. virtual bool send(const RtpPacket& packet) = 0; // Set the peer endpoint dynamically (e.g. after signaling). virtual void set_peer(const Endpoint& peer) = 0; // Stop the transport and close sockets. virtual void stop() = 0; }; class RtpTransportFactory { public: static std::unique_ptr create(); }; } // namespace sc