The RTMP server module implements an RTMP server. More...
The RTMP server module implements an RTMP server.
It listens for incoming connections and calls the installed connect handlers to see if an incoming connection should be accepted. If it is accepted an RTMP connection is started and upon incoming RTMP commands the installed command handlers will be called.
The server is multithreaded and will start one thread for each connection.
Any number of connect handler classes may be installed to the RTMP server. Each of those handler classes has to implement a handle() function. This function gets the connection. From the connection the handle() function may get the various parameters of the connect packet and if it wants to claim it, it should return true
. If all return false
, the connection is refused.
To create a server the mi::rtmp::IFactory needs to be obtained from the Iray API using mi::neuraylib::INeuray::get_api_component(). The factory can then be used to create as many RTMP servers as needed.
The handler classes are the only ones that need to be implemented by a user. And then only the ones where the user actually wants to do something. If not implemented, they will simply not be called. The Frame_event_handler runs in a separate thread to avoid that long rendering times affect the framerate.
An example: