When too many clients connect to the server, the CPU can't cope with
the load, and I start losing frames or get read errors from the pipe
I read the frames from (it's a realtime application, and I think the
kernel starts to be unstable when the system CPU time is very high).
More likely: You don't have enough OS buffering on your pipe. You
can probably increase this.
So, I'd like to set a static limit to the number of users who can
get the live stream at the same time. Is there a way?
No, not without writing new code.
If there isn't, couldn't I just create a derived class of the
RTPsinks I'm using, increase a shared counter everytime their
CreateNew() method is called and decrease it in the destructor of
the sink?
A better solution would be make changes just to the RTSP server,
rather than to the (more general) RTP code. I.e., subclass
"RTSPServer" and "RTSPClientSession". Specifically:
- Write a subclass of "RTSPServer" that
- adds a 'client session counter' member variable
- redefines the "createNewClientSession()" member function to
- just return if the counter is already at its limit
- otherwise increment the counter and create a new
object of your "RTSPClientSession" subclass (instead of the original
""RTSPClientSession")
- Write a subclass of "RTSPClientSession" that:
- has its own destructor that decrements the parent server's counter
Additionally, the increase and decrease counter operations wouldn't
have to be mutually exclusive because the library works in a
non-threaded fashion, is it right?
Yes.
--
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