[Live-devel] Problems with RTSPClient

Adam Mich adammich2 at gmail.com
Fri Apr 2 10:30:48 PDT 2010


> Instead, you should be using a single event loop (in a single thread)
> - even to make multiple RTSP client requests.
Yes I know, but I have a few reasons to do it in multiple threads:
You have to take into account that there is a limit on the number of sockets
in a single FD_SET on most systems. On some systems the limit is only 64
sockets. So when you have an separate socket for RTSP, RTCP, RTP-audio and
RTP-video you can open 16 sessions at most. Safe limit would be rather about
8 sessions, I think.
>From what I found out RTSP client uses blocking calls and when it's sending
requests it is blocking other sockets, so you can loose video or audio
frames in other connections. It is undesirable effect if you are often
creating and destroying RTSP sessions.
When you have a multi core processor it is a good programming practice to
create a one thread per core and spread all sessions between all available
threads. Of course I didn't implement a multithreaded scheduler or
something. I know that LiveMedia don't support thread pool architecture (
and thanks God, it looks good and fancy in academic books but it's debugging
hell and you probably loose more trying to synchronize access to session
data or even queue than gain from using multiple threads ).
I saw your comment in code regarding making CSeq static. If there is a
problem with other usage scenarios you can always move CSeq to
BasicEnvironment class. It would be one CSeq variable per thread in that
case.
Thanks for all answers,
Adam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20100402/ac1db74b/attachment.html>


More information about the live-devel mailing list