> we would like to
> 1) limit the number of client, do you have any suggestion about this?
> 2) if system cpu usage is very high, we want to response special custom rtsp 
> header.

Here’s how you can do both of these things:

1/ Download the latest version (2017.04.26) of the code; it contains a new 
member function that you’ll need.

2/ Subclass “RTSPServer” and “RTSPServer::RTSPClientSession”

3/ In your subclass of “RTSPServer”, redefine the virtual function 
“createNewClientSession()”, and reimplement it as follows:
        ClientSession* MyRTSPServerSubclass::createNewClientSession(u_int32_t 
sessionId) {
                if (numClientSessions() == myLimitOnTheNumberOfClients) {
                        return NULL;
                } else {
                        return new MyRTSPClientSessionSubclass(*this, 
sessionId);
                }
        }

4/ In your subclass of "RTSPServer::RTSPClientSession”, redefine the virtual 
function “handleCmd_SETUP()”, and reimplement it as follows:
        void MyRTSPServerSubclass::MyRTSPClientSessionSubclass 
handleCmd_SETUP(RTSPClientConnection* ourClientConnection, char const* 
urlPreSuffix, char const* urlSuffix, char const* fullRequestStr) {
                if (MyCPUUsageIsTooHigh) {
                        setRTSPResponse(ourClientConnection, "453 No 
Resources”);
                        return;
                }

                // Otherwise, handle the request as usual:
                RTSPServer::RTSPClientSession(ourClientConnection, 
urlPreSuffix, urlSuffix, fullRequestStr);
        }



Ross Finlayson
Live Networks, Inc.
http://www.live555.com/


_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to