Sunshine master
Self-hosted game stream host for Moonlight.
rtsp_stream::rtsp_server_t Class Reference

RTSP listener that matches incoming clients to pending launch sessions. More...

Collaboration diagram for rtsp_stream::rtsp_server_t:
[legend]

Public Member Functions

int bind (net::af_e af, std::uint16_t port, boost::system::error_code &ec)
 Bind the underlying socket or graphics resource to its target.
 
void clear (bool all=true)
 Clear launch sessions.
 
void clear_by_cert (std::string_view cert)
 Clear by cert state.
 
void handle_accept (const boost::system::error_code &ec)
 Accept a pending connection and arm the server for the next client.
 
void handle_msg (tcp::socket &sock, launch_session_t &session, msg_t &&req)
 Dispatch a parsed RTSP request to its handler.
 
void insert (const std::shared_ptr< stream::session_t > &session)
 Inserts the provided session into the set of sessions.
 
void iterate ()
 Runs an iteration of the RTSP server loop.
 
void map (const std::string_view &type, cmd_func_t cb)
 Register or visit handlers stored in the map.
 
void remove (const std::shared_ptr< stream::session_t > &session)
 Removes the provided session from the set of sessions.
 
void session_clear (uint32_t launch_session_id)
 Clear state for the oldest launch session.
 
int session_count ()
 Get the number of active sessions.
 
void session_raise (std::shared_ptr< launch_session_t > launch_session)
 Launch a new streaming session.
 
void stop ()
 Stop the RTSP server.
 

Public Attributes

safe::event_t< std::shared_ptr< launch_session_t > > launch_event
 Launch event.
 

Detailed Description

RTSP listener that matches incoming clients to pending launch sessions.

Member Function Documentation

◆ bind()

int rtsp_stream::rtsp_server_t::bind ( net::af_e af,
std::uint16_t port,
boost::system::error_code & ec )
inline

Bind the underlying socket or graphics resource to its target.

Parameters
afAddress family used for socket creation or binding.
portTCP or UDP port number.
ecError code returned by the asynchronous operation.
Returns
Network operation status.

◆ clear()

void rtsp_stream::rtsp_server_t::clear ( bool all = true)
inline

Clear launch sessions.

Parameters
allIf true, clear all sessions. Otherwise, only clear timed out and stopped sessions.

*Examples**

clear(false);
void clear(bool all=true)
Clear launch sessions.
Definition rtsp.cpp:651

◆ clear_by_cert()

void rtsp_stream::rtsp_server_t::clear_by_cert ( std::string_view cert)
inline

Clear by cert state.

Parameters
certCertificate data or object used by the operation.

◆ handle_accept()

void rtsp_stream::rtsp_server_t::handle_accept ( const boost::system::error_code & ec)
inline

Accept a pending connection and arm the server for the next client.

Parameters
ecError code returned by the asynchronous operation.

◆ handle_msg()

void rtsp_stream::rtsp_server_t::handle_msg ( tcp::socket & sock,
launch_session_t & session,
msg_t && req )
inline

Dispatch a parsed RTSP request to its handler.

Parameters
sockSocket used to read or write the protocol message.
sessionActive streaming or pairing session for the request.
reqParsed RTSP request being handled.

◆ insert()

void rtsp_stream::rtsp_server_t::insert ( const std::shared_ptr< stream::session_t > & session)
inline

Inserts the provided session into the set of sessions.

Parameters
sessionThe session to insert.

◆ map()

void rtsp_stream::rtsp_server_t::map ( const std::string_view & type,
cmd_func_t cb )
inline

Register or visit handlers stored in the map.

Parameters
typeProtocol, message, or resource type selector.
cbCallback invoked for each matching message or session.

◆ remove()

void rtsp_stream::rtsp_server_t::remove ( const std::shared_ptr< stream::session_t > & session)
inline

Removes the provided session from the set of sessions.

Parameters
sessionThe session to remove.

◆ session_clear()

void rtsp_stream::rtsp_server_t::session_clear ( uint32_t launch_session_id)
inline

Clear state for the oldest launch session.

Parameters
launch_session_idThe ID of the session to clear.

◆ session_count()

int rtsp_stream::rtsp_server_t::session_count ( )
inline

Get the number of active sessions.

Returns
Count of active sessions.

◆ session_raise()

void rtsp_stream::rtsp_server_t::session_raise ( std::shared_ptr< launch_session_t > launch_session)
inline

Launch a new streaming session.

Note
If the client does not begin streaming within the ping_timeout, the session will be discarded.
Parameters
launch_sessionStreaming session information.

The documentation for this class was generated from the following file: