[Live-devel] How to create multiple RTSP clients using threads for live video source playing at same time?

Ross Finlayson finlayson at live555.com
Sun Dec 25 21:35:41 PST 2011


>   I want to create a rtsp server that supports multiple live video source playing using threads.  I have created my custom live source, sink and session object and modified MediaSubsession::initiate to handle it. I created multiple rtspclients using threads to use my own session.  The problem is: I can play only one session. Do I need to create separate subsessions for each live channel playing using different urlsurfix?  How can I synchronize between these clients?

Unfortunately I found your question a little confusing.  It wasn't clear to me whether (1) your question was about a RTSP server (How to set up a RTSP server that supports multiple streams?), or whether (2) your question was about RTSP clients (How to create multiple, concurrent RTSP clients?).

If your question is (1) (How to set up a RTSP server that supports multiple streams?), then I suggest that you look at the code for the "testOnDemandRTSPServer" for guidance, and also read the FAQ entries that discuss how to have a server that streams from live source(s).  Note, in particular, that each stream (e.g., coming from a specific video+audio source) has its own "ServerMediaSession", with its own name (which gets used in the "rtsp://" URL that will be used to access the stream).  Each particular track within the stream (e.g., audio, video, text) will have its own "ServerMediaSubsession".  Once again, the "testOnDemandRTSPServer" code should make this clearer.

If your question is (2) (How to create multiple, concurrent RTSP clients?), then there are several possible ways to do this:
- Create multiple processes, each receiving its own "rtsp://" URL.  For example, you can run multiple copies of the "openRTSP" application - which will require no extra programming at all.
- Write a single application (i.e., process) that opens/receives multiple concurrent "rtsp://" URLs, using a single thread of control.  See the code for the "testRTSPClient" demo application for guidance on how to do this.
- Write a single application (i.e., process) that opens/receives multiple concurrent "rtsp://" URLs, using multiple threads (one thread for each "rtsp://" URL).  This approach is possible, although not recommended.  If you really want to do this, then you need to read and understand the FAQ entry about threads.  (Note, in particular, that each thread *must* use a separate "TaskScheduler" and "UsageEnvironment".)


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20111225/da296c52/attachment.html>


More information about the live-devel mailing list