/* MediaMtx (C++) - WebRTC server, WHEP (MediaMTX: internal/servers/webrtc) POST //whep SDP offer -> 201 + SDP answer, Location //whep/ PATCH //whep/ trickle ICE (application/trickle-ice-sdpfrag) DELETE //whep/ close the session OPTIONS CORS preflight GET // a small player page */ #pragma once #include #include #include #include #include "../../conf/serverConf.h" #include "../../core/mediaPath.h" #include "../../protocols/httpp/httpServer.h" #include "session.h" namespace mtx { class WebrtcServer : public LogParent { public: WebrtcServer(const ServerConf & global, PathProvider * paths); ~WebrtcServer(); bool start(std::string & err); void stop(); size_t sessionCount() const; private: void handle(const HttpRequest & req, HttpResponse & res); void janitor(); ServerConf m_global; PathProvider * m_pPaths; HttpServer m_http; mutable std::mutex m_mutex; std::map> m_sessions; std::thread m_janitor; std::mutex m_stopMutex; std::condition_variable m_stopCond; bool m_bRun = false; }; } // namespace mtx